var xxxx=0;

var useShadows = false;

var xTourTitle = "";
var xTourGroup = "";
var xTourIdfier = "";
var xTourDisabled = "0";
var xTourOfferable = "0";
var xTourListable = "0";
var xTourCatID = 0;
var xTourLocID = 0;
var xTourImpression = "";

var xTheme = "BE";
var xShowMainList = 0;
var intervalID_Offer   = 0;
var interval_Offer     = 3000;
var intervalID_Gallery = 0;
var interval_Gallery   = 3000;

var firstPageRun=true;
var xDisplayedOfferID="0";
var xPrevDisplayedOfferID="0";
var arr_CaptionPics = [];
var arr_GalleryPics = [];

var w_LeftAdBox = null;
var x_LeftBox_content = "";
var w_RightAdBox = null;
var x_RightBox_content = "";

var xWillDisplayGalleryPic = 1;
var xGalleryPicCount=0;
var GalPicCacheOK=false;
var currGalPicDesc="";

var save_divOfferBkColor="";
var save_OfferPic="";
var save_OfferCaption="";
var save_OfferName="";
var save_OfferNameBkColor="";
var save_OfferNotice="";  

var w_LastPopup = null;
var w_InfoRequest = null;
var w_AboutUs = null;
var w_ShowSimilarTours = null;	
var w_ShowAllTours = null;	
var w_adminPanel = null;
var w_picsPanel = null;
var w_FileUpload = null;

var cap_AboutUs="";
var	cap_InfoRequest="";
var cap_ShowSimilarTours="";	
var cap_ShowAllTours="";
var cap_ActualTours="";
var cap_TourLocation="";
var xLocURL="";
var xLocURL_global="";
var xLocURL_local="";
var cap_TourBlog="";
var cap_TourReports="";
var xMapURL="";
var xMapURL_global="";
var xMapURL_local="";
var cap_TourDoc="";
var xDocURL="";
var xDocURL_global="";
var xDocURL_local="";
var cap_TourDates="";
var xTourDates="";
var xTourDates_global="";
var xTourDates_local="";
var cap_TourPrices="";	
var xTourPrices="";	
var xTourPrices_global="";	
var xTourPrices_local="";	

var saveArticlePicBorderColor = "";

var cap_Category="";
var cap_Country="";
var cap_Region="";

var goto_TourID = 0;
var goto_Lang = "";

var save_div_Offer_innerHTML = "";

var xCarousel;

var cs_large = {
      tl: { radius: 13 },
      tr: { radius: 13 },
      bl: { radius: 13 },
      br: { radius: 13 },
      antiAlias: true
    };
var cs_large2 = {
      tl: { radius: 13 },
      tr: { radius: 13 },
      bl: { radius: 13 },
      br: { radius: 0 },
      antiAlias: true
    };	
var cs_small = {
      tl: { radius: 6 },
      tr: { radius: 6 },
      bl: { radius: 6 },
      br: { radius: 6 },
      antiAlias: true
    };	
var cs_tiny = {
      tl: { radius: 4 },
      tr: { radius: 4 },
      bl: { radius: 4 },
      br: { radius: 4 },
      antiAlias: true
    };		
var cs_offerpic = {
      tl: { radius: 10 },
      tr: { radius: 0 },
      bl: { radius: 10 },
      br: { radius: 0 },
      antiAlias: true
    };	




function run_Page () {
  if (intervalID_Offer!=0) {window.clearTimeout(intervalID_Offer);}
  if (intervalID_Gallery!=0) {window.clearInterval(intervalID_Gallery);}	
  var e;
  if (firstPageRun==true) {  
    e=document.getElementById("img_Lang_"+xLang);
	if (e!=null) {
	  e.style.borderColor='#FFFFFF';  
	  e.className="cls_langicon";
	  if (useShadows==true) Shadower.shadow(e.id, {distance:3, angle:130, opacity:0.6, nestedShadows:4, color:'#6A3510'});			  
	}
  }  
  if (xTourID=="0") {
	var getList = (firstPageRun)? "1": "0";  
    jsrsExecute("scripts/fx_TourOffer.php", run_MainPage_cb, "getTourOffer", Array(xLang,xDisplayedOfferID,getList));    		
  }
  else {
//	if (xTourDisabled=="1") e='0'; else e=xTourID; 	
    jsrsExecute("scripts/fx_GetGallery.php", run_TourPage_cb, "getGallery", Array(xTourID));    			
  }
}

var save_returnString = "";

