// JavaScript Document

function genSearch()
{
if(document.getElementById("txtSearch").value=="" || document.getElementById("txtSearch").value=="Keyword(s)...")
	{
	alert("Please Enter some keywords!.");
	document.getElementById("txtSearch").focus();
	return false
	}
	document.formGen.formFinder1.value="zero";
return true;
}
function SearchR()
{
	var i=0;
		if(document.formR.resourceId.value=="")
		{i=i+1;}
		if(document.formR.contentId.value=="")
		{i=i+1;}
		if(document.formR.langId.value=="")
		{i=i+1;}
		if(i==3)
		{
			alert("Please Choose atleast one option for search.");
			document.formR.resourceId.focus();
			return false;
		}
		document.formR.formFinder2.value="one";
		return true;
}

function SearchS()
{
	var i=0;
		if(document.formS.subId.value=="")
		{i=i+1;}
		if(document.getElementById("addId").value=="")
		{i=i+1;}
		if(i==2)
		{
			alert("Please Choose atleast one option for search.");
			document.formS.subId.focus();
			return false;
		}
		document.formS.formFinder3.value="two";
		return true;
}

function fAdd(id)
{
document.getElementById("divAdd").innerHTML="<img src='images/loding.gif' border=0>";
var url = "ajaxAdditional.asp";  
var parameters = "id="+id; 
var xmlHttp=new CreateObject();
 xmlHttp.open("POST", url, true);  
 //Send the proper header information along with the request  
 xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");  
 xmlHttp.setRequestHeader("Content-length", parameters .length);  
 xmlHttp.setRequestHeader("Connection", "close");  
 xmlHttp.onreadystatechange = function() {//Handler function for call back on state change.  
     if(xmlHttp.readyState == 4) { 
       document.getElementById("divAdd").innerHTML=xmlHttp.responseText;
		 //alert(xmlHttp.responseText);
     }  
 }  
 xmlHttp.send(parameters); 	
//***************
}
function fDisplay(divId,res,id,typo)
{
document.getElementById(divId).innerHTML="<img src='images/loding.gif' border=0>";
var url = "ajaxDispResult.asp";  
var parameters = "id="+id+"&res="+res+"&typo="+typo; 
var xmlHttp=new CreateObject();
 xmlHttp.open("POST", url, true);  
 //Send the proper header information along with the request  
 xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");  
 xmlHttp.setRequestHeader("Content-length", parameters .length);  
 xmlHttp.setRequestHeader("Connection", "close");  
 xmlHttp.onreadystatechange = function() {//Handler function for call back on state change.  
     if(xmlHttp.readyState == 4) { 
       document.getElementById(divId).innerHTML=xmlHttp.responseText;
     }  
 }  
 xmlHttp.send(parameters); 	
//***************
}
function CreateObject()
{
 http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
return http_request;
}

function fr_change(sid)
	{
		//alert(sid)
		var url = "ajaxPopContent.asp";  
		var parameters = "sid="+sid;
		var xmlHttp=new CreateObject();
		 xmlHttp.open("POST", url, true);  
		 //Send the proper header information along with the request  
		 xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");  
		 xmlHttp.setRequestHeader("Content-length", parameters .length);  
		 xmlHttp.setRequestHeader("Connection", "close");  
		 xmlHttp.onreadystatechange = function() {//Handler function for call back on state change.  
			 if(xmlHttp.readyState == 4) { 
			   document.getElementById("divContent").innerHTML=xmlHttp.responseText;
			 }  
		 }  
		 xmlHttp.send(parameters); 	
	}



