	//--------------- LOCALIZEABLE GLOBALS ---------------
var d=new Date();
var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
//--------------- END LOCALIZEABLE ---------------
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.frmSample.txtEmail
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }

	/** WCCM JavaScript Library */
	
	// ===== Screen Quality Detection =======================
	var vdu_width = screen.width;
	var vdu_height = screen.height;
	var vdu_colorDepth = screen.colorDepth;
	var vdu_pixelDepth = screen.pixelDepth;
	
	/*if(vdu_width > 999)	{		
		document.write ("<link href=\'../css/wccm_widescreen.css\' rel=\'stylesheet\' type= \'text/css\' />");	
	}*/

	// ===== Select Picture of Appropriate Size =============		
	function altpic (pic,ext,alt) {
		// Relies on naming convention 
		// _b for largest images on high resolution screens: landscape 750; portrait 500
		// _m for low res 800x600 screens: landscape 450; portrait 300
		// _s for hand held devices: landscape 300; portrait 150
		
		//alert("Got here"); //Debug code
		pic = "../images/" + pic; 
		if (vdu_width >= 1100) {pic = pic + "_b." + ext;}
		if (vdu_width < 1100 & vdu_width >=500) {pic = pic + "_m." + ext;}
		if (vdu_width < 500) {pic = pic + "_s." + ext;}
		//alert(pic); //Debug code
		document.write("<img src = " + pic + " alt = " + alt + "/>");				
	}
	
	// ===== Change contents of a block element ===========
	// Used to place place titletext into banner div
	// Source: http://www.sitepoint.com/article/layers-content-javascript
	/*function WriteLayer(ID,parentID,sText) { 
 		if (document.layers) { 
   			var oLayer; 
   			if(parentID){ 
     			oLayer = eval('document.' + parentID + '.document.' + ID + '.document'); 
   			}else{ 
     			oLayer = document.layers[ID].document; 
   			} 
  			oLayer.open(); 
   			oLayer.write(sText); 
   			oLayer.close(); 
 		} 
 		else if (parseInt(navigator.appVersion)>=5&&navigator. 
			appName=="Netscape") { 
   			document.getElementById(ID).innerHTML = sText; 
 		} 
 		else if (document.all) document.all[ID].innerHTML = sText;		
	}*/
	
	// To return to the previous page
	function goBack() {
		javascript:history.go(-1);
	}
	
	//Used to display email addresses on browser - should fool mailbots hopefully
	function oldsend(ename, extension,target) {	
		var linker = "@";
		target = "Email " + target;	
		document.write("<a href=" + "mail" + "to:" + ename +
		linker + extension + ">" + target + "</a>");
	}
	
	function send(ename, extension,target) {	
		var linker = "@";
		target = "Click here to email " + target;	
		document.write("<a class="+"hov " + "href=" + "mail" + "to:" + ename +
		linker + extension + ">" + target + "</a>");
	}	
	
	
	//###### AJAX ###### AJAX ###### AJAX ###### AJAX ###### AJAX ###### AJAX ###### AJAX ###### AJAX 	
	
//Uses Ajax to trace existing database records
var xmlHttp;
var formObject;

/*
In the getDetails function below:
'str' is the value to be found in the database
'divtag' is the id of a div within which HTML and details from the database will be written into the hosting page
'handler' is the file which will call the database and generate the HTML code and render the data
*/
function getDetails(str, divtag, handler)
{
//alert(handler); //Debug code
formObject = divtag;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 }
//var url="download_handler.php";
var url= handler;
url=url+"?q="+str; //str is the value to be searched for in the database
//alert(str);	//Debug code
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged; 
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById(formObject).innerHTML=xmlHttp.responseText ;
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

 
/* --------Finding the Position of the Cursor --------

IE stores this offset in its document.documentElement.clientLeft and document.documentElement.clientTop properties. This code should calculate the correct cursor position in all current browsers:

*/

function getPosition(e) {
    e = e || window.event;
    var cursor = {x:0, y:0};
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX + 
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY + 
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
}


/* ------------------------------ Floating a layer at cursor position -------------------------*/

<!-- Copyright 2006,2007 Bontrager Connection, LLC
// http://bontragerconnection.com/ and http://www.willmaster.com/
// Version: July 28, 2007
var winW = 0, winH = 0;
var winheight = screen.height*0.9;	//Account for menu and toolbars

if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth-16;
  winH = window.innerHeight-16;
 }
 if (navigator.appName.indexOf("Microsoft")!=0) {  
  //winW = document.body.offsetWidth;
 //winH = winheight - document.body.offsetHeight; 	//Adjustment to approximate to Netscape norms
  }
}


var cX = 0; var cY = 0; var rX = 0; var rY = 0;

function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}

function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}

if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }

function AssignPosition(d,x,y) {
	if(self.pageYOffset) {
		rX = self.pageXOffset;
		rY = self.pageYOffset;
	}
	else if(document.documentElement && document.documentElement.scrollTop) {
		rX = document.documentElement.scrollLeft;
		rY = document.documentElement.scrollTop;
	}
	else if(document.body) {
		rX = document.body.scrollLeft;
		rY = document.body.scrollTop;
	}
	if(document.all) {
		cX += rX; 
		cY += rY;
	}	
	//Test for nearness to right edge of screen - PJS amendment
	// x=limit on distance from right edge;  y= limit on distance from base - passed as arguments
	rDiff = winW - cX;
	if(rDiff<x)	{
		cX = cX-x;	//Create a minimum potential width of 400
	}
	rDiff = winH - cY;
	if(rDiff<y)	{
		cY = cY-y;	//Create a minimum potential height of 400
	}	
	//End of test	
	d.style.left = (cX+10) + "px";
	d.style.top = (cY+10) + "px";	
	//alert(winH);	
}

function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}

function ShowContent(d,x,y) {	// x=limit on distance from right edge;  y= limit on distance from base
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd,x,y);			// x=limit on distance from right edge;  y= limit on distance from base
	dd.style.display = "block";
}

function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}

/* Create a narrow div for wide screens */
function sizer_on(x)	{		//Call above all affected content 
	var w = screen.width;		
	if (w>x) {
		document.writeln("<div class='center80'>");			
	}
}	
function sizer_off(x)	{		//Call below all affected content
	var w = screen.width;	
	if (w>x) {
		document.writeln("</div>");
	}
}	
/* End of narrower div for wide screens */	
var pageheader;
