var xmlHttp

function categoryPlay(id) { 
	document.getElementById('work_pagecontent').innerHTML="loading ...";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/videoPlay.cfm?category=" + id + "&sid=" + Math.random();
	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttp.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttp)	{
			xmlHttp.send()
		}
	}
	function stateChanged() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
			document.getElementById('work_pagecontent').innerHTML=xmlHttp.responseText 
		} 
	} 
}

function videoPlay(id,category) { 
	document.getElementById('work_pagecontent').innerHTML="loading ...";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/videoPlay.cfm?videotoplay=" + id + "&category=" + category + "&sid=" + Math.random();
	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttp.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttp)	{
			xmlHttp.send()
		}
	}
	function stateChanged() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
			document.getElementById('work_pagecontent').innerHTML=xmlHttp.responseText 
		} 
	} 
}

function GetXmlHttpObject() { 
	var objXMLHttp=null
	if (window.XMLHttpRequest) {
		objXMLHttp=new XMLHttpRequest()
	} else if (window.ActiveXObject) {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}


function validate_email(field,alerttxt) {
	with (field) { 
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) {alert(alerttxt);return false;}
		else { return true; }
	}
}
function validate_form(thisform,fieldtovalidate)
{
	with (thisform)
	{
	if (validate_email(fieldtovalidate,"Not a valid e-mail address!")==false)
	  { return false;}
	}
}
function clearout(x) { 
	//alert(x);
	document.getElementById(x).style.background="white";
}


function hideSticker() { 
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}

	if(x>=1212) { 
		document.getElementById('subscribe_sticker').style.display="block";
	} else { 
		document.getElementById('subscribe_sticker').style.display="none";
	}
}