function run_MainPage_cb (returnString) {
  var errchk = returnString.substr(0,9);
  if (errchk == "errPoint:") {
	alert(returnString); 
  }
  else if (returnString=="") {
    firstPageRun=false;	  
    if (xFormRequest==true) showInfoRequestForm();		
    else if (xAboutUsRequest==true) showAboutUs();			  	  
  }
  else {	  
    var vals = returnString.split("|~|");
    var z = (vals[4]=="1")? vals[0]: "0";  
    if ((arr_CaptionPics[vals[0]]==null)||(arr_CaptionPics[vals[0]]=="undefined")) {
      arr_CaptionPics[vals[0]]=new Image(300,205);		
	  arr_CaptionPics[vals[0]].src="pics/"+z+"/caption.jpg";		  
	}
	save_returnString=returnString;
	if (firstPageRun==true)
	  run_MainPage_cb_2();
	else {
	  if (interval_Offer>0)	intervalID_Offer=window.setTimeout('run_MainPage_cb_2()',interval_Offer);		
	}
  }
}


	
function run_MainPage_cb_2 () {	
  var e;		  
  var s;  
  var t;  	
  var z;
  var w;
  var vals = save_returnString.split("|~|");	
	
  xPrevDisplayedOfferID=xDisplayedOfferID;
  xDisplayedOfferID=vals[0];
  var z = (vals[6]=="1")? vals[0]: "0";  
  save_OfferPic="url(pics/"+z+"/caption.jpg)";
  e=recreateDiv('div_OfferPic','');
  e.style.backgroundImage=save_OfferPic;
  curvyCorners(cs_offerpic, e);   			
  e=document.getElementById("OfferCaption");
  save_OfferCaption=vals[1]; 
  e.innerHTML=save_OfferCaption;
  e=document.getElementById("OfferName");
  save_OfferName=vals[2];	
  e.innerHTML=save_OfferName;
  e=document.getElementById("OfferNotice");
  switch (vals[3]) {
	  case "$new"        : s='notice_new.'+xLang; break;	  
	  case "$bestoffer"  : s='notice_bestoffer.'+xLang; break;
	  case "$lastminute" : s='notice_lastminute.'+xLang; break;
	  case "$mostwanted" : s='notice_mostwanted.'+xLang; break;	  
	  default: s='trans'; 		
  }
  save_OfferNotice="images/"+s+".gif";
  e.src=save_OfferNotice;
  e=document.getElementById("OfferCatLoc");  
  e.innerHTML=vals[4]+"<br>"+vals[5];

  if (xShowMainList=="1") {
		
    if (firstPageRun==true) {		
	  
      e=document.getElementById("ActualTours_frame");
	  t=e.style.backgroundColor;
	  w=7;
	  var tour;
	  var adm = (userInfo!="")? "+'&USR="+userInfo+"'": "";
	  s="<table id=\"ActualTours_content_table\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\" width=\"243\" style=\"table-layout:fixed;\">"+
	      "<col width=\"54\">"+
		  "<col width=\"169\">";
	  while (w<vals.length) {
		tour = vals[w].split("|:|");	  
		z = (tour[2]=="1")? tour[0]: "0";  
        if ((arr_CaptionPics[tour[0]]==null)||(arr_CaptionPics[tour[0]]=="undefined")) {
          arr_CaptionPics[tour[0]]=new Image(300,205);		
          arr_CaptionPics[tour[0]].src="pics/"+z+"/caption.jpg";		  
	    }		
		s+="<tr id=\"row_ActualTour_"+tour[0]+"\" class=\"ActualTourRow\" style=\"background-color:"+t+";\" onmouseover=\"this.style.cursor='pointer'; chgColor_ActualTour(this,2);\" onmousemove=\"chgColor_ActualTour(this,2);\" onmouseout=\"chgColor_ActualTour(this,-1);\" onclick=\"document.location='index.php?TO="+tour[0]+"&LN='+xLang"+adm+";\">"+
 		     "<td width=\"54\"><img src=\"pics/"+z+"/caption.jpg\" border=\"0\" width=\"54\" height=\"40\"/></td>"+
		     "<td width=\"169\" style=\"white-space:normal;overflow:hidden;\"><strong>"+tour[1]+"</strong></td>"+
		     "</tr>"+
		     "<tr><td colspan=\"2\" bgcolor=\"#E3D8BB\" style=\"padding:0px;\"><img src=\"images/trans.gif\" border=\"0\" height=\"4\" /></td></tr>";
	    w+=1;	  
	  }
	  s+="</table>";
	  e=document.getElementById("ActualTours_content");	
	  e.innerHTML=s;  
	}
    
    if (xPrevDisplayedOfferID!="0") {
  	  e=document.getElementById("row_ActualTour_"+xPrevDisplayedOfferID);	
	  if (e!=null) chgColor_ActualTour(e,0);		
	}
	e=document.getElementById("row_ActualTour_"+xDisplayedOfferID);	
	if (e!=null) chgColor_ActualTour(e,1);
    
  }

  if (firstPageRun==true) window.setTimeout('showBoxes()',3000);	 

  firstPageRun=false;	  
  window.setTimeout('run_Page()',100);		
       if (xFormRequest==true) showInfoRequestForm();		
  else if (xAboutUsRequest==true) showAboutUs();
 
}


function get_WindowSize () {
  var winW = 630, winH = 460;
  if (parseInt(navigator.appVersion)>3) {
    if (navigator.appName=="Netscape") {
      winW = window.innerWidth;
      winH = window.innerHeight;
    }
    if (navigator.appName.indexOf("Microsoft")!=-1) {
      winW = document.body.offsetWidth;
      winH = document.body.offsetHeight;
    }
  }
  var arr=[];
  arr[0]=winW;
  arr[1]=winH;  
  return arr;
}


