var StatusUchwyt   = 0;
var StatusAktualny = "";
var G__OknoPopupu = "";
var G__MainURL = "http://www.nowy.scantour.webmax.pl";
var G__Navigator = navigator.userAgent.toUpperCase();
var G__BGColor = '';
var Obj_Destination_Curr_ID = 1;
var Obj_Destination_Curr_GBC = "";
var Obj_Destination_Curr_C = "";



//  wstępne ładowanie obrazków itp
// ********************************
function Preloader( Text_ , tImg_ )
{
var TabImg_ = new Array();
var TabObr_ = new Array();

if ( typeof tImg_ == "array" )
  {
  TabImg_ = tImg_;
  }
 else
  { 
  TabImg_[ 0] = '/images/layout/spacer.gif';
  TabImg_[ 1] = '/images/layout/header_01.jpg';
  TabImg_[ 2] = '/images/layout/header_02.gif';
  TabImg_[ 3] = '/images/layout/header_03.gif';
  TabImg_[ 4] = '/images/layout/header_04.gif';
  TabImg_[ 5] = '/images/layout/top_menu_01.jpg';  
  TabImg_[ 6] = '/images/layout/top_menu_02.gif';  
}  

if ( Text_ != '' )
  {
  PodmieniajStatus( Text_ );
}  

for ( Kolejny_=0 ; Kolejny_ < TabImg_.length ; Kolejny_ ++ )
  {
  TabObr_[Kolejny_] = new Image();
  TabObr_[Kolejny_].src = TabImg_[Kolejny_];    
}   

return false;
} // koniec Preloader()




//  status
// *****************************************
function PodmieniajStatus( Text_ )
{
window.status = Text_;
StatusUchwyt  = setTimeout( "PodmieniajStatus( '"+Text_+"' )", 100 );
return true;
} // koniec PodmieniajStatus()




//  przed załadowaniem sewrisu ....
// *****************************************
function BeforeLoad()
{


} // koneic BeforeLoad(




//  po załadowaniu sewrisu ....
// *****************************************
function LoadAndRun( Text_ )
{
document.body.ondragstart = NieRoobNic;
clearTimeout( StatusUchwyt );
window.status = ""+Text_;

FixPNG();

return true;
} // koniec LoadAndRun()




//  zwraca nic
// *****************************************
function NieRoobNic()
{
return false;
} // koniec NieRoobNic()



//  podmienia status
// *****************************************
function StatusZmiana( Text_ )
{
if ( Text_ != "" )
  {
  StatusAktualny = window.status;
	window.status = ""+Text_;
	}
 else
  {
  window.status = StatusAktualny;
}	

return true;
} // koniec StatusZmiana()




//  nowe okno z serwisem .....
// *****************************************
function NoweOkno( URL_ )
{
window.open( 'http://'+URL_ );
return false;
} // koniec StatusZmiana()




//  nowe okno lokalne z serwisem .....
// *****************************************
function NoweOknoLok( URL_ ,Nazwa_,Param_)
{
Nazwa_ = ( Nazwa_==null ) ? "" : Nazwa_;
Param_ = ( Param_==null ) ? "" : Param_;

window.open( URL_ , Nazwa_ , Param_ );

return false;
} // koniec NoweOknoLok()




//  testowanie ramek
//  jak kto odpala serwis w ramce to wyłazi na wierzch :))
// ******************************************************
function TestRamek()
{
if ( top.window.location != self.window.location )  
  {
	top.window.location.replace( G__MainURL );
}
} // koniec TestRamek()




//  sprawdza czy nie otworzyno popupu w nowym oknie
// ****************************************************
function SprImgWindow()
{
if ( window.name == '' )
  {
	window.location.replace( G__MainURL );
}
} // koniec SprImgWindow()




//  wycina wszystkie spacje
// *****************************
function KillAllSpace( Ciag_ )
{

while ( Ciag_.indexOf( " " ) >= 0 )
  {
	Ciag_ = Ciag_.replace( ' ' , '' );	
}	

return Ciag_
} // koniec KillAllSpace()




/// testowanie poprawności maila
// ****************************************
function MailTest( Mail_ )
{

return ( KillAllSpace(Mail_).length > 0 && (/^[^? ]{1,}[@]{1}[^? ]{1,}[.]{1}[^? ]{1,}$/.test(Mail_) ) )
} // koniec MailTest()



// ******************************************
function OtworzPopup( Plik_ , Szer_ , Wys_, DodParam_, ZmienRozm_ )
{
DodParam_  = ( DodParam_ == null ) ? "" : DodParam_;
ZmienRozm_ = ( ZmienRozm_ == null ) ? true : ZmienRozm_;

if ( ZmienRozm_ )
  {
  if ( Wys_>600 )
    {
    Szer_ += 16;
    Wys_   = 600;  
    DodParam_ += ',scrollbars=yes';  
  }
  if ( Szer_>800 )
    {
    Wys_ += 16;
    Szer_   = 800;  
    DodParam_ += ',scrollbars=yes';  
  }
}  

PozTop_  = Math.ceil( ( screen.height - Wys_ ) / 2 );
PozLeft_ = Math.ceil( ( screen.width - Szer_ ) / 2 );

if ( G__OknoPopupu )
  {
  G__OknoPopupu.close();
}
G__OknoPopupu = window.open( Plik_, 'popup','width='+Szer_+',height='+Wys_+',top='+PozTop_+',left='+PozLeft_+''+DodParam_);

return false;
} // koniec OtworzPopup()




