// place Functions here 

// Generic PopUp Function
function popUp(wname,url,width,height,statusbar,scrollbars,resizable,toolbar){

	//define height and width if they are not passed
	//as arguments
	if(!height)
		height=300;
	if(!width)			
		width=500;
	if(!scrollbars)			
		scrollbars="yes";
	if(!resizable)			
		resizable="no";
	if(!toolbar)			
		toolbar="no";
	if(!statusbar)			
		toolbar="no";

	var theWidth = width;
	var theHeight = height;

		
	x = (640 - theWidth)/2, y = (480 - theHeight)/2;

  	if (screen) {
      		y = (screen.availHeight - theHeight)/2;
      		x = (screen.availWidth - theWidth)/2;
  		}
	if (screen.availWidth > 1800) { 
		x = ((screen.availWidth/2) - theWidth)/2; 
  		} 

		
	var settings = "status=" + statusbar + "toolbar=" + toolbar + ",resizable=" + resizable + ",height=" + height + ",width=" + width + ",scrollbars=" + scrollbars + ',width='+theWidth+',height='+theHeight+',screenX='+x+', screenY='+y+', top='+y+',left='+x;
	PopWin = window.open(url,wname,settings);
	PopWin.focus();
}
						
//Pulling Data from Other Web pages with XMLHTTP 
function RemoteScriptXMLHTTPGetPage(ExternalPageURL){
	var xmlhttp = null;
		
	try {xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {
	try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");} catch (E) {
	xmlhttp = false; }
	 }
	if (xmlhttp) {
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	xmlhttp.open("get", ExternalPageURL,true);
	xmlhttp.onreadystatechange= function() {
	if (xmlhttp.readyState==4) { document.write(xmlhttp.responseText) ; } 
	} 
	xmlhttp.send(null) 
	}
}

 function feedflareon(objpar) {
  	 for (i=0; i<objpar.childNodes.length; i++){
    	 if (objpar.childNodes[i].tagName=="DIV") {
			    obj = objpar.childNodes[i];
			    for (a=0; a<obj.childNodes.length; a++){
						 if (obj.childNodes[a].className=="feedflare") {	
						   	obj.childNodes[a].style.display="block";
								obj.childNodes[a].style.visibility="visible";
						}
					}
    	 }
     }
 }
 function feedflareoff(objpar) {
  	 for (i=0; i<objpar.childNodes.length; i++){
    	 if (objpar.childNodes[i].tagName=="DIV") {
			    obj = objpar.childNodes[i];
	  	    for (a=0; a<obj.childNodes.length; a++){
						 if (obj.childNodes[a].className=="feedflare") {	
						   	obj.childNodes[a].style.display="none";
								obj.childNodes[a].style.visibility="hidden";
						}
					}
    	 }
     }
 }

function openStdDemo()
{
url = "ctdata/clicktracks_overview.html" ;
popup = window.open( url, 'demowindow', 'toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no, resizable=no,width=1010,height=696,left=2,top=10' );
popup.focus();
}

function openGetCTSerial()
{
url = "ctdata/WordVerification_Check.asp" ;
						var x = 0;
						var y = 0;
          	var theWidth = 400;
          	var theHeight = 300;
           if (screen) {
             		y = (screen.availHeight - theHeight)/2;
             		x = (screen.availWidth - theWidth)/2;
            }
            if (screen.availWidth > 1800) { 
          	    x = ((screen.availWidth/2) - theWidth)/2; 
            } 	
popup = window.open( url, 'serialwindow', 'toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no, resizable=no,width='+theWidth+',height='+theHeight+',screenX='+x+', screenY='+y+', top='+y+',left='+x);
popup.focus();
}

function openSmallDemo( name , width, height )
{
	popup = window.open( "http://www.clicktracks.com/demos_small/" + name + '.php', 'clicktracks', 'toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no,resizable=no,width=' + width + ',height=' + height + ',left=2,top=10' );
	popup.focus();
}


function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function pte(theImage,doResize) {
   if (theImage.src !== '/images/spacer.gif') {	 
	 		theImage.src = '/images/spacer.gif';
	 }
   if (doResize==1) {
	 		theImage.width=1;
	 		theImage.height=1;
   }
}


		function getWindowHeight() {
			var windowHeight = 0;
			if (typeof(window.innerHeight) == 'number') {
				windowHeight = window.innerHeight;
			}
			else {
				if (document.documentElement && document.documentElement.clientHeight) {
					windowHeight = document.documentElement.clientHeight;
				}
				else {
					if (document.body && document.body.clientHeight) {
						windowHeight = document.body.clientHeight;
					}
				}
			}
			return windowHeight;
		}
		function setFooter(contentHeight,AdjContainer) {

			if (document.getElementById) {
				var windowHeight = getWindowHeight();
				if (windowHeight > 0) {


						 if (contentHeight > 0) {

							   if (document.getElementById(AdjContainer+'right')) {
					         var footerElement = document.getElementById(AdjContainer+'right');
							     footerElement.style.height = (contentHeight)  + 'px';
                 }
							   if (document.getElementById(AdjContainer+'left')) {
					          var footerElement2 = document.getElementById(AdjContainer+'left');
							     footerElement2.style.height = (contentHeight)  + 'px';
                 }
							   if (document.getElementById('nav'+AdjContainer+'right')) {
					          var footerElement3 = document.getElementById('nav'+AdjContainer+'right');
							     footerElement3.style.height = (contentHeight)  + 'px';
                 }
							   if (document.getElementById('nav'+AdjContainer+'left')) {
					          var footerElement4 = document.getElementById('nav'+AdjContainer+'left');
							     footerElement4.style.height = (contentHeight)  + 'px';
						     }

							   if (document.getElementById('mid'+AdjContainer+'right')) {
					          var footerElement6 = document.getElementById('mid'+AdjContainer+'right');
							     footerElement6.style.height = (contentHeight)  + 'px';
                 }
							   if (document.getElementById('mid'+AdjContainer+'left')) {
					          var footerElement5 = document.getElementById('mid'+AdjContainer+'left');
							     footerElement5.style.height = (contentHeight)  + 'px';
						     } 



						 }

					
				}
			}
		}






	function setFooterHomepage(contentHeight,AdjContainer) {

			if (document.getElementById) {
				var windowHeight = getWindowHeight();
				if (windowHeight > 0) {


						 if (contentHeight > 0) {

							   if (document.getElementById("floaterrighthome")) {
					         var footerElementA = document.getElementById("floaterrighthome");
							     footerElementA.style.height = (contentHeight)  + 'px';
                 }
							   if (document.getElementById("floaterlefthome")) {
					          var footerElementB = document.getElementById("floaterlefthome");
							     footerElementB.style.height = (contentHeight)  + 'px';
                 }
		
							   if (document.getElementById("midfloaterrighthome")) {
					          var footerElementC = document.getElementById("midfloaterrighthome");
							     footerElementC.style.height = (contentHeight)  + 'px';
                 }
							   if (document.getElementById("midfloaterlefthome")) {
					          var footerElementD = document.getElementById("midfloaterlefthome");
							     footerElementD.style.height = (contentHeight)  + 'px';
								}
						 }

					
				}
			}
		}