function showBoxes () {
  if ((x_LeftBox_content!="")||(x_RightBox_content!="")) {	
    var e=document.getElementById("ArticlePic");
	//e.style.display="none";
	new Effect.Scale(e, 10);
    window.setTimeout('showBoxes_2()',1000);	 	
  }
}

function showBoxes_2 () {
  var s, t, e, i, arr, xx=0, y, yy=15, p;
  e=document.getElementById("MidSection");
  p=findObjPos(e);				
  y=p[1];
//  if (navigator.appName.indexOf("Microsoft")!=-1) yy=yy+4;
//  if (useShadows==true) xx=10;
  t = (userInfo=="")? "": "&USR="+userInfo;  
  if (x_LeftBox_content!="") {	
    s=x_LeftBox_content.substr(0,6);
	if (s=="$tour=") 
	  s="fx_AdBox.php?PO=L&TO="+x_LeftBox_content.substr(6)+"&LN="+xLang+t;	
	else
	  s="fx_AdBox.php?PO=L&LN="+xLang+t;
	s="scripts/"+s;  
    w_LeftAdBox=showPopup("",s,1,false, -246,y-24+yy,246,373, false, 'default');
    i=w_LeftAdBox.getId();
    e=document.getElementById(i);
    new Effect.Move(e, { x: (246+xx), y: 0, mode: 'relative' });
  }
  if (x_RightBox_content!="") {	
    arr=get_WindowSize();
    s=x_RightBox_content.substr(0,6);
	if (s=="$tour=") 
	  s="fx_AdBox.php?PO=R&TO="+x_RightBox_content.substr(6)+"&LN="+xLang+t;	
	else
	  s="fx_AdBox.php?PO=R&LN="+xLang+t;
	s="scripts/"+s;  	
    w_RightAdBox=showPopup("",s,1,false, arr[0],y-24+yy,246,373, false, 'default');
    i=w_RightAdBox.getId();
    e=document.getElementById(i);
    new Effect.Move(e, { x: -(246+xx), y: 0, mode: 'relative' });
  }  
  if ((w_LeftAdBox)||(w_RightAdBox)) window.setTimeout('closeBoxes()',15000);	 	    
  if ((useShadows==true)&&((w_LeftAdBox)||(w_RightAdBox))) window.setTimeout('showBoxes_3()',500);	 	  
}


function showBoxes_3 () {
  var s;
  if (w_LeftAdBox) {
    s=w_LeftAdBox.getId();
    Shadower.shadow(s+"_row2", {distance:16, angle:141, opacity:0.32, nestedShadows:16, color:'#6A3510'});			  
  }
  if (w_RightAdBox) {
    s=w_RightAdBox.getId();
    Shadower.shadow(s+"_row2", {distance:16, angle:141, opacity:0.32, nestedShadows:16, color:'#6A3510'});
  }  
}

function closeBoxes () {
  if (w_LeftAdBox) w_LeftAdBox.close();  
  if (w_RightAdBox) w_RightAdBox.close();  		
}

function chgColor_ActualTour (e,hilite) {
  var q=document.getElementById('ActualTours_frame');	
  switch (hilite) {
      case -1: e.style.backgroundColor=q.style.backgroundColor; 
			   break;
	  case 0 : if (e.style.backgroundColor!="rgb(255, 255, 208)") {
		         q=document.getElementById('ActualTours_frame');
	             e.style.backgroundColor=q.style.backgroundColor; 
	           }
			   break;	  
	  case 1 : if (e.style.backgroundColor!="rgb(255, 255, 208)") e.style.backgroundColor="#FFF0B0"; 
	  		   break;
	  case 2 : e.style.backgroundColor="#FFFFD0"; 
	           break;	  
  }
}




function run_TourPage_cb (returnString) {	  
  var errchk = returnString.substr(0,9);
  if (errchk == "errPoint:") {
	alert(returnString); 
  }
  else {	
    xGalleryPicCount=0;
    xCarousel = new myCarousel; 
    xCarousel.init(1,20);  
    var e = document.getElementById("crscontainer1");
    e.crsObject.changeContent("&nbsp;");	
    if (returnString!="") {
      var pics = returnString.split("|~|");	
	  xGalleryPicCount=pics.length;
      GalPicCacheOK=false;	  
	  var x;
//	  if (xTourDisabled==0) x=xTourID; else x="0";
      var p = "";  
      for (var i=0; i<pics.length; i++) {
	    p += '<img id=\"GalPic_'+(i+1)+'\" src=\"pics/'+xTourID+'/'+pics[i]+'\" width=\"90\" height=\"90\" border=\"0\" onclick=\"displayGalleryPic(this,false);\" />';
	    if (i<pics.length-1) p += '<img src=\"images/trans.gif\" width=\"5\" height=\"1\" border=\"0\" />';
      }
      e.crsObject.changeContent(p);	    
      if (pics.length>5) {
        e=document.getElementById("bt_GalleryLeft");
	    e.innerHTML="&lt;";
        e=document.getElementById("bt_GalleryRight");
	    e.innerHTML="&gt;";
      }
      if (interval_Gallery>0) intervalID_Gallery=window.setInterval('run_TourPage_cb_2()',interval_Gallery);
      xWillDisplayGalleryPic=1;	  
      e=document.getElementById("GalPic_"+xWillDisplayGalleryPic);	  
      displayGalleryPic(e,true);	  
	}
    firstPageRun=false;	  	
    if (xFormRequest==true) showInfoRequestForm();
    else if (xAboutUsRequest==true) showAboutUs();			  	  	  
  }
}



