// JavaScript Document for pulling the customer data

var xmlHttp
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 openPortItem(theImage)
{
	var divx = document.getElementById("HoverMenuHolder2");
	
	var jl = window.pageXOffset ||
          document.body.scrollLeft ||
         document.documentElement.scrollLeft;
	var jt = window.pageYOffset ||
           document.body.scrollTop ||
           document.documentElement.scrollTop;

	  var myWidth = 0, myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	  }
	 
	 var adjHeight = myHeight/4;
	 adjHeight = adjHeight/2;
	 // window.alert( 'Width = ' + myWidth );
	 // window.alert( 'Height = ' + myHeight );
	var TheTop = 20;	//adjHeight + jt;
	// --- Override
	document.getElementById("HoverMenuHolder2").style.top = TheTop + 'px';

	var TheLeft = myWidth/2;
	TheLeft = TheLeft/2;
	TheLeft = 0;
	document.getElementById("HoverMenuHolder2").style.top = TheTop + 'px';
	document.getElementById("HoverMenuHolder2").style.left = TheLeft + 'px';	

	document.getElementById("HoverShadow2").style.display = "inline";
	document.getElementById("HoverMenuHolder2").style.display = "block";
	document.getElementById("HoverMenu2").innerHTML = "<img src='../images/casestudies/" + theImage + "'>";
}

window.onscroll = function() {
	var div = document.getElementById("HoverMenuHolder2");
	if(div.style.display == "block") {
		var jt = window.pageYOffset ||
			   document.body.scrollTop ||
			   document.documentElement.scrollTop;
		document.getElementById("HoverShadow2").style.bottom = 0 - jt + 'px';
	}
}
//}
function closeThis(Element) {
	var workElement = Element;
	document.getElementById(workElement).style.display = "none";
	document.getElementById("HoverShadow2").style.display = "none";
	document.getElementById("HoverMenuHolder2").style.display = "none";
}

function popMenuBox(obj,Element) { 
var DashMatrix = document.TheForm.Dasher.value;
var x = 0;
var y = 0;
var workElement;
while (obj) {
		x += obj.offsetLeft 
		y += obj.offsetTop
		obj = obj.offsetParent; 
		//y = y - 10;
		//x = x - 20;
	} 
	workElement = Element;
	document.getElementById(workElement).style.display = 'inline';
	document.getElementById(workElement).style.left = x+"px";
	document.getElementById(workElement).style.top = y+"px";
}



function launchVideo2(theVideo, theTitle) {

	document.getElementById("HoverShadow").style.display = "block";
	document.getElementById("HoverMenuHolder").style.display = "block";
	document.getElementById("TheTitle").innerHTML = theTitle;

	var DashMatrix = "../";
	workElement = "TheVideo";
	
	var url = DashMatrix + "includes/functions/viewTrailer2.asp?TPath=" + theVideo + "&sid=" + Math.random() + "&DashMatrix=" + DashMatrix;
	strDashMatrix = DashMatrix;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}
function launchVideo(theVideo, theTitle) {

//	var divx = document.getElementById('HoverMenuHolder');
	//document.getElementById("HoverShadow").style.bottom = 0 - document.documentElement.scrollTop + 'px';
	//alert(document.documentElement.scrollTop);
//	divx.style.top = 50 + document.documentElement.scrollTop + 'px';

	document.getElementById("HoverShadow").style.display = "block";
	document.getElementById("HoverMenuHolder").style.display = "block";
	document.getElementById("TheTitle").innerHTML = theTitle;

//	document.getElementById("ShareForm").innerHTML=xmlHttp.responseText 
	
	var DashMatrix = "../";
	workElement = "TheVideo";
	
	var url = DashMatrix + "includes/functions/viewTrailer.asp?TPath=" + theVideo + "&sid=" + Math.random() + "&DashMatrix=" + DashMatrix;
	strDashMatrix = DashMatrix;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}
function closeHoverForm() {
	document.getElementById("HoverShadow").style.display = "none";
	document.getElementById("HoverMenuHolder").style.display = "none";	
	var DashMatrix = "../";
	workElement = "TheVideo";
	
	var url = DashMatrix + "includes/functions/viewTrailer.asp?TPath=&sid=" + Math.random() + "&DashMatrix=" + DashMatrix;
	strDashMatrix = DashMatrix;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	
}

function addMoreContacts(DashMatrix, TheNumber, postback)
{
	var url= DashMatrix + "includes/ajax/addMoreContacts.asp?sid=" + Math.random() + "&DashMatrix=" + DashMatrix + "&ContactNum=" + TheNumber;
	strDashMatrix = DashMatrix;
	workElement = postback;
	xmlHttp=GetXmlHttpObject(postbackDisplay)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function postbackDisplay() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		document.getElementById(workElement).innerHTML=xmlHttp.responseText; 
	}
}



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
	}
} 
