
	var bolPrint  = false;
	var print = window.location.search.indexOf("Print=true");
	if(print != -1){
		bolPrint =true;
	}else{
		bolPrint =false;
	}


var isLoaded = false;

var date = new Date();
date.setTime(date.getTime()+(3652*24*60*60*1000));
var expires = date;
var xmlCookieValue = "";
var xmlHttpDateModified  = null;
var bReloadXml = false;
var sCurrentUrl = "";
var sXMLHeaderDate  = "";
var sXmlDateModified ="";
var cookieEnabled=(navigator.cookieEnabled)? true : false

//if not IE4+ nor NS6+
if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled){ 
document.cookie="testcookie"
cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)? true : false
}

//if (cookieEnabled) //if cookies are enabled on client's browser
//do whatever

/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, expires, path, domain, secure)
{
	
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
function deleteCookie(name, path, domain)
{
    if (getCookie(name))
    {
        document.cookie = name + "=" + 
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}



	

//Code for html reloads
if(getCookie("lastModified") != null){
	if(trimAll(document.lastModified.toString()) != trimAll(getCookie("lastModified").toString())){
		setCookie("lastModified",document.lastModified,expires );
		if(getCookie("lastModified") == document.lastModified){
			document.location.reload(true);
		}
	}
	setCookie("lastModified",document.lastModified,expires );
}else{
	setCookie("lastModified",document.lastModified,expires );
}
//End Code for html reloads



function AlterHashChild(str){
	//alert(str);
	if(str != ""){ 
	
		if(window.location.hash != "" ){
			iIndexHash =window.location.hash.indexOf("xml");
			iIndexSemiColon= window.location.hash.indexOf(";");
			sXml =window.location.hash.substring(iIndexSemiColon+1,iIndexHash +3);
			
		}
		//alert(window.location.hash.replace(";" + sXml ,"") + ";" + str);
		window.location.hash =window.location.hash.replace(";" + sXml ,"") + ";" + str ;
	}else{
		window.location.hash = window.location.hash.substring(1,iIndexSemiColon) + ";" + sXml ;
	}

}


function AlterHash(str,iDelay){
	setTimeout("AlterHashChild('" +  str + "')",iDelay);
}


function trimAll(sString) {
	while (sString.substring(0,1) == ' '){
	sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' '){
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}







function populateLeftMenu(iIndex){

	var sInnerHtml = ""
	sInnerHtml = sInnerHtml  + "<center><table bgColor=#3399FF width='100%' id='MenuLeftTable'>";
	var iTimer = 50; 
	
	for(var i=0;i<MenuItemsArray[iIndex].length;i++){
	//alert( MenuItemsArray[iIndex][i].url);
		if(MenuItemsArray[iIndex][i].url.indexOf("pressreleases.html") !=-1){
			if(MenuItemsArray[iIndex][i].toolTip !=""){
				sInnerHtml = sInnerHtml  + "<tr><td align=left  class=WhiteNoUnderlineDarkBlue onmouseover=\"this.className='WhiteNoUnderlineLightBlue';ddrivetip('" + MenuItemsArray[iIndex][i].toolTip + "')\"  onmouseout=\"this.className='WhiteNoUnderlineDarkBlue';hideddrivetip()\" onClick=\"setCookie('Index','" + iIndex + "');setCookie('Override','true');makeRequestHead('" + MenuItemsArray[iIndex][i].url + "');AlterHash('" + MenuItemsArray[iIndex][i].filename + "'," + iTimer  + ");\" >" + MenuItemsArray[iIndex][i].name + "</font></td></tr>";
			}else{
				sInnerHtml = sInnerHtml  + "<tr><td align=left  class=WhiteNoUnderlineDarkBlue onmouseover=\"this.className='WhiteNoUnderlineLightBlue';\"  onmouseout=\"this.className='WhiteNoUnderlineDarkBlue';\" onClick=\"setCookie('Index','" + iIndex + "');setCookie('Override','true');makeRequestHead('" + MenuItemsArray[iIndex][i].url + "');AlterHash('" + MenuItemsArray[iIndex][i].filename + "'," + iTimer  + ");\" >" + MenuItemsArray[iIndex][i].name + "</font></td></tr>";
			}
		}else if(MenuItemsArray[iIndex][i].url.indexOf("Print=true") !=-1){
			sInnerHtml = sInnerHtml  + "<tr><td align=left  class=WhiteNoUnderlineDarkBlue onmouseover=\"this.className='WhiteNoUnderlineLightBlue';\"  onmouseout=\"this.className='WhiteNoUnderlineDarkBlue';\" onClick=\"setCookie('Index','" + iIndex + "');setCookie('Override','true');window.open('" +  MenuItemsArray[iIndex][i].url + "','','" + sOptions + "')\" >" + MenuItemsArray[iIndex][i].name + "</font></td></tr>";
		}else{
			var hashIndex = 0;
			var strHash = "";
			hashIndex  = MenuItemsArray[iIndex][i].url.indexOf("#");
			strHash =  MenuItemsArray[iIndex][i].url.substring(hashIndex  ,MenuItemsArray[iIndex][i].url.length);
			if(MenuItemsArray[iIndex][i].toolTip !=""){
				sInnerHtml = sInnerHtml  + "<tr><td align=left  class='WhiteNoUnderlineDarkBlue' onmouseover=\"this.className='WhiteNoUnderlineLightBlue';ddrivetip('" + MenuItemsArray[iIndex][i].toolTip + "')\"  onClick=\"setCookie('Override','false');setCookie('Hash','" + strHash + "'); makeRequestHead('" + MenuItemsArray[iIndex][i].url + "');AlterHash('" + MenuItemsArray[iIndex][i].filename + "'," + iTimer  + ");\" onmouseout=\"this.className='WhiteNoUnderlineDarkBlue';hideddrivetip()\">" + MenuItemsArray[iIndex][i].name + "</td></tr>";
			}else{
				sInnerHtml = sInnerHtml  + "<tr><td align=left  class='WhiteNoUnderlineDarkBlue' onmouseover=\"this.className='WhiteNoUnderlineLightBlue';\"  onClick=\"setCookie('Override','false');setCookie('Hash','" + strHash + "'); makeRequestHead('" + MenuItemsArray[iIndex][i].url + "');AlterHash('" + MenuItemsArray[iIndex][i].filename + "'," + iTimer  + ");\" onmouseout=\"this.className='WhiteNoUnderlineDarkBlue';\">" + MenuItemsArray[iIndex][i].name + "</td></tr>";
			}
		}
	}
	
	
	dsInnerHtml = sInnerHtml  + "</table></center>"
	return  sInnerHtml ;
	
}


function GetXmlHttpObject(){ 
	
	var onIE = window.ActiveXObject;
	if(onIE){
	 	var activeXObjects = ['Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0','Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP'];
		for(var i=0; i<activeXObjects.length; i++){
			try{
				return new ActiveXObject(activeXObjects[i]);
			}catch(err){}
		}
	}else{
		if (window.XMLHttpRequest) { // Mozilla, Safari,...
        	var http_request = new XMLHttpRequest();
         	if (http_request.overrideMimeType) {
            	http_request.overrideMimeType('text/xml');
         	}
			return http_request;	
		}
	}
} 
var bXMLDownloadedComplete = false; 

	function stateChanged() 
{ 

	// only if req shows "complete"
    if (xmlHttp.readyState == 4) {
        // only if "OK"
        if (xmlHttp.status == 200) {
        	
        	
        	
        	var sFooter = "";
			sFooter  = sFooter  + "<br><div align=center><FONT class='TinyText'>";
			sFooter  = sFooter  + "Last revised " + xmlHttp.getResponseHeader("Last-Modified") + "<br>";

			if(bolPrint ==false){
				//document.write("<br>Please ensure the <b><font class=RedTextSmall>latest</font></b> version of this page is being viewed - press <b><font class=RedTextSmall>&quot;Ctrl+F5&quot;</font></b><br>");
				var percentWidthDifference = ((clientWidthWindow * 100)/screen.width );
				if (percentWidthDifference< 95){ 
					sFooter  = sFooter  +"<font class=RedTextSmall>This window is </font><a href='screen.html' style='text-decoration: none;'  ><font class=RedTextUnderlineSmall>best displayed</font></a><a href='#' onClick='Maximize()' style='text-decoration: none;' > <font class=RedTextUnderlineSmall>maximized.</font></a><br>";
				}
				sFooter  = sFooter  +"<tr><td align=center><a href='screen.html' class='OuterMenu'>Screen</a>:<font class='TinyText' > " + screen.width + " x " + screen.height + "&nbsp;&nbsp;&nbsp;&nbsp;</font></td></tr>";
				sFooter  = sFooter  +"<tr><td align=center><a href='screen.html' class='OuterMenu'>Window</a>:<font class='TinyText' id='FooterClientWidthHeight'> " + clientWidthWindow + " x " + clientHeightWindow  + "</font></td></tr>";
				sFooter  = sFooter  +"</table></center>";
				if(!document.all){
					sFooter  = sFooter  +"<br>";
				}
			}
			sFooter  = sFooter  +"© Copyright <a href='http//:www.cheqsoft.com' class='OuterMenu'>Chequers Software Limited</a> 2000-2006<br>All Rights Reserved.</FONT></div><br>";

        	// ...processing statements go here...
        	var xmldoc = xmlHttp.responseXML;
        	
        	
	        	try{    	
	      			HeaderScriptTop= xmldoc.getElementsByTagName('HeaderScriptTop');
	      			strHeaderTagTop= HeaderScriptTop[0].firstChild.nodeValue;
	      			if(bolPrint ==false){
						document.getElementById("HeaderTop").innerHTML   = HeaderScriptTop[0].firstChild.nodeValue;
					}
				}catch(err){
					alert("Error getting HeaderScriptTop" + err);
	
				}
			
				//try{    	
	      		//	var func= xmldoc.getElementsByTagName('functions');
	      		//	alert(func[0].firstChild.nodeValue);
	      			
	      			
	      			
	      			
	      			//eval(func[0].firstChild.nodeValue);
	      		//}catch(err){
				//	alert("Error getting HeaderScriptBottom" + err);
				//}

			

				try{    	
	      			HeaderScriptBottom= xmldoc.getElementsByTagName('HeaderScriptBottom');
	      			strHeaderTagBottom = HeaderScriptBottom[0].firstChild.nodeValue;
	      		if(bolPrint ==false){
	   	      		document.getElementById("HeaderBottom").innerHTML   = HeaderScriptBottom[0].firstChild.nodeValue;
	      		}
				}catch(err){
					alert("Error getting HeaderScriptBottom" + err);
				}
				
				
				
					
			
			
			
			try{    
				
      			var obContent = xmldoc.documentElement.getElementsByTagName('contents'); 
      			
      			if(bolPrint){ 
					document.getElementById("content").innerHTML = "<center>" +  "<table valign='top' border='0'><tr><td><center><FONT class=\"MainHeadingClip\" id=\"HeaderTop\">" + strHeaderTagTop + "</FONT></center></td></tr><tr><td><center><B><FONT class=\"SmallHeading\" id='HeaderBottom'>" +  strHeaderTagBottom  + "</FONT></B></center></td></tr></table></center>" + obContent[0].firstChild.nodeValue  + sFooter  ;
				}else{
   					document.getElementById("content").innerHTML = obContent[0].firstChild.nodeValue  + sFooter  ;
   				}
   				
			}catch(err){
				alert("Error getting content" + err);
      		}
      		
      		try{    	
      			ImageControl= xmldoc.getElementsByTagName('ImageScript');
				eval(ImageControl[0].firstChild.nodeValue );
			}catch(err){
				alert("Error getting ImageScript" + err);

			}
			
			

			if(bolPrint ==false){
				try{    	
	      			LeftMenuIndex = xmldoc.getElementsByTagName('LeftMenuIndex');
					iIndexXml = parseInt(LeftMenuIndex[0].firstChild.nodeValue);
					if(document.all){
						Menu.innerHTML =populateLeftMenu(iIndexXml);
					}else{
						document.getElementById("Menu").innerHTML = populateLeftMenu(iIndexXml );
					}
				}catch(err){
					alert("Error getting LeftMenuIndex; " + err.description);
		
				}
			}
			
			
			try{    	
      			ObInstallExe = xmldoc.getElementsByTagName('HeaderImageInstallExe');
			}catch(err){
				alert("Error getting HeaderImageInstallExe; " + err.description);
	
			}

			try{    	
      			ObPicPath = xmldoc.getElementsByTagName('HeaderImagePicPath');
      			
      			

      			
      			
      			
      			
      			
      			
			}catch(err){
				alert("Error getting HeaderImagePicPath ; " + err.description);
	
			}

			try{    	
      			ObWidth = xmldoc.getElementsByTagName('HeaderImageWidth');
			}catch(err){
				alert("Error getting HeaderImageWidth; " + err.description);
	
			}

			try{    	
      			ObHeight = xmldoc.getElementsByTagName('HeaderImageHeight');
			}catch(err){
				alert("Error getting HeaderImageHeight; " + err.description);
	
			}
			
			try{    	
      			ObToolTip = xmldoc.getElementsByTagName('HeaderImageToolTip');
			}catch(err){
				alert("Error getting HeaderImageToolTip ; " + err.description);
	
			}
			
			
			try{    	
      			InstallExe =  ObInstallExe[0].firstChild.nodeValue;
      		}catch(err){
				alert("Error getting InstallExe ; " + err.description);
			}
			
			try{    	
      			PicPath =  ObPicPath[0].firstChild.nodeValue;
			}catch(err){
				alert("Error getting PicPath ; " + err.description);
			}
      		
      		
      		if(sCurrentUrl  =="mathsown.xml"){
      			if(clientWidth <=600){
					PicPath = "pics/mathsown500_52_4_1.gif";
				}else if(clientWidth <=800){
					PicPath = "pics/mathsown500_52_4_2.gif";
				}else if(clientWidth <=1024){
					PicPath = "pics/mathsown500_52_4_3.gif";
				}else if(clientWidth >=1025){
					PicPath= "pics/mathsown500_52_4.jpg";
				}
			}
			if(sCurrentUrl  =="tah.xml" || sCurrentUrl  =="thanks.xml"){
				RedirectWithDelay();
			}
			if(sCurrentUrl  =="timesownpro.xml"){
				if(clientWidth <=600){
					PicPath = "pics/TimesOwnFullLookupMode4Columns355_1.jpg";
				}else if(clientWidth <=800){
					PicPath = "pics/TimesOwnFullLookupMode4Columns355_2.jpg";
				}else if(clientWidth <=1199){
					PicPath = "pics/TimesOwnFullLookupMode4Columns355_3.jpg";
				}else if(clientWidth >=1200){
					PicPath= "pics/TimesOwnFullLookupMode4Columns355.jpg";
				}
			}
				
				
  			if(sCurrentUrl  =="timesown.xml"){
				if(clientWidth <=600){
					PicPath = "pics/Small383_1.jpg";
				}else if(clientWidth <=800){
					PicPath = "pics/Small383_2.jpg";
				}else if(clientWidth <=1199){
					PicPath = "pics/Small383_3.jpg";
				}else if(clientWidth >=1200){
					PicPath= "pics/Small383.jpg";
				}
			}
				
			if(sCurrentUrl  == "dragndroplicensing.xml"){
				//optionOne
				

				//try{
				//	if(FileName ==null || FileName ==""){
				//		document.getElementById("optionOne").selected=true;
				//		document.getElementById("optionOne").text="Select other Demos...";
				//	}else{
				//		document.getElementById("optionOne").text="Select other Demos...";
				//
				//	}
				//}catch(err){
				//	alert("Error document.MediaForm.VidChange ; " + err.description);
				//}
	
				//if(FileName !=null && FileName !="" && FileName =="downloads/DragnDropLicensingCheqSoft.com.wmv"){
				//	document.getElementById("optionTwo").selected=true;
				//	document.getElementById("optionTwo").value="downloads/DragnDropLicensingCheqSoft.com.wmv";
				//	document.getElementById("optionTwo").text="Drag n Drop Licensing";
				//}else{
				//	document.getElementById("optionTwo").value="downloads/DragnDropLicensingCheqSoft.com.wmv";
				//	document.getElementById("optionTwo").text="Drag n Drop Licensing";	
				//}

	
		
			}
			
			
			try{    	
      			width =  ObWidth[0].firstChild.nodeValue;
			}catch(err){
				alert("Error getting width ; " + err.description);
			}
			try{    	
      			height =  ObHeight[0].firstChild.nodeValue;
			}catch(err){
				alert("Error getting height ; " + err.description);
			}

			if(bolPrint ==false){
				if(parseInt(width) > parseInt(document.getElementById("LeftTableTag").width)){
					width =  parseInt(document.getElementById("LeftTableTag").width);
				}
			}
			try{    	
      			ToolTip =  ObToolTip[0].firstChild.nodeValue.toString();
      		}catch(err){
				alert("Error getting ToolTip ; " + err.description);
			}


				
				
			
			try{    	
      			ObCaptionTitle = xmldoc.getElementsByTagName('CaptionTitle');
			}catch(err){
				alert("Error getting CaptionTitle; " + err.description);
	
			}
			
			if (window.location.hash =="#" || window.location.hash =="#;"){
				if(document.all){
					document.all("content").scrollTop = 0;
				}else{
					document.getElementById("content").scrollTop = 0;
				}
			}
			
			document.title =  ObCaptionTitle[0].firstChild.nodeValue.toString();
 
			if(bolPrint ==false){

				if(document.all){
					LeftTableTag.innerHTML = "<font id=\"Logo\" onClick=\"downloadProduct('" + InstallExe + "')\"><img src=\"" + PicPath + "\" width=\"" + width + "\"  onmouseover=\"ddrivetip('" + ToolTip + "')\" onmouseout=\"hideddrivetip()\" ></font>"
				}else{
					document.getElementById("LeftImageDiv").innerHTML = "<font id='Logo' onClick=\"downloadProduct('" + InstallExe + "')\"><img src='" + PicPath + "' width='" + width + "'   onmouseover=\"ddrivetip('" + ToolTip + "')\" onmouseout=\"hideddrivetip()\" ></font>";
				}
			}
			
			window.status= "";
			
			
			document.getElementById("content").style.display = '';
			//if(isLoaded){
				window.document.body.style.cursor = "default";
			//}
			
			if(bolPrint ==false){

				document.getElementById("breakreminder").style.cursor = "pointer";
				document.getElementById("mathsown").style.cursor = "pointer";
				document.getElementById("payment").style.cursor = "pointer";
				document.getElementById("index").style.cursor = "pointer";
				document.getElementById("timesown").style.cursor = "pointer";
				document.getElementById("timesownpro").style.cursor = "pointer";
				document.getElementById("mp3detective").style.cursor = "pointer";
				document.getElementById("clipboard").style.cursor = "pointer";
				
				
				
				
				if(document.getElementById("MiddleTable").height != document.getElementById("MiddleTable").offsetHeight + "px"){
					AlterHeights();
				}
			}
			if(sCurrentUrl  =="site.xml"){
				putTogether();
				document.getElementById("email").innerHTML = "<a href=\"mailto:" + lettersPutTogether  + "?subject=Cheqsoft.com 2.0 Site Plan Inquiry\">Email Us</a>";
			}
			
			bXMLDownloadedComplete =true;
			
      		
     }else{
            alert("There was a problem retrieving the XML data:\n" + xmlHttp.statusText);
		}
     }
     

} 


	
	function makeRequest(url,bGetNewCopie) {
			
		try{
			xmlHttp=GetXmlHttpObject();
			xmlHttp.open("GET", url , true);
			if (bGetNewCopie){ 
				xmlHttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
			}
			xmlHttp.onreadystatechange = stateChanged;
			xmlHttp.send(null);
		}catch(err){
			alert("Error makeRequest ; " + err.description);
	
		}
	}
	
	
	
	
	function makeRequestHead(url) {
		//alert(url);
		if(url.indexOf(".xml")!=-1){
			try{
				sCurrentUrl  = url;
				xmlHttpDateModified  =GetXmlHttpObject();
				xmlHttpDateModified.open("HEAD", url , true);
				xmlHttpDateModified.onreadystatechange=CheckDateModified;				
				xmlHttpDateModified.send(null);
			}catch(err){
				alert("Error makeRequestHead; " + err.description);
		
			}
		}else{
			window.location.href = url;
		}
	}

	
	
	
	
	function CheckDateModified(){
			bReloadXml = false;
			
		if (xmlHttpDateModified.readyState == 4) {
	        // only if "OK"
	        try{
        		//var xmldocDateModified = xmlHttpDateModified.responseXML;
        		var sDateModified  = xmlHttpDateModified.getResponseHeader("Last-Modified") ;
				//alert(sDateModified  );
			}catch(err){
				alert("Error getting DateModified 1 " + err);
			}

        	try{    	
        		var sXmlName = sCurrentUrl.substring(0,sCurrentUrl.length-4);
				xmlCookieValue =getCookie(sXmlName + "XmlDateModified" );
				//alert(xmlCookieValue);
				//alert(sDateModified);
				//alert(sXmlName );
				//alert(sXml  + "XmlDateModified");
				if(xmlCookieValue ==null){
					setCookie(sXmlName + "XmlDateModified",sDateModified ,expires);
					bReloadXml =true;
				}else{
					if (sDateModified  !=  xmlCookieValue){
						setCookie(sXmlName + "XmlDateModified",sDateModified ,expires);
						bReloadXml =true;
					}
				} 
				if( bReloadXml){
					window.status = "reloading " + sCurrentUrl ;
				}
				makeRequest(sCurrentUrl,bReloadXml);
				
			}catch(err){
				alert("Error getting DateModified 2 " + err);
			}
			
			
			
		}

	}




	