function displayGalleryPic (img,toCache) {
  var i=img.src.indexOf('/pics/');	
  var s=img.src.substr(i+6);
  var w=s.indexOf('/');	
  var t=s.substr(w+3); 
  var x;
//if (xTourDisabled==0) x=xTourID; else x="0";
  var s = img.src.substr(0,i) + "/pics/" + xTourID + "/g_" + t;
  var e;
  if (toCache==true) {
	var z=1*img.id.substr(7);  
    if ((arr_GalleryPics[z]==null)||(arr_GalleryPics[z]=="undefined")) {
      arr_GalleryPics[z]=new Image(450,350);		
      arr_GalleryPics[z].src=s;		
	}
  }
  else {
    xWillDisplayGalleryPic=1*img.id.substr(7);	  
    e=document.getElementById('ArticlePic_in');
    e.src=s;  			
    s = "d_" + t;
    var z=s.lastIndexOf(".");
    s = s.substr(0,z);
	jsrsExecute("scripts/fx_ReadFile.php", displayGalleryPic_cb , "do_ReadFile", Array(xTourID,s));    		
  }
}

function displayGalleryPic_cb (returnString) {
  currGalPicDesc=returnString;	
}

var AnimStat = 1;

function run_TourPage_cb_2 () {
  if (intervalID_Gallery!=0) window.clearInterval(intervalID_Gallery);
  if ((AnimStat==1)&&(xGalleryPicCount>0)) {
	var e=document.getElementById('GalPic_'+xWillDisplayGalleryPic);
    displayGalleryPic(e,false);
    xWillDisplayGalleryPic += 1;
    if (xWillDisplayGalleryPic>xGalleryPicCount) {
	  xWillDisplayGalleryPic=1;
	  GalPicCacheOK=true;
	}		
    if (interval_Gallery>0) intervalID_Gallery=window.setInterval('run_TourPage_cb_2()',interval_Gallery);	
	if (GalPicCacheOK==false) {
  	  e=document.getElementById('GalPic_'+xWillDisplayGalleryPic);
      displayGalleryPic(e,true);
	}
  }
}


var intervalID_RestartAnim = 0;

function chgAnimation(elmnt,stopIt) {
  var e,f,z;	 
  if (xTourID!="0") {
    e=document.getElementById('ArticlePic');
	f=document.getElementById('ArticlePic_desc');  				
    if (stopIt==true) {
	  if ((elmnt.id=="ArticlePic_desc")&&(f.style.display!="none")) {
		if (intervalID_RestartAnim!=0) {
		  window.clearTimeout(intervalID_RestartAnim);	  
		  intervalID_RestartAnim=0;
		}
	  }
	  else if ((elmnt.id!="ArticlePic")||(f.style.display=="none")) {  	  	
	    AnimStat=0;  
        if (intervalID_Gallery!=0) {
		  window.clearInterval(intervalID_Gallery);	  
		  intervalID_Gallery=0;
		}
	    e.style.borderColor="red";
	    e.style.cursor='wait';
	    if ((elmnt.id=="ArticlePic")&&(currGalPicDesc!="")) {
          f=document.getElementById('ArticlePic_desc_in');  					
	      f.innerHTML=currGalPicDesc;	  			
		  animate_PicDesc();    		
		}
	  }
    }
    else {
	  if (intervalID_RestartAnim!=0) window.clearTimeout(intervalID_RestartAnim);	
	  intervalID_RestartAnim=window.setTimeout('restartAnimation()',300);	
	}
  }
}


function restartAnimation () {
  intervalID_RestartAnim=0;
  AnimStat=1;  	  
  if (intervalID_Gallery!=0) window.clearInterval(intervalID_Gallery);	  
  if (interval_Gallery>0) intervalID_Gallery=window.setInterval('run_TourPage_cb_2()',interval_Gallery);	
  var e=document.getElementById('ArticlePic');
  e.style.borderColor=saveArticlePicBorderColor;
  e.style.cursor='auto';	  
  e=document.getElementById('ArticlePic_desc');  
  e.style.display="none";
}


function animate_PicDesc () {
  var e,f,p,z,h,s;	
  e=document.getElementById('ArticlePic_desc');  				
  f=document.getElementById('ArticlePic_desc_in'); 
  p=document.getElementById('ArticlePic');  		
  z=findObjPos(p);	
  if (e.style.display=="none") 	{
    e.style.display="";				
    e.style.height="0px";
    e.style.top=(z[1]+p.offsetHeight-11)+"px";
    window.setTimeout('animate_PicDesc()',20);
  }
  else if (e.offsetHeight<(p.offsetHeight-10)) {
	if (f.offsetHeight>(e.offsetHeight-10)) { 
	  h=f.offsetHeight-(e.offsetHeight-10);
	  if (h>20) h=20;
      s=e.style.top.split("px");
      e.style.top=(parseInt(s[0])-h)+"px";	  	
      s=e.style.height.split("px");
      e.style.height=(parseInt(s[0])+h)+"px";
      window.setTimeout('animate_PicDesc()',20);
	}
  }
}



