/*var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
return "Uncheck All"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return "Check All"; }
}
*/

/*function CB_check()
{
//	if(document.getElementById('notify[]').checked =="")
/*var myCars=new Array();
myCars=document.getElementById('notify').value;

alert(myCars.length);
	//	alert(document.getElementById('notify[]').length);
	//else
		//alert(document.getElementByName('list[]'));
		///alert(":)");*/
//}


function doBlink() {
  // Blink, Blink, Blink...
  var blink = document.all.tags("BLINK")
  for (var i=0; i < blink.length; i++)
    blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}

function startBlink() {
  // Make sure it is IE4
  if (document.all)
    setInterval("doBlink()",1000)
}

function validateNotice()
{
document.getElementById('errorNoticeTitle').innerHTML="";
document.getElementById('errorNoticeBody').innerHTML="";
document.getElementById('errorShowTill').innerHTML="";


	if(document.getElementById('noticetitle').value=="")
	{//alert(document.getElementById('textarea2').value);
		document.getElementById('errorNoticeTitle').innerHTML="<font color=red>Title Cannot be empty</font>";
		
		return false;
	}
	
	if(document.getElementById('sel3').value=="")
	{
		document.getElementById('errorShowTill').innerHTML="<font color=red>Valid Up to?</font>";
		
		return false;
	}
	
	/*if(document.getElementById('textarea2').value=="")
	{
			//	
		document.getElementById('errorNoticeBody').innerHTML="<font color=red>Body Cannot be empty</font>";
		document.forms[0].n_area.focus();
		return false;
	}*/
	
	
}

function ClickHereToPrint(){
    try{ 
        var oIframe = document.getElementById('ifrmPrint');
        var oContent = document.getElementById('divToPrint').innerHTML;
        var oDoc = (oIframe.contentWindow || oIframe.contentDocument);
        if (oDoc.document) oDoc = oDoc.document;
		oDoc.write("<html><head><title>title</title>");
		oDoc.write("</head><body onload='this.focus(); this.print();' bgcolor='#CC99FF'>");
		oDoc.write(oContent + "</body></html>");	    
		oDoc.close(); 	    
    }
    catch(e){
	    self.print();
    }
}

function passName(student_id)
{
	document.getElementById('profile_id').value=student_id;
	document.frm.submit();
	
}

function confirmation_delete(enquiry_id) {
	var answer = confirm("Are you sure you want to delete?")
	if (answer){
		
		document.getElementById('delete_id').value=enquiry_id;
		document.dletefrm.submit();
		
	}

}

function startTime()
{
var today=new Date();

var hours=today.getHours();
var minutes=today.getMinutes();
var seconds=today.getSeconds();
/* add a zero in front of numbers<10
m=checkTime(m);
s=checkTime(s);*/
var ampm = ((hours >= 12) ? " PM" : " AM");    
                
                // convert the hour to 12-hours format
                // javascript returns midnight as 0, but since the time is in the 12-hours format
                // force javascript to return 12
hours = ((hours == 0) ? "12" : (hours > 12) ? hours - 12 : hours); 
               
                // add a leading zero if less than 10
minutes = ((minutes < 10) ? "0" + minutes : minutes); 
seconds = ((seconds < 10) ? "0" + seconds : seconds);
               
document.getElementById('txt').value=hours + ":" + minutes + ":" + seconds + ampm;
t=setTimeout('startTime()',1000);
}

/*function checkTime(i)
{
if (i<10)
  {
  i="0" + i;
  }
return i;
}*/

function popup_terms(link,window_name){
window.open(link,window_name,'left=350,top=200,width=720,height=392,scrollbars=1');
}




function doClear(theText)
{
	if (theText.value == theText.defaultValue)
 	 {
        theText.value = "";
     }
}


function doInsert(theText)
{
	if (theText.value == "")
 	 {
        theText.value = theText.defaultValue;
     }
}


function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{
			try{
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				req = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}

		return xmlhttp;
	}



	function getTaluka(strURL) {

		var req = getXMLHTTP();

		if (req) {

			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						document.getElementById('talukadiv').innerHTML=req.responseText;
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
			}
			req.open("GET", strURL, true);
			req.send(null);
		}

	}
	
	
	function getFranchise(strURL) 
	{
		var req = getXMLHTTP();
		if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
				{
					// only if "OK"
					if (req.status == 200) 
					{
						document.getElementById('franchiseDiv').innerHTML=req.responseText;
					} else 
					{
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
			}
			req.open("GET", strURL, true);
			req.send(null);
		}
	}
	
	function searchname(strURL)
	{
				var req = getXMLHTTP();

		if (req) {

			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						document.getElementById('nameresult').innerHTML=req.responseText;
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
			}
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	
	function getCategory(strURL) {

		var req = getXMLHTTP();

		if (req) {

			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						document.getElementById('courseDiv').innerHTML=req.responseText;
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
			}
			req.open("GET", strURL, true);
			req.send(null);
		}

	}
	
	function getRecord(strURL) {
		var req = getXMLHTTP();

		if (req) {

			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						//document.getElementById('talukadiv').innerHTML=req.responseText;
						//alert(req.responseText);
						var token = req.responseText.split("@");
						document.getElementById("talukadiv").innerHTML = "";
						document.getElementById("enquirydiv").innerHTML = "";
						document.getElementById("talukadiv").innerHTML = token[0];
						document.getElementById("enquirydiv").innerHTML = token[1];
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
			}
			req.open("GET", strURL, true);
			req.send(null);
		}

	}
	
	
		var xmlHttp;
		var id;
		function showQuestions(str,id1)
		{ 
			id=id1;
			//alert(id);
			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			{
				alert ("Browser does not support HTTP Request")
				return
			}
			var url="getquestion.php"
			url=url+"?q="+str
			url=url+"&sid="+Math.random()
			//alert(url);
			xmlHttp.onreadystatechange=stateChanged 
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}

		function stateChanged() 
		{ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{ 
				document.getElementById(id).innerHTML=xmlHttp.responseText 
			} 
		}

		function GetXmlHttpObject()
		{
			var xmlHttp=null;
			try
			{
				xmlHttp=new XMLHttpRequest();
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch (e)
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
			}
			return xmlHttp;
		}
	
	


