// JavaScript Document for pulling the customer data
// show the services

var workElement
var strDashMatrix
var xmlHttp
var checkflagdate = "false";
var checkflagriver = "false";
var checkflagloc = "false";
var checkflaglevel = "false";
var newX
var newY



function changeFlashMenu() {
	var url="includes/ChangeFlash.php?sid=" + Math.random();
	xmlHttp=GetXmlHttpObject(changeFlash)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function changeFlash() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		document.getElementById("flashdiv").innerHTML=xmlHttp.responseText 
	}
}

function showhideTree() {
	newX = document.getElementById("rightsider").offsetLeft;
	newY = document.getElementById("rightsider").offsetTop;
	newX = newX + 325;
	newY = newY + 80;
	document.getElementById("treeHover").style.left = newX+"px"; 
	document.getElementById("treeHover").style.top = newY+"px";
	document.getElementById("treeHover").style.display = "block";
}

function hideTree() {
	document.getElementById("treeHover").style.display = "none";
}


function popPhoto(DashMatrix, theURL) { //v2.0
  window.open(DashMatrix + 'photos/photo_holder.asp?photoURL=' + theURL,'Photos','width=800,height=600');
}
function popVideo() { //v2.0
  window.open('main_video.asp','Videos','width=364,height=340');
}

function doWindow(theNewItem, thisItemPath) {
	if (theNewItem == "photoScroll")
		{
			var url="/includes/photoScroll.php?thisFilePath=" + thisItemPath;
			xmlHttp=GetXmlHttpObject(updatePhotoBox)
			xmlHttp.open("GET", url , true)
			xmlHttp.send(null)
		}
	else if (theNewItem == "photoStill")
		{ 
			var url="/includes/photoStill.php?thisFilePath=" + thisItemPath;
			xmlHttp=GetXmlHttpObject(updatePhotoBox)
			xmlHttp.open("GET", url , true)
			xmlHttp.send(null)
		}
}
		
function updatePhotoBox() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("topImageContent").innerHTML=xmlHttp.responseText 
	}
}



function openTripBar(field) {
	workElement = field
	if (field == "date") {
	  if (checkflagdate == "false") {
		  	document.getElementById(workElement).style.display = "block";
			checkflagdate = "true";
	  } else {
	  	document.getElementById(workElement).style.display = "none";
		checkflagdate = "false";
	  }
	} else if (field == "river") {
	  if (checkflagriver == "false") {
		  	document.getElementById(workElement).style.display = "block";
			checkflagriver = "true";
	  } else {
	  	document.getElementById(workElement).style.display = "none";
		checkflagriver = "false";
	  }
 	} else if (field == "location") {
	  if (checkflagloc == "false") {
		  	document.getElementById(workElement).style.display = "block";
			checkflagloc = "true";
	  } else {
	  	document.getElementById(workElement).style.display = "none";
		checkflagloc = "false";
	  }
	} else if (field == "level") {
	  if (checkflaglevel == "false") {
		  	document.getElementById(workElement).style.display = "block";
			checkflaglevel = "true";
	  } else {
	  	document.getElementById(workElement).style.display = "none";
		checkflaglevel = "false";
	  }
	}
}
function transferBilling()
{
	document.getElementById("ShipToFName").value = document.getElementById("BillToFName").value;
	document.getElementById("ShipToLName").value = document.getElementById("BillToLName").value;
	document.getElementById("ShipToAddress").value = document.getElementById("BillToAddress").value;
	document.getElementById("ShipToCity").value = document.getElementById("BillToCity").value;
	document.getElementById("ShipToState").value = document.getElementById("BillToState").value;
	document.getElementById("ShipToZip").value = document.getElementById("BillToZip").value;
	document.getElementById("ShipToCountry").value = document.getElementById("BillToCountry").value;
}
function handleBilling() 
{
	if (TheForm.BillToName.value == "") {
		alert("You must enter a billing name.");
		return false;
	}
	else if(TheForm.BillToAddress.value == "") {
		alert("You must enter a billing address.");
		return false;
	}
	else {
		return true;
	}
}

function AJAX_Example(add1,add2)
{ 
var url="../includes/ajax/AJAX_Add_Function.asp?sid=" + Math.random() + "&add1=" + add1 + "&add2=" + add2;
xmlHttp=GetXmlHttpObject(addNums)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function addNums() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("thesum").innerHTML=xmlHttp.responseText 
	}
}

var xmlHttp
function getEmailPage(pageid)
{ 
var url="../includes/ajax/AJAX_EmailPage.asp?sid=" + Math.random() + "&pageid=" + pageid;
xmlHttp=GetXmlHttpObject(formemail)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function formemail() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("pullcontent").innerHTML=xmlHttp.responseText ;
		document.getElementById("pullcontent").style.display='block';
	}
}


function getReqInfo(ModuleID)
{ 
var url="../includes/ajax/AJAX_AddToReqInfo.asp?sid=" + Math.random() + "&moduleid=" + ModuleID;
xmlHttp=GetXmlHttpObject(AddModule)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function AddModule() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("pullcontent").innerHTML=xmlHttp.responseText ;
		document.getElementById("pullcontent").style.display='block';
	}
}


function getExplanation(ABC)
{ 
var url="../includes/ajax/AJAX_DisplayInformation.asp?sid=" + Math.random() + "&infoString=" + ABC;
xmlHttp=GetXmlHttpObject(xrsInfo)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function xrsInfo() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("pullcontent").innerHTML=xmlHttp.responseText ;
		document.getElementById("pullcontent").style.display='block';
	}
}

function MSAJAX_newobject(pageref,strVar,strValue)
{ 
var url=pageref + "?sid=" + Math.random() + "&" + strVar + "=" + strValue;
xmlHttp=GetXmlHttpObject(newobj_stateChanged)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function newobj_stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("newobject").innerHTML=xmlHttp.responseText 
	}
} 

function MSAJAX_saveinfo(pageref,strDatabase,strVars,strValues)
{ 
var url=pageref + "?sid=" + Math.random() + "&db=" + strDatabase + "&Vars=" + strVars + "&Values=" + strValues;
xmlHttp=GetXmlHttpObject(saveinfo_submit)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function saveinfo_submit() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("saveinfo").innerHTML=xmlHttp.responseText 
	}
} 

function GetXmlHttpObject(handler)
{ 
var objXmlHttp=null
if (navigator.userAgent.indexOf("Opera")>=0)
{	alert("This example doesn't work in Opera") 
return 
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{ 	var strName="Msxml2.XMLHTTP"
	if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
		{
		strName="Microsoft.XMLHTTP"
		} 
	try
{ 
objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler 
return objXmlHttp
} 
catch(e)
{ 
alert("Error. Scripting for ActiveX might be disabled") 
return 
} 
} 
if (navigator.userAgent.indexOf("Mozilla")>=0)
	{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler 
		return objXmlHttp
	}
} 