function null_cb (returnString) {
  var errchk = returnString.substr(0,9);
  if (errchk == "errPoint:") {
	alert(returnString); 
  }
}



function adjGalleryPos (e) {
  if (e.id=="bt_GalleryLeft") fn_moveCarousel_rightmost(1); else fn_moveCarousel_leftmost(1);   
}


function getElmntsByClassName (master,cl) {
  var retnode = [];
  var myClass = new RegExp('\\b'+cl+'\\b');
  var thisClass;
  var elem = master.getElementsByTagName('*');
  for (var i = 0; i < elem.length; i++) {
    thisClass = elem[i].className;
    if (myClass.test(thisClass)) retnode.push(elem[i]);
  }
  return retnode;
}


function recreateDiv (compName,aHTML) {
  var e=document.getElementById(compName);
  var p=e.parentNode;
  p.removeChild(e);
  e=document.createElement('div');
  p.appendChild(e);
  e.setAttribute('id',compName);
  if (aHTML!="") e.innerHTML=aHTML;
  return e;
}  	


function rgbConvert(str) {
   str = str.replace(/rgb\(|\)/g, "").split(",");
   str[0] = parseInt(str[0], 10).toString(16).toLowerCase();
   str[1] = parseInt(str[1], 10).toString(16).toLowerCase();
   str[2] = parseInt(str[2], 10).toString(16).toLowerCase();
   str[0] = (str[0].length == 1) ? '0' + str[0] : str[0];
   str[1] = (str[1].length == 1) ? '0' + str[1] : str[1];
   str[2] = (str[2].length == 1) ? '0' + str[2] : str[2];
   return ('#' + str.join(""));
}



function goto_TourPage () {
  var tor = (goto_TourID!=0)? 'TO='+goto_TourID : '';  
  var lng = (goto_Lang!="")?  'LN='+goto_Lang : '';  
  var adm = (userInfo!="")?   'USR='+userInfo : '';    
  var newLoc='index.php';
  var s=tor;
  if (lng!="") { if (s=="") s=lng; else s+="&"+lng; }
  if (adm!="") { if (s=="") s=adm; else s+="&"+adm; }
  if (s!="") newLoc += "?"+s;
  if (document.location!=newLoc) document.location=newLoc; else document.location.reload(true);		
}


function do_HomePage () {
  var adm;  	  
  if (xTourID=='0') {
    if (userInfo!="") {
      document.location='index.php?LN='+xLang;		
	}
  }
  else {
    var adm = (userInfo!="")? '&USR='+userInfo : '';  	  
    document.location='index.php?LN='+xLang+adm;
  }
}



function chgLang (e) {
  var xNewLang=e.id.substr(9);
  var s='index.php?';
  var t='';
  if (xTourID!='0') t='TO='+xTourID+'&';
  s=s+t+'LN='+xNewLang;
  if (w_InfoRequest!=null) s+='&FRQ=1';
  else if (w_AboutUs!=null) s+='&ARQ=1';
  w_InfoRequest=null;
  w_AboutUs=null;
  var adm = (userInfo!="")? '&USR='+userInfo : '';    
  document.location=s+adm;
}



function langIcon_mouseOver (e) {
  e.className='cls_langicon';
}

function langIcon_mouseOut (e) {
  var s=e.id.substr(9);
  if (s!=xLang) e.className='cls_langicon cls_trans';
}


function findObjPos(obj) {
  var curleft = curtop = 0;
  if (obj.offsetParent) {
    curleft = obj.offsetLeft;
    curtop = obj.offsetTop;
    while (obj = obj.offsetParent) {
      curleft += obj.offsetLeft;
	  curtop += obj.offsetTop;
	}
  }
  return [curleft,curtop];
}

function chgColor (e,stat) {
  switch (stat) {
    case 0 : e.style.color='#706050'; break;
	case 1 : e.style.color = '#FFFFD0';	break;
  }
}


