// JavaScript Document

function imposeMaxLength(Object, MaxLen)

{

  return (Object.value.length <= MaxLen);

}



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;

}



function find(str)

{ 

xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null)

	{

		alert ("Browser does not support HTTP Request");

		return;

	}

	if(str != 0)

	{

		var url="ajax_find.php";

		url=url+"?find="+str;

		url=url+"&sid="+Math.random();

		xmlHttp.onreadystatechange=function()

		{

			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

			{ 

				document.getElementById("find_result").innerHTML=xmlHttp.responseText;

			}

			else if (xmlHttp.readyState!=4 || xmlHttp.readyState!="complete")

			{ 

				document.getElementById("find_result").innerHTML='<img src="../images/ajax-loader1.gif">';

			} 

		}

		xmlHttp.open("GET",url,true);

		xmlHttp.send(null);

	}

}

function more_find(str)

{ 

	xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null)

	{

		alert ("Browser does not support HTTP Request");

		return;

	}

	if(str != 0)

	{

		var url="../../more_ajax.php";

		url=url+"?find="+str;

		url=url+"&sid="+Math.random();

		xmlHttp.onreadystatechange=function()

		{

			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

			{

				document.getElementById('more_id').style.display="block";

				document.getElementById('find_id').style.display="none";

				document.getElementById("more_id").innerHTML=xmlHttp.responseText;

			}

			else if (xmlHttp.readyState!=4 || xmlHttp.readyState!="complete")

			{ 

				document.getElementById("more_id").innerHTML='<img src="../images/ajax-loader1.gif">';

			} 

		}

		xmlHttp.open("GET",url,true);

		xmlHttp.send(null);

	}

}

function search_suggest(str, type)

{ 

xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null)

	{

		alert ("Browser does not support HTTP Request");

		return;

	}

	if(str != "")

	{

		var url="searchsuggest.php";

		url=url+"?str="+str;

		url=url+"&sid="+Math.random();

		xmlHttp.onreadystatechange=function()

		{

			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

			{ 

				document.getElementById('search_suggestions').style.display="block";

				document.getElementById("search_suggestionsList").innerHTML=xmlHttp.responseText;

			}

			else if (xmlHttp.readyState!=4 || xmlHttp.readyState!="complete")

			{ 

				document.getElementById('search_suggestions').style.display="block";

				document.getElementById("search_suggestionsList").innerHTML="<img src='http://www.studentscloud.com/images/ajax-loader1.gif' />";

			} 

		}

		xmlHttp.open("GET",url,true);

		xmlHttp.send(null);

	}

	else

	{

		document.getElementById('search_suggestions').style.display="none";

	}

}

function fill_out(str)

{

	document.getElementById('keyword').value=str;

	document.getElementById('search_suggestions').style.display="none";

}

function chk_header_search()

{

	var tmp=document.header_search.keyword.value;

	

	if(document.header_search.keyword.value == 0 || document.header_search.keyword.value == "Find People"|| document.header_search.keyword.value == "Find Products"|| document.header_search.keyword.value == "Find Group"|| document.header_search.keyword.value == "Find Answers"|| document.header_search.keyword.value == "Find Company" )

	{

		alert("Enter the Keyword");

		document.header_search.keyword.focus();

		return false;

	}



	if(tmp.length < 3)

	{

		alert("please enter minumum three characters");

		document.header_search.keyword.focus();

		return false;

	}

}



function search_executive(str)

{ 

xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null)

	{

		alert ("Browser does not support HTTP Request");

		return;

	}

	if(str != "")

	{

		var url="searchexecutive.php";

		url=url+"?str="+str;

		url=url+"&sid="+Math.random();

		xmlHttp.onreadystatechange=function()

		{

			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

			{ 

				document.getElementById('company_executive').style.display="block";

				document.getElementById("company_executive").innerHTML=xmlHttp.responseText;

			}

			else if (xmlHttp.readyState!=4 || xmlHttp.readyState!="complete")

			{ 

				document.getElementById('company_executive').style.display="block";

				document.getElementById("company_executive").innerHTML="<img src='http://www.studentscloud.com/images/ajax-loader1.gif' />";

			} 

		}

		xmlHttp.open("GET",url,true);

		xmlHttp.send(null);

	}

	else

	{

		document.getElementById('search_suggestions').style.display="none";

	}

}

function get_video_subcat(str,str1)

{ 
xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null)

	{

		alert ("Browser does not support HTTP Request");

		return;

	}

	if(str != 0)

	{
		


		var url="video_sub_cat_new.php";

		url=url+"?viewby="+str;

		url=url+"&view="+str1;

		url=url+"&sid="+Math.random();

		xmlHttp.onreadystatechange=function()

		{

			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

			{ 

				document.getElementById("find_result").innerHTML=xmlHttp.responseText;

			}

			else if (xmlHttp.readyState!=4 || xmlHttp.readyState!="complete")

			{ 

				document.getElementById("find_result").innerHTML='<img src="../images/ajax-loader1.gif">';

			} 

		}

		xmlHttp.open("GET",url,true);

		xmlHttp.send(null);

	}

}


function get_kb_subcat(str)

{ 
xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null)

	{

		alert ("Browser does not support HTTP Request");

		return;

	}
	

	if(str != 0)

	{
		

		var url="kb_sub_cat.php";

		url=url+"?viewby="+str;

		url=url+"&sid="+Math.random();

		xmlHttp.onreadystatechange=function()

		{

			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

			{ 

				document.getElementById("find_result").innerHTML=xmlHttp.responseText;

			}

			else if (xmlHttp.readyState!=4 || xmlHttp.readyState!="complete")

			{ 

				document.getElementById("find_result").innerHTML='<img src="../images/ajax-loader1.gif">';

			} 

		}

		xmlHttp.open("GET",url,true);

		xmlHttp.send(null);

	}

}


function Uploda_video_frm()

{

	var frm=document.upload_video;

	if(frm.videotitle.value == 0)

	{

		alert("Enter the Video title")

		frm.videotitle.focus();

		return false;

	}

	if(frm.videodescription.value == 0)

	{

		alert("Enter the Video Descr")

		frm.videodescription.focus();

		return false;

	}

	if(frm.videocategory.value == 0)

	{

		alert("Choose Video Category")

		frm.videocategory.focus();

		return false;

	}

	if(frm.sub_category.value == 0)

	{

		alert("Choose Video Sub Category")

		frm.sub_category.focus();

		return false;

	}

	if(frm.embed.value == 0)

	{

		alert("Enter the Embed Code")

		frm.embed.focus();

		return false;

	}

}

function video_upload(id,name,type)

{

	window.location.href='../upload_video.php?id='+id+'&name='+name+'&type='+type;

}



function index_video_frm()

{

	var frm=document.home_video;

	if(frm.keyword.value == 0)

	{

		alert("Enter Keyword")

		frm.keyword.focus();

		return false;

	}

	if(frm.videocategory.value == 0)

	{

		alert("Choose video Category")

		frm.videocategory.focus();

		return false;

	}
	
	


	

	

}