// ******************************************
function FixPNG()
{

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

if ((version >= 5.5) && (document.body.filters)) 
{
   for(var i=0; i<document.images.length; i++)
   {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText 
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
         img.outerHTML = strNewHTML
         i = i-1
      }
   }
}

return false;
} // koniec FixPNG()




//*******************************
function  GetCssStyle( Param_ )
{    
var Return_ = '';

if ( Param_ == 'TR' )
  {
  Return_ = ( G__Navigator.indexOf( 'MSIE' ) > 0 && G__Navigator.indexOf( 'OPERA' ) == -1 ) ? 'block' : 'table-row';
}

return Return_;
} // koniec GetCssStyle()




// ******************************************
function TextDispl( Id_ )
{

if ( Obj_ = document.getElementById(Id_) )
  {
  var Status_ = ( Obj_.style.display != 'none' ) ? 'none' : GetCssStyle('TR');

  Obj_.style.display = Status_;
}  

return false;
} // koniec TextDispl()





// ******************************************
function LightMenu1(Obj_,Status_)
{

if ( Status_ == 1 )
  {
  Obj_.style.backgroundColor = '#fff98f';
  }
 else
  {
  Obj_.style.backgroundColor = '#ffe211';  
}   

return false;
} // koniec LightMenu1()




// ******************************************
function LightMenu2(Obj_,Status_)
{

if ( Status_ == 1 )
  {
  Obj_.style.backgroundImage = 'url(/images/layout/top_menu_03.gif)';
  }
 else
  {
  Obj_.style.backgroundImage = '';  
}   

return false;
} // koniec LightMenu2()





//  start wyszukiwania
// *************************************************
function SeekStart()
{
Start_ = true; 

if ( Start_ && KillAllSpace(document.getElementById('sFraza').value).length == 0 && document.getElementById('sGrupa').value == 0 && document.getElementById('sKraj').value == 0 )
  {
  Start_ = false;
  alert( "wybież przynajmniej jedno kryterium" );
  document.getElementById('sFraza').focus();
}  

if ( Start_ && document.getElementById('sFraza').value != '' && KillAllSpace(document.getElementById('sFraza').value).length < 3  )
  {
  Start_ = false;
  alert( "wyszukiwana fraza musi mieć przynajmniej 3 znaki" );
  document.getElementById('sFraza').focus();
}


if ( Start_ )
  {
  document.getElementById('formSeek').submit();
}
  
return false;
} // koniec SeekStart()





// ********************************************
function FormNewsletter_Start()
{
var OK_ = true;


if ( OK_ && KillAllSpace(document.getElementById('newsletter_email').value).length < 1 )
  {
  alert( "Proszę podać swój adres e-mail" );
  OK_ = false;
  document.getElementById('newsletter_email').focus();     
}  

if ( OK_ && !MailTest( document.getElementById('newsletter_email').value ) )
  {
  alert( "Podany adres e-mail nie jest poprawny" );
  OK_ = false;
  document.getElementById('newsletter_email').focus();     
}  

return OK_;
} // koniec SprFormNewsletter();





// ********************************************
function FormNewsletter_Status( Status_ )
{

document.getElementById('FormNewsletter_Action').value = Status_;
//document.getElementById('FormNewsletter').submit();

return false;
} // koniec SprFormNewsletter();




// ********************************************
function DestinationShow( Id_ )
{

if ( Obj_Destination_Curr_ID != Id_ )
  {
  ObjH_ = document.getElementById('Obj_Destination_H'+Obj_Destination_Curr_ID);
  ObjC_ = document.getElementById('Obj_Destination_C'+Obj_Destination_Curr_ID);

  ObjH_.style.fontWeight = 'normal';
  ObjH_.style.backgroundColor = '#f0f0f0';  
  ObjH_.style.borderBottom = '1px solid #666666';
  ObjC_.style.display = 'none';           


  ObjH_ = document.getElementById('Obj_Destination_H'+Id_);
  ObjC_ = document.getElementById('Obj_Destination_C'+Id_);

  ObjH_.style.fontWeight = 'bold';
  ObjH_.style.backgroundColor = '#ffffff';
  ObjH_.style.borderBottom = '1px solid #ffffff';
  ObjC_.style.display = 'block';        

  Obj_Destination_Curr_GBC = '#ffffff';
  
  Obj_Destination_Curr_ID = Id_;
}  


return false;
} // koniec DestinationShow();





// ********************************************
function DestinationLight( Obj_, Status_ )
{

if ( Status_ == 1 )
  {
  Obj_Destination_Curr_GBC = Obj_.style.backgroundColor;
  Obj_Destination_Curr_C = Obj_.style.color;  
  Obj_.style.backgroundColor = '#e0ebf8';
  Obj_.style.color = '#be0f24';     
  }

 else
  { 
  Obj_.style.backgroundColor = Obj_Destination_Curr_GBC;
  Obj_.style.color = Obj_Destination_Curr_C;  
}

return false;
} // koniec DestinationLight();