function onPopupClose (w_Popup) {
  var e;
  var c;
  if (w_Popup==w_adminPanel) {
	w_adminPanel=null;			  
	e=document.getElementById("bt_admin_panel");
	if (e.value=="refresh") {
      goto_TourID=0;  
	  goto_Lang=xLang;
  	  window.setTimeout('goto_TourPage()',500);		
	}
	else
	  e.value="open panel";
  }
  else if (w_Popup==w_picsPanel) {
	w_picsPanel=null;			  
	e=document.getElementById("bt_admin_pics");
	if (e.value=="refresh") {
      goto_TourID=xTourID;  
	  goto_Lang=xLang;
  	  window.setTimeout('goto_TourPage()',500);		
	}
	else
	  e.value="open pic.s";	
  }  
  else if (w_Popup==w_AboutUs) 
    w_AboutUs=null;
  else if (w_Popup==w_InfoRequest) 
	w_InfoRequest=null;  
  else if ((w_Popup==w_ShowAllTours)||(w_Popup==w_ShowSimilarTours)) {
	c = w_Popup.getContent();  	  
    e = c.getElementsByTagName('tr');
	goto_TourID=0;
	if (e.length>0) for (var i=0; i<e.length; i+=1) {		  
      if (e[i].className=='SelectedTourRow') goto_TourID=e[i].id.substr(5);
	}
    if (w_Popup=w_ShowSimilarTours) {	  
      w_ShowSimilarTours=null;    
	  if ((goto_TourID==0) && (xTourID=="0") && (interval_Offer>0)) intervalID_Offer=window.setTimeout('run_MainPage_cb_2()',interval_Offer);
	}
	else
      w_ShowAllTours=null;    	
	if (goto_TourID>0) {
	  goto_Lang=xLang;
	  window.setTimeout('goto_TourPage()',1000);
	}
  }
  else if ((w_Popup==w_LeftAdBox)||(w_Popup==w_RightAdBox)) {
    if (w_Popup==w_LeftAdBox) w_LeftAdBox=null; else w_RightAdBox=null;
    if ((w_LeftAdBox==null)&&(w_RightAdBox==null)) {	
      e=document.getElementById("ArticlePic");
	  //e.style.display="";
	  new Effect.Scale(e, 940);	  
	}
  }
  return true;	
}



function showPopup(title,content,isURL,shadow,x,y,w,h,modal,aClass) { // isURL :  0>no, 1>yes, 2>yes and also append winid as parameter
  var win;
  var clsName="alphacube";
  if (typeof aClass == "undefined") { } else clsName=aClass;
  win = new Window({className:clsName, title:"", top:0, left:0, /*width:100, height:100,*/
                    resizable:false, draggable:true, wiredDrag:true, showEffect:Effect.BlindDown, hideEffect:Effect.SwitchOff, effectOptions:{duration:0.2}});
  win.setCloseCallback(onPopupClose);  
  if ((typeof x == "undefined") || (typeof y == "undefined")) {  
  
  }
  else
    win.setLocation(y,x);
  win.setSize(w,h);  
  win.setTitle(title);
  switch (isURL) {
    case 0 : win.getContent().innerHTML="<div style='padding:10px;margin-left:4px;margin-right:4px;width:"+(w-30)+"px;height:"+(h-26)+"px;background-color:#F4F4EE;border:1px solid #DDDDDD;white-space:nowrap;overflow:auto;'>"+content+"</div>";  
	         break;
    case 1 : win.setURL(content);    
	         break;
    case 2 : win.setURL(content+'?winid='+win);    
	         break;			 
  }

//if ((x<0)||(y<0)) win.showCenter(); else win.show();	  		  
  if ((typeof x == "undefined") || (typeof y == "undefined")) {
    if (typeof modal == "undefined") win.showCenter(false,y,x); else win.showCenter(modal,y,x);
  }
  else {
    if (typeof modal == "undefined") win.show(false); else win.show(modal); 
  } 

  w_LastPopup=win;
  if ((useShadows==true)&&(shadow==true)) {
    win.toFront();	  
    win.setZIndex(900);	  
    window.setTimeout('showPopup_2()',200);	 	    
  }
  return win;
}

function showPopup_2 () {
  var s=w_LastPopup.getId();
  Shadower.shadow(s+"_rows", {distance:14, angle:135, opacity:0.28, nestedShadows:14, color:'#6A3510'});			  
}



function showAboutUs() {
  xAboutUsRequest = false;	
  w_AboutUs=showPopup(':: '+cap_AboutUs, 'scripts/aboutus.'+xLang+'.php',1,true,77,150,460,320);	
}


function showInfoRequestForm() {  	
  xFormRequest = false;
  w_AboutUs=null;
  xAboutUsRequest=false;  
  var s='scripts/formmail/form1.'+xLang+'.php';	
  if (xTourID!='0') s=s+'?TO='+xTourID;
  w_InfoRequest=showPopup(':: '+cap_InfoRequest, s,1,true,77,150,500,375);	
}


function showTourInfo(e,slct) {
  var title="";	
  var content="";	  	
  var pos=findObjPos(e);		
  var x=pos[0];
  var y=pos[1];
  var w;
  var h;  
  switch (slct) {
    case 0 : 
      title="?";	  
	  content="";
      w=310;
      h=310;	
	  break;
    case 1 :
      title=":: "+cap_TourDates;	  
	  content=xTourDates;		
      w=310;
      h=310;		
	  break;
    case 2 :
      title=":: "+cap_TourPrices;	  
	  content=xTourPrices;		
	  w=500;
	  if (content.indexOf("<br>")>=0) h=140; else h=50;
	  break;
  }  
  x+=107;
  y-=(h+5);     
  showPopup(title,content,0,true,x,y,w,h);	
}


function showMap() {
  var content=xMapURL;	  
  var s;
  if (content!="") {
	s=content.substr(0,23);  
	if (s=="http://maps.google.com/") content=content.replace("&amp;hl=en&amp;","&amp;hl="+xLang+"&amp;");
    showPopup("",content, 1 ,true,undefined,undefined,550,550);
  }
}

