/* START - AJAX COMMON FUNCTIONS */
/*************************************************************************/
var url = "ajax_footerads.php"; // The server-side script 
	  function handleHttpResponse() {    
        if (http.readyState == 4) { 
              if(http.status==200) { 
                  var results=http.responseText;
				  //alert(results);
              	  document.getElementById('footer_ads').innerHTML = results; 
              } 
              } 
        } 
var heightlimit = 0;
function openit(){
	heightlimit++;
	if(heightlimit !=5000){
		heightlimit = 0;
		 	http.open("GET",url, true); 
            http.onreadystatechange = handleHttpResponse; 
            http.send(null); 
		t = setTimeout("openit()",80000);
		return false;
	 }else if(heightlimit == 1){
		    http.open("GET",url, true); 
            http.onreadystatechange = handleHttpResponse; 
            http.send(null);
	 }
	t = setTimeout("openit()",80000);
	return false;
	}
function getHTTPObject() { 
  var xmlhttp; 
  if(window.XMLHttpRequest){ 
    xmlhttp = new XMLHttpRequest(); 
  } 
  else if (window.ActiveXObject){ 
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
    if (!xmlhttp){ 
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
    } 
    
} 
  return xmlhttp; 
} 
var http = getHTTPObject(); // We create the HTTP Object 
/******************************************************************************************/

function isqueryvalid(){
	if(document.getElementById("user_name").value==""){
		alert("Please Enter Your Name");
		document.getElementById("user_name").focus();
		return false;
	}
		if(document.getElementById("user_email").value.length > 0){
		if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById("user_email").value)){
		
			alert("Invalid E-mail Address! Please re-enter.")
			document.getElementById("user_email").focus()
			return false;
		}
	}else{
			alert("Email address is empty.")
			document.getElementById("user_email").focus()
			return false;
	
	}
	if(document.getElementById("subject").value==""){
		alert("Subject must be mentioned");
		document.getElementById("subject").focus();
		return false;
	}
	if(document.getElementById("desc").value==""){
		alert("Email Description must be entered");
		document.getElementById("desc").focus();
		return false;
	}
	return true;}
	
function search_video(keyword){
	window.location = 'video_list.php?video_name='+keyword ;	
}

function search_video2(keyword){
	window.location = 'video_list.php?video_name='+keyword ;	
}
function search_news(keyword){
	window.location = 'news.php?news_name='+keyword ;	
}

function search_news2(keyword){
	window.location = 'news.php?news_name='+keyword ;	
}
function browseimage(cat){
	if(cat == 'none'){
		alert('Select Category First');
		return false;
	}else{
		window.location = "gal_images.php?cat="+cat;
	}
}	
function search_image(keyword){
	window.location = 'gal_images.php?image='+keyword ;	
}
