function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
  	}
	if (window.ActiveXObject)
	{
	  	// code for IE6, IE5
	  	return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}
function subscribe(){
	var email=document.getElementById('txtEmail');
	if(email.value==""){
		alert("Please enter Email.");
		email.focus();
		return false;
	}
	else if(checkemail(email.value)==false){
		alert("Please enter a valid Email.");
		email.focus();
		return false;
	}
	else{
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}		
		var url="include/subscribe.php?email="+email.value;	
		xmlhttp.onreadystatechange=renderSubscribe;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
}
function renderSubscribe(){	
	if(xmlhttp.readyState==4)
	{		
		if(xmlhttp.responseText==0){
			alert("You are already subscribed for newsletter.");	
		}
		else{
			alert("Thank you for subscribing to newsletter from Logospecialist.net");		
		}
		document.getElementById('txtEmail').value="";
		document.getElementById('txtEmail').focus();
	}
}

function getNext(page_no){
	var catid=document.getElementById('catid').value;
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}		
	var url="include/ajax.php?catid="+catid+"&page_no="+page_no;	
	xmlhttp.onreadystatechange=renderResult;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function renderResult(){
	if(xmlhttp.readyState==1){		
		showSpinner();		
	}
	if(xmlhttp.readyState==4)
	{		
		document.getElementById("overcover").style.display='none';
		if(xmlhttp.responseText=='FAIL'){
			alert("Error in getting result. Please try gain.")
		}
		else{
			document.getElementById("wrapper").innerHTML=xmlhttp.responseText;
			if(document.getElementById('catid').value==18){
				initLytebox();
			}
			else{
				Lightbox.initialize();
			}
		}
	}	
}
function showSpinner()
{
  var pheight=getPageSizeWithScroll();
  var padh=(((screen.height)-200)/2)-100;  
  document.getElementById("overcover").style.paddingTop=padh;
  document.getElementById("overcover").style.height=pheight;
  document.getElementById("overcover").style.display='block';
}
function getPageSizeWithScroll()
{
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} 
	else if (document.body.scrollHeight > document.body.offsetHeight)
	{ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} 
	else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
	  }
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return yWithScroll;
}
function checkemail(email){
	 var filter=/^.+@.+\..{2,3}$/;		
	 if (filter.test(email))
		return true;
	 else 			
		return false;
}