// JavaScript Document
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//break out of frames
if (self != top) { top.location.href = self.location.href }

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function PopupMsg(msg) { //v1.0
  document.MM_returnValue = confirm(msg);
}

function showPic (whichpic, strImageID) {
	if (document.getElementById) {
		var strThumb, strLarge;
		strThumb= document.getElementById(strImageID).src;
		strLarge = document.getElementById('ImagePlaceholder').src;
		document.getElementById(strImageID).src = strLarge;
		document.getElementById('ImagePlaceholder').src = strThumb;
		//document.getElementById('ImageLarge').href = "javascript:PopupPic('" + whichpic.name + "')";
		return false;
	} else {
		return true;
	}
}

function PopupPic(sPicURL) { 
	window.open("img/popup.htm?"+sPicURL, "", "resizable=1,height=200,width=200");
}
function showTab(tab,tabclick){
	// just list the tab content divs here
	tabs = ["tab1","tab2"];
	tabclicks = ["tabclick1","tabclick2"];
	// first make sure all the tabs are hidden
	for(i=0;i<tabs.length;i++){
		document.getElementById(tabs[i]).style.zIndex="-100";
	}
	for(i=0;i<tabclicks.length;i++){
		document.getElementById(tabclicks[i]).style.color="#999";
		document.getElementById(tabclicks[i]).style.backgroundColor="#FFF";
	}
	// show the tab we're interested in
	document.getElementById(tab).style.zIndex="100";
	document.getElementById(tabclick).style.color="#FFF";
	document.getElementById(tabclick).style.backgroundColor='#2BBB76';
	
	
	return false;
}
function searchTabs(stab){
	// stab is a number
	if(stab == 1){othertab=2;}else{othertab=1;}
	stab_bg = document.getElementById('tabmenu'+stab).style.backgroundColor;
	otab_bg = document.getElementById('tabmenu'+othertab).style.backgroundColor;
	stab_colour = document.getElementById('tabmenu'+stab).style.color;
	otab_colour = document.getElementById('tabmenu'+othertab).style.color;

	document.getElementById('tabmenu'+othertab).style.backgroundColor = stab_bg;
	document.getElementById('tabmenu'+stab).style.backgroundColor = otab_bg;
	document.getElementById('tabmenu'+othertab).style.color = stab_colour;
	document.getElementById('tabmenu'+stab).style.color = otab_colour;
	document.getElementById('searchtab'+othertab).style.display='none';
	document.getElementById('tabmenu'+othertab).style.height='15px';
	document.getElementById('tabmenu'+othertab).style.fontWeight='normal';	
	document.getElementById('searchtab'+stab).style.display='block';
	document.getElementById('tabmenu'+stab).style.height='16px';
	document.getElementById('tabmenu'+stab).style.fontWeight='bold';
	return false;
}

function searchTabs2(stab){
	// stab is a number
	if(stab == 3){othertab=4;}else{othertab=3;}
	stab_bg = document.getElementById('tabmenu'+stab).style.backgroundColor;
	otab_bg = document.getElementById('tabmenu'+othertab).style.backgroundColor;
	stab_colour = document.getElementById('tabmenu'+stab).style.color;
	otab_colour = document.getElementById('tabmenu'+othertab).style.color;

	document.getElementById('searchtab'+othertab).style.display='none';
	document.getElementById('tabmenu'+othertab).style.height='15px';
	document.getElementById('tabmenu'+othertab).style.color='#666';
	document.getElementById('tabmenu'+othertab).style.backgroundColor='#FFFFFF';
	document.getElementById('tabmenu'+othertab).style.fontWeight='normal';	
	document.getElementById('searchtab'+stab).style.display='block';
	document.getElementById('tabmenu'+stab).style.backgroundColor=document.getElementById('search').style.backgroundColor;
	document.getElementById('tabmenu'+stab).style.height='16px';
	document.getElementById('tabmenu'+stab).style.fontWeight='bold';
	document.getElementById('tabmenu'+stab).style.color=document.getElementById('tabmenu'+stab).style.backgroundColor;
	
	return false;
}

function fnToggleVisibility(targetId, BusID){
	if (document.getElementById){
		document.getElementById(targetId).style.display = "block";
	}
	if(targetId == 'contactinfo'){
		var xmlHttp;
		  try
			{
			// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
			}
		  catch (e)
			{
			//IE
			try
			  {xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
			catch (e)
			  {
			  try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
			  catch (e){return false;}
			  }
			}
			url = "http://www.stayatlochlomond.com/includes/tracker.php?track=details&BusID="+BusID;
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null);		
	}
}

// Toggle Visibility for Advanced Options
function fnToggleDisplay( showid, hideid ){
  if (document.getElementById){
        show = document.getElementById( showid );
        hide = document.getElementById( hideid );
           if (hide.style.display == "block"){
              show.style.display = "block";
              hide.style.display = "none";
           } else {
              show.style.display = "none";
              hide.style.display = "block";
           }
     }
}

// Toggle Visibility for Advanced Options
function fnToggleVisibility2( targetId ){
  if (document.getElementById){
        target = document.getElementById( targetId );
           if (target.style.display == "none"){
              target.style.display = "block";
           } else {
              target.style.display = "none";
           }
     }
}

function tracker(BusID)
  {
  var xmlHttp;
  try
    {
	// Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();}
  catch (e)
    {
	// IE
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
      catch (e)
        {return false;}
      }
    }
	url = "http://www.stayatlochlomond.com/includes/tracker.php?track=url&BusID="+BusID;
	xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }
  
function emailtracker(BusID)
  {
  var xmlHttp;
  try
    {
	// Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();}
  catch (e)
    {
	// IE
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
      catch (e)
        {return false;}
      }
    }
	url = "http://www.stayatlochlomond.com/includes/tracker.php?track=details&BusID="+BusID;
	xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }
  
function updatedeparture()
{var arrival = document.getElementById('cal_arr').value;
alert(arrival);
document.getElementById('cal_dep').value = '';}

function spanish()
{window.location="http://translate.google.com/translate?u=http%3A%2F%2Fwww.stayatlochlomond.com%2F&langpair=en%7Ces&hl=en&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools"
return false;}

function german()
{window.location="http://translate.google.com/translate?u=http%3A%2F%2Fwww.stayatlochlomond.com%2F&langpair=en%7Cde&hl=en&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools"
return false;}

function french()
{window.location="http://translate.google.com/translate?u=http%3A%2F%2Fwww.stayatlochlomond.com%2F&langpair=en%7Cfr&hl=en&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools"
return false;}

function italian()
{window.location="http://translate.google.com/translate?u=http%3A%2F%2Fwww.stayatlochlomond.com%2F&langpair=en%7Cit&hl=en&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools"
return false;}