var curr_tourFilter_catID = "0";
var curr_tourFilter_locID = "0";

function showTours_doFilter () {
  var e;
  var s;	
  var t=document.getElementById("t_showntours");	
  var rows = t.getElementsByTagName('tr');
  for (var i=0; i<rows.length; i++) {
    if (rows[i].id!="") {
      var img = rows[i].getElementsByTagName('img');		
	  s=img[0].id.split("-");
	  if ( 
		  ((curr_tourFilter_catID=="0")||(s[1]==curr_tourFilter_catID))
		    &&
		  (
		   (curr_tourFilter_locID=="0")
		   ||
		   ((curr_tourFilter_locID=="1")&&(parseInt(s[2])<10))
		   ||
		   ((curr_tourFilter_locID=="10")&&(parseInt(s[2])>=10))		   
		   ||
		   (s[2]==curr_tourFilter_locID)
		  )
		 )
	  {
		rows[i].style.display="block";
  	    e=rows[i].nextSibling;		
		if (e) e.style.display="block";			
	  }
	  else {
		rows[i].style.display="none";
  	    e=rows[i].nextSibling;		
		if (e) e.style.display="none";						
	  }
	}
  }
}

function showTours_filter_cat (o) {
  curr_tourFilter_catID=o.substr(5);	
  showTours_doFilter();
}

function showTours_filter_loc (o) {
  curr_tourFilter_locID=o.substr(5);	
  showTours_doFilter();
}

function showTours (aOfferID) {
  if ((aOfferID!="0")&&(intervalID_Offer!=0)) {window.clearTimeout(intervalID_Offer); intervalID_Offer=0;}
  var isAdmin = (userInfo=="")? "0": "1";  
  jsrsExecute("scripts/fx_ShowTours.php", showTours_cb, "do_showTours", Array(xTourID,aOfferID,xLang,isAdmin));    		
}


function showTours_cb (returnString) {
  var errchk = returnString.substr(0,9);
  if (errchk == "errPoint:") {
	alert(returnString); 
  }
  else if (returnString=="") {	
    if ((xTourID=="0")&&(interval_Offer>0)) intervalID_Offer=window.setTimeout('run_MainPage_cb_2()',interval_Offer);
  }
  else {
	var s="";  
    var e;
    var f;	
	var x;
	var i;
    var tour;
	var loc;
	var cat;
	var aBk;
    var secs = returnString.split("|%|");		
	if (secs.length>1) {
      var locs = secs[1].split("|~|");
      var cats = secs[2].split("|~|");	
	  s="<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"281\" style=\"margin-top:1px; table-layout:fixed;\">"+
	      "<col width=\"58\">"+
		  "<col width=\"225\">"+
		    "<tr>"+
			  "<td style=\"font-size:10px;background-color:#EEEEEE;border:1px solid #CCCCCC;border-right-width:0px;\">&nbsp;&nbsp;"+cap_Category.toLowerCase()+"</td>"+
			  "<td>"+
			    "<select id=\"tour_CatSel\" name=\"tourcatsel[]\" size=\"1\" style=\"width:218px;height:16px;font-size:10px;\" onchange=\"showTours_filter_cat(this.value);\" >"+
				  "<option id=\"o_cat0\" value=\"o_cat0\" selected=\"selected\">"+"..."+"</option>";
	  for (i=0; i<cats.length; i++) {
	    cat = cats[i].split("|:|");	
	    s +=        "<option id=\"o_cat"+cat[0]+"\" value=\"o_cat"+cat[0]+"\">"+cat[1]+"</option>";	
	  }
	  s +=      "</select>"+		  
			  "</td>"+			  
			"</tr>"+
			"<tr><td colspan=\"2\"><img src=\"images/trans.gif\" border=\"0\" height=\"3\" /></td></tr>"+
		    "<tr>"+
			  "<td style=\"font-size:10px;background-color:#EEEEEE;border:1px solid #CCCCCC;border-right-width:0px;\">&nbsp;&nbsp;"+cap_Region.toLowerCase()+"</td>"+
			  "<td>"+
			    "<select id=\"tour_LocSel\" name=\"tourlocsel[]\" size=\"1\" style=\"width:218px;height:16px;font-size:10px;\" onchange=\"showTours_filter_loc(this.value);\" >"+
				  "<option id=\"o_loc0\" value=\"o_loc0\" selected=\"selected\">"+"..."+"</option>";
	  for (i=0; i<locs.length; i++) {
	    loc = locs[i].split("|:|");	
	    s +=      "<option id=\"o_loc"+loc[0]+"\" value=\"o_loc"+loc[0]+"\">"+loc[2]+" - "+loc[1]+"</option>";	
	  }
	  s +=      "</select>"+		  
			  "</td>"+			  
			"</tr>"+			
			"<tr><td colspan=\"2\"><img src=\"images/trans.gif\" border=\"0\" height=\"10\" /></td></tr>"+			
		  "</table>"; 	
	}
    var vals = secs[0].split("|~|");		
	s +=  "<table id=\"t_showntours\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\" width=\"275\" style=\"margin-top:1px; table-layout:fixed;\">"+
	      "<col width=\"64\">"+
		  "<col width=\"191\">";
	for (i=0; i<vals.length; i++) {
      tour = vals[i].split("|:|");
      switch (tour[1]) {
		  case "OR": aBk="#FBD273"; 
					 break;
		  case "BR": aBk="#FFCE99"; 
					 break;					 
		  case "CR": aBk="#FFCE99"; 
					 break;	
		  case "RD": aBk="#FFBA93"; 
					 break;					 
		  case "PI": aBk="#F9D9D0"; 
					 break;					 
		  case "VI": aBk="#D5CEEB"; 
					 break;					 
		  case "BL": aBk="#CDDEFF"; 
					 break;				 
		  case "CY": aBk="#A1E8FF"; 
					 break;				 				 		 
		  case "TE": aBk="#99FFC6"; 
					 break;	  		 				 
		  case "GR": aBk="#B8E2A6"; 
					 break;	  		 				 					 
		  case "KO": aBk="#BAD8B0";
					 break;	  		 				 										 
		  case "PA": aBk="#D8E591"; 
					 break;	  		 
		  case "OL": aBk="#E1DB7D"; 
					 break;	  		 				 
		  case "YE": aBk="#FADF66"; 
					 break;							 				 	  
		  default  : aBk="#EAE0C3";			 
	  }
	  if (tour[4]=="1") x=tour[0]; else x="0";
      s+="<tr id=\"tour-"+tour[0]+"\" style=\"background-color:"+aBk+";display:block;width:255px;\" onmouseover=\"this.style.cursor='pointer'; this.style.backgroundColor='#FFFFFF';\" onmouseout=\"this.style.backgroundColor='"+aBk+"';\" onclick=\"this.className='SelectedTourRow'; Windows.closeAll();\">"+
		   "<td width=\"64\" style=\"padding:5px;\"><img id=\"img"+i+"-"+tour[3]+"\" src=\"pics/"+x+"/caption.jpg\" border=\"0\" width=\"54\" height=\"40\"/></td>"+
		   "<td width=\"191\" ><strong>"+tour[2]+"</strong></td>"+
		 "</tr>";
	  if (i<vals.length-1) s+="<tr style=\"display:block;\"><td colspan=\"2\" style=\"padding:0px;\"><img src=\"images/trans.gif\" border=\"0\" height=\"5\" /></td></tr>";
	}
    s+="</table>";		
    var t="";
	if (secs.length>1) {
	  t=cap_ShowAllTours;		
      e=document.getElementById("bt_ShowAllTours");
	}
	else {
	  t=cap_ShowSimilarTours;	  		
      e=document.getElementById("bt_ShowSimilarTours");
	}
    x=findObjPos(e);				
	if (secs.length>1) 
	  w_ShowAllTours=showPopup(t,s, 0 ,true, x[0]-(320-e.clientWidth+13),x[1],320,420);		
	else 
	  w_ShowSimilarTours=showPopup(t,s, 0 ,true, x[0]-(320-e.clientWidth+13),x[1],320,200);		
  }
}




// ------------------------------------------------------

window.onload = function() {
  var e;	
  e=document.getElementById('ArticlePic');
  saveArticlePicBorderColor=e.style.borderColor;  
  e=document.getElementById("div_Logo");
  curvyCorners(cs_large, e);
  curvyCorners(cs_tiny, '.TopButtons');       
  if (useShadows==true) Shadower.shadowWithClass('TopButtons', {distance:2, angle:135, opacity:0.2, nestedShadows:2, color:'#6A3510'});			      
  curvyCorners(cs_tiny, '.TopButtons2');     
  if (xTourID!="0") {
    e=document.getElementById("div_OfferPic");	
	save_OfferPic=e.style.backgroundImage;
	curvyCorners(cs_offerpic, e);   				  
    e=document.getElementById("OfferCaption");
	save_OfferCaption=e.innerHTML; 
	e=document.getElementById("OfferName");
	save_OfferName=e.innerHTML;	
	e=document.getElementById("OfferNotice");
	save_OfferNotice=e.src;
    curvyCorners(cs_small, '.BotButtons');     	  	
    if (useShadows==true) Shadower.shadowWithClass('BotButtons', {distance:2, angle:135, opacity:0.2, nestedShadows:2, color:'#6A3510'});			        	
	e=document.getElementById("div_MapPic");
    curvyCorners(cs_small, e);   			  	
    if (useShadows==true) Shadower.shadow(e.id, {distance:2, angle:135, opacity:0.2, nestedShadows:2, color:'#6A3510'});			        		
    e=document.getElementById("div_Gallery");
    curvyCorners(cs_small, e);   
    if (useShadows==true) Shadower.shadow(e.id, {distance:2, angle:135, opacity:0.2, nestedShadows:2, color:'#6A3510'});			        	
  }
  e=document.getElementById("div_Offer");
  save_div_Offer_innerHTML = e.innerHTML;    
  curvyCorners(cs_large2, e);   
  run_Page();    
}

