var quecounter=0;

function getXMLHTTPRequest() 
{
	var requester = false;
	try 
	{
		requester = new XMLHttpRequest();
	}
	catch (error) 
	{
		var aVersions = [ "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0", "MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp", "Microsoft.XMLHTTP"];
		for(var i = 0; i< aVersions.length;i++)
		{
			try 
			{requester = new ActiveXObject(aVersions[i]);}
			catch (error) 
			{
				continue;
			}
		}
	}
	return requester;
}
function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	


	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
function getPageScroll()
{
	var yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}
function aligncenter(id)
{
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	//document.getElementById("overlay").style.height = (arrayPageSize[1] + 'px');
	if(document.getElementById(id))
	{
		document.getElementById(id).style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - 200) / 2) + 'px');
		document.getElementById(id).style.left = (((arrayPageSize[0] - 20 - 400) / 2) + 'px');	
	}
}
function aligncenter_mod(id)
{
	if(id== "boxcontactb" || id== "boxcontacta" || id== "boxcontact" )
	{
		ww=100 ; ss=450;	
	}
	if(id== "lightbox")
	{
		ww=460 ; ss=550;	
	}
	if(id== "lightbox_comm")
	{
		ww=400 ; ss=750;	
	}
	if(id == "boxcontacta123")
	{
		ww=460 ; ss=600;	
	}
	if(id == "schoolname")
	{
		ww=434 ; ss=434;	
	}
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	
	//var ww=document.getElementById(id).style.height;
	//var ss=document.getElementById(id).style.width;
	
	var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 -  ww) / 2);
	var lightboxLeft = ((arrayPageSize[0] - 20 - ss) / 2);

	document.getElementById(id).style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px";
	document.getElementById(id).style.left= (lightboxLeft < 0) ? "0px" : lightboxLeft + "px";	
	
	//if(document.getElementById(id))
	//{
		//document.getElementById(id).style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - 200) / 2) + 'px');
		//document.getElementById(id).style.left = (((arrayPageSize[0] - 20 - 900) / 2) + 'px');	
	//}
}

function getoverlayloader(msg)
{
	aligncenter("lightbox");
	if(document.getElementById("overlay"))
	document.getElementById("overlay").style.display="block"	;
	
	if(document.getElementById("lightbox"))
	document.getElementById("lightbox").style.display="block"	;
	
	if(document.getElementById("lightbox"))
	document.getElementById("lightbox").innerHTML="<center><br><br><br><br><br><font class=sample11 >"+msg+"...Please wait...</font><br><img src='ajax-loader.gif' ></center>";
	
}
function hideoverlayloader()
{
	if(document.getElementById("overlay"))	document.getElementById("overlay").style.display="none"	;
	
	if(document.getElementById("lightbox")) document.getElementById("lightbox").style.display="none"	;
}
function Chknregister(fnm,unm,pwd,email)
{
	var msg="Checking details";
	getoverlayloader(msg);
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'register.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				if(resp == "Success")
				{
					var msg="You have registered successfully";	
					show_login();				
				}
				else
				{
					var msg=resp;
				}
				hideoverlayloader();
				alert(msg);				
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('fullname_su='+fnm+'&username_su='+unm+'&password_su='+pwd+'&email_su='+email);	
}
function updateprofile()
{
	var msg="Getting profile updation page";
	getoverlayloader(msg);
	var fnm="";
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'updateprofile.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				document.getElementById("lightbox").innerHTML=resp;
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('fullname_su='+fnm);	
}
function Chkquiztaken()
{
	var unm=1;
	var msg="Checking quiz details";
	getoverlayloader(msg);
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'post.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				if(resp == "0")
				{
					if(document.getElementById('quizid'))
					document.getElementById('quizid').style.display='';					
				}
				else
				{
					if(document.getElementById('msgs'))
					{
						document.getElementById('msgs').style.display='';		
						document.getElementById('msgs').innerHTML=resp;					
					}
				}
			}
		}
	}
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('username_quiz='+unm);
}
function Chknlogin(unm,pwd)
{
	var msg="Checking login details";
	getoverlayloader(msg);
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'post.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				if(resp == "Success")
				{
					
					
					var msg="You have successfully logged In.";
					hideoverlayloader();
					loginHide();
					alert(msg);	
					
					var ss='<a href="logout.php"  class="red">Logout</a>';
					document.getElementById('lgndiv').innerHTML=ss;
					
					if(document.getElementById('regfrm'))
					{
						document.getElementById('regfrm').innerHTML="<b class='msg'>You have logged in successfully!!</b>";
					}
					if(document.getElementById('header'))
					{
						document.getElementById('header').innerHTML="Login";
					}
					if(document.getElementById('quizid'))			
					{
						//document.getElementById('quizid').style.display='';
						Chkquiztaken();
					}
					if(document.getElementById('msgs'))			
					{
						document.getElementById('msgs').style.display='none';
					}
					if(document.getElementById('par'))			
					{
						document.getElementById('par').innerHTML='<img src="images/submit_participate.jpg"  style="cursor:pointer;" onclick="javascript:validatepartfrm(document.frmpart);"/>';
					}
					if(document.getElementById('quizid_p'))			
					{
						document.getElementById('quizid_p').style.display='';
						
					}
					if(document.getElementById('quizid_p_pqrst'))			
					{
						document.getElementById('quizid_p_pqrst').style.display='';
						window.location.href="slambook.php";
					}
					
					getUname();
					//getprofileDtl(msg);	
					/*
					if(document.getElementById('tt'))			
					{
						document.getElementById('tt').style.display='none';
					}*/
					
				}
				else
				{
					var msg=resp;
					hideoverlayloader();
					alert(msg);		
				}
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('username_li='+unm+'&password_li='+pwd);
	
	
}
function getUname()
{
	var unm="1";
	var msg="Getting login details";
	getoverlayloader(msg);
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'post.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				hideoverlayloader();
				document.getElementById('lgnusr').innerHTML=resp;
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('username_get='+unm);
}
function ChkFpwd(unm)
{
	var msg="Checking details";
	getoverlayloader(msg);
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'post.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				hideoverlayloader();
				if(resp == "Success")
				{
					var msg="Your password has been mailed to you at your email id";	
					loginHide();
				}
				else
				{
					var msg=resp;
					alert(msg);		
				}
				
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('username_fpw='+unm);
}
function getprofileDtl(msg)
{
	var rr='<table width="90" border="0" cellspacing="0" cellpadding="0" align="right"><tr><td width="7"><img src="images/tab_left_unsel.jpg" alt="tab left" width="7" height="50" /></td><td class="tabbgunsel"><a href="logout.php"><strong>Logout</strong></a></td><td width="7"><img src="images/tab_right_unsel.jpg" alt="Tab right" width="7" height="50" /></td></tr></table>';
	
	var fnm="";
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'getlogin.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				document.getElementById("registerdiv").innerHTML=resp;
				document.getElementById("overlay").style.display="none"	;
				document.getElementById("lightbox").style.display="none"	;
				document.getElementById("logoutlink").style.display=""	;
				document.getElementById("logoutlink").innerHTML=rr;
				hideoverlayloader();
				alert(msg);
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('full='+fnm);	
}
function show_signup()
{
	$('#signup_box').fadeIn("slow");
	$('#login_box').hide();
	$('#forgotpw_box').hide();
}
function show_forgotpw()
{
	$('#signup_box').hide();
	$('#login_box').hide();
	$('#forgotpw_box').fadeIn("slow");
}
function show_login()
{
	$('#signup_box').hide();
	$('#login_box').fadeIn("slow");
	$('#forgotpw_box').hide();
}
function ChkUpdatePro(Form)
{
   if( (Form.fullname_su.value=="")||(Form.fullname_su.value=="FullName")||!isNaN(Form.fullname_su.value))
	{
		alert("Kindly fill in your First name!");
		Form.fullname_su.focus();
		return false;
	}
	else if( (Form.email_su.value!='') && (validateemailv2(Form.email_su.value)==false) )
	{
		alert("Kindly fill in a valid Email Id!");
		Form.email_su.focus();
		return false;
	}
	else 
	{
		var fnm=Form.fullname_su.value;
		var eml=Form.email_su.value;
		var msg="Updating profile details";
		getoverlayloader(msg);
		
		var xmlhttp = getXMLHTTPRequest();
		xmlhttp.open('POST', 'profileupdates.php', true);     
		xmlhttp.onreadystatechange = function() 
		{
			if (xmlhttp.readyState == 4) 
			{
				if (xmlhttp.status == 200) 
				{	
					var resp=xmlhttp.responseText;
					var msg="Your profile details have been updated successfully";
					getprofileDtl(msg);
					//hideoverlayloader();
					//alert(resp);
				}
			}
		}
		// Send the POST request
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlhttp.send('fullname_su='+fnm+'&email_su='+eml);
	}
}

function submitLoginForm(Form)
{
	//alert("Sahal coding!!");
	 if( (Form.username_li.value=="")||(Form.username_li.value=="Username")||!isNaN(Form.username_li.value))
	{
		alert("Kindly fill in your Username!");
		Form.username_li.focus();
		return false;
	}
	else if( (Form.password_li.value=="")||(Form.password_li.value=="Password"))
	{
		alert("Kindly enter your Password!");
		Form.password_li.focus();
		return false;
	}
	else 
	{
		var unm=Form.username_li.value;
		var pwd=Form.password_li.value;
		Chknlogin(unm,pwd)	;
	}
}

function submitSignupForm(Form)
{
	
	if( (Form.fullname_su.value=="")||(Form.fullname_su.value=="Name")||!isNaN(Form.fullname_su.value))
	{
		alert("Kindly fill in your Fullname!");
		Form.fullname_su.focus();
		return false;
	}
	else if( (Form.username_su.value=="")||(Form.username_su.value=="Username")||!isNaN(Form.username_su.value))
	{
		alert("Kindly fill in your Username!");
		Form.username_su.focus();
		return false;
	}
	else if( (Form.password_su.value=="")||(Form.password_su.value=="Password")||!isNaN(Form.password_su.value))
	{
		alert("Kindly enter your Password!");
		Form.password_su.focus();
		return false;
	}
	else  if( (Form.email_su.value=="")||(Form.email_su.value=="Password")||!isNaN(Form.email_su.value))
	{
		alert("Kindly fill in your Email Id!");
		Form.email_su.focus();
		return false;
	}
	else if( (Form.email_su.value!='') && (validateemailv2(Form.email_su.value)==false) )
	{
		alert("Kindly fill in a valid Email Id!");
		Form.email_su.focus();
		return false;
	}
	else 
	{
		var fnm=Form.fullname_su.value;
		var unm=Form.username_su.value;
		var pwd=Form.password_su.value;
		var email=Form.email_su.value;
		Chknregister(fnm,unm,pwd,email)	;
	//	Form.submit();
	}
}

function submitFpwForm(Form)
{
	if( (Form.username_fpw.value=="")||(Form.username_fpw.value=="Username")||!isNaN(Form.username_fpw.value))
	{
		alert("Kindly fill in your Username!");
		Form.username_fpw.focus();
		return false;
	}
	else 
	{
		//Form.submit();
		var unm=Form.username_fpw.value;
		ChkFpwd(unm);
	}
}

function validateemailv2(email)
{
	// a very simple email validation checking.
	// you can add more complex email checking if it helps
	var splitted = email.match("^(.+)@(.+)$");
	if(splitted == null) return false;
	if(splitted[1] != null )
	{
		var regexp_user=/^\"?[\w-_\.]*\"?$/;
		if(splitted[1].match(regexp_user) == null) return false;
	}
	if(splitted[2] != null)
	{
		var regexp_domain=/^[\w-\.]*\.[a-za-z]{2,4}$/;
		if(splitted[2].match(regexp_domain) == null)
		{
			var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
			if(splitted[2].match(regexp_ip) == null) return false;
		}
		return true;
	}
	return false;
}
function ChkBlogSub(Form)
{
	if( Form.comm.value=="" || !isNaN(Form.comm.value))
	{
		alert("Please put the comments");
		Form.comm.focus();
		return false;
	}
	return true;
}

function ChkContestSub(Form)
{
	
	if( Form.partn_title.value=="" || !isNaN(Form.partn_title.value))
	{
		alert("Please put the title");
		Form.partn_title.focus();
		return false;
	}
	else if( Form.comm.value=="" || !isNaN(Form.comm.value))
	{
		alert("Please put the comments");
		Form.comm.focus();
		return false;
	}
	return true;
}

function nextprevdata(pg,tt)
{
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'artdata.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				document.getElementById(tt).innerHTML=resp;
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('pg='+pg);	
}

function nextprevdata_arc(pg,tt)
{
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'artdata_arc.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				document.getElementById(tt).innerHTML=resp;
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('pg='+pg);	
}
function postcomment(artid)
{
	var msg="Getting post comment page";
	getoverlayloader(msg);
	var fnm="";
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'postcomment.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				if(resp == '0')
				{
					hideoverlayloader();
					alert("Please log in to post your comments")	;
				}
				else
				{
					document.getElementById("lightbox").innerHTML="";
					document.getElementById("boxcontacta123").innerHTML=resp;
					aligncenter_mod("boxcontacta123");
				}
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('artid='+artid);	
}
function ChkUpdatecomm()
{
   if( document.getElementById('comment').value=='')
	{
		alert("Please put your comments");
		return false;
	}
	else 
	{
		var comm=document.getElementById('comment').value;
		var artid=document.getElementById('artid').value;
		
		var msg="Putting article comments";
		getoverlayloader(msg);
		
		var xmlhttp = getXMLHTTPRequest();
		xmlhttp.open('POST', 'post.php', true);     
		xmlhttp.onreadystatechange = function() 
		{
			if (xmlhttp.readyState == 4) 
			{
				if (xmlhttp.status == 200) 
				{	
					var resp=xmlhttp.responseText;
				//	var msg="Your comment have been posted";
					//getprofileDtl(resp);
					
					alert(resp);
					hideoverlayloader();
					document.getElementById('lightbox1').innerHTML='';
				}
			}
		}
		// Send the POST request
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlhttp.send('artid='+artid+'&comment='+comm);
	}
}
function test()
{
	hideoverlayloader();
	document.getElementById('lightbox1').innerHTML='';
}
function close(id)
{
	hideoverlayloader();
	document.getElementById(id).innerHTML='';
}
function aligncenter_mod_final(id,ww,ss)
{
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	
	//var ww=document.getElementById(id).style.height;
	//var ss=document.getElementById(id).style.width;
	
	var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 -  ww) / 2);
	var lightboxLeft = ((arrayPageSize[0] - 20 - ss) / 2);

	document.getElementById(id).style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px";
	document.getElementById(id).style.left= (lightboxLeft < 0) ? "0px" : lightboxLeft + "px";	
	
	//if(document.getElementById(id))
	//{
		//document.getElementById(id).style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - 200) / 2) + 'px');
		//document.getElementById(id).style.left = (((arrayPageSize[0] - 20 - 900) / 2) + 'px');	
	//}
}

function getschools(cityid)
{
	var msg="Getting Schools";
	getoverlayloader(msg);
	var fnm="";
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'getschools.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				if(resp == '0')
				{
					hideoverlayloader();
					alert("Please log in to participate")	;
				}
				else
				{
					document.getElementById("lightbox").innerHTML="";
					document.getElementById("cityschools").innerHTML=resp;
					document.getElementById("school_tr").style.display="";
					hideoverlayloader();
				}
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('cityid='+cityid);	
}
function GetSchooldata(id)
{
	var msg="Getting Schools";
	getoverlayloader(msg);
	var fnm="";
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'schooldata.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				document.getElementById("lightbox").innerHTML="";
				document.getElementById("updatedetails").innerHTML=resp;
				document.getElementById('schoolname').style.visibility='';
				aligncenter_mod_final("schoolname",400,400);
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('id='+id);	
}


function editPerInfo()
{
	var msg="Getting users personal information details";
	getoverlayloader(msg);
	var fnm="";
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'edit_personalinfo.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				if(resp == '0')
				{
					hideoverlayloader();
					alert("Please log in to post your comments")	;
				}
				else
				{
					document.getElementById("lightbox").innerHTML="";
					document.getElementById("lightbox_comm").innerHTML=resp;
					aligncenter_mod("lightbox_comm");
				}
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('usrid='+fnm);	
}

function editAddQue()
{
	var msg="Getting users additional questions details";
	getoverlayloader(msg);
	var fnm="";
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'edit_addque.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				if(resp == '0')
				{
					hideoverlayloader();
					alert("Please log in to post your comments")	;
				}
				else
				{
					document.getElementById("lightbox").innerHTML="";
					document.getElementById("lightbox_comm").innerHTML=resp;
					aligncenter_mod("lightbox_comm");
				}
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('usrid='+fnm);	
}

function uploadChangePhoto()
{
	var msg="Getting users photo details";
	getoverlayloader(msg);
	var fnm="";
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'uploadimage.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				if(resp == '0')
				{
					hideoverlayloader();
					alert("Please log in to post your comments")	;
				}
				else
				{
					document.getElementById("lightbox").innerHTML="";
					document.getElementById("lightbox_comm").innerHTML=resp;
					aligncenter_mod("lightbox_comm");
				}
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('usrid='+fnm);	
}

function getCroper()
{
	/*var succ=document.getElementById("success").value;
	alert(succ);
	if(succ != "Success")
	{
		alert(succ);
		return false;
	}*/
	
	var imgnm=document.getElementById("fileupload_name").value;
				
	
	if(imgnm.value = "")
	{
		alert("Failed to upload the image"); return false;
	}
	document.tmp.submit();
	/*var imgnm="uploadthumbphotos/"+document.getElementById("fileupload_name").value;

	document.getElementById('lightbox_comm').innerHTML="";
	document.getElementById("cropbox").src=imgnm;
		document.getElementById('cropbox').style.display='';	*/
		//	document.getElementById('croper').style.display='';	
	/*var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'crop.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				document.getElementById('lightbox_comm').innerHTML=resp;	
				jinit();
				/*if(resp == "0")
				{
					if(document.getElementById('quizid'))
					document.getElementById('quizid').style.display='';					
				}
				else
				{
					if(document.getElementById('msgs'))
					{
						document.getElementById('msgs').style.display='';		
						document.getElementById('msgs').innerHTML=resp;					
					}
				}
			}
		}
	}
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('imgname='+imgnm);*/
}

function UpdatePwd()
{
	var msg="Getting users personal information details";
	getoverlayloader(msg);
	var fnm="";
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'update_pwd.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				if(resp == '0')
				{
					hideoverlayloader();
					alert("Please log in to post your comments")	;
				}
				else
				{
					document.getElementById("lightbox").innerHTML="";
					document.getElementById("lightbox_comm").innerHTML=resp;
					aligncenter_mod("lightbox_comm");
				}
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('usrid='+fnm);	
}


/****************** quiz new ****************/


function checkQuizAnswer(qid,oid)
{
	var xmlhttp = getXMLHTTPRequest();
	xmlhttp.open('POST', 'checkquizanswer.php', true);     
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4) 
		{
			if (xmlhttp.status == 200) 
			{	
				var resp=xmlhttp.responseText;
				if(resp == '1')
				{
					document.getElementById('td_answer_'+qid+'_'+oid).className = "correct";
					document.getElementById('answericon_'+qid+'_'+oid).innerHTML = "<img src='images/quiz-correct.gif' align='absmiddle' />";
					var cnt = parseInt(document.getElementById('ttlcorrans').value);
					cnt = cnt + 1;
					//alert(cnt);
					document.getElementById('ttlcorrans').value=cnt;
					/*var ttl = document.getElementById('ttlques').value;
					document.getElementById('quizscore').innerHTML = "Score = <span style='font-size:26px;'><span style='color:#16972b;'>"+cnt+"</span>/<span style='color:#9e2023;'>"+ttl+"</span></span>";*/
					
				}
				else
				{
					document.getElementById('td_answer_'+qid+'_'+oid).className = "incorrect";
					document.getElementById('answericon_'+qid+'_'+oid).innerHTML = "<img src='images/quiz-wrong.gif' align='absmiddle' />";
				}
			}
		}
	}
	// Send the POST request
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send('qid='+qid+'&oid='+oid);	
}

/******************** Downloads *****************************/

function openImage(of,n)
{
	var msg="Getting Image...";
	getoverlayloader(msg);
	document.getElementById("lightbox").innerHTML="";
	document.getElementById("lightbox_comm").innerHTML="<table border='0' cellspacing='0' cellpadding='10' style='border:1px solid #efefef;background:#ffffff;'> <tr> <td align='right'><a href='javascript:hideoverlayloader1();'>x</a></td> </tr> <tr> <td><img src='images/downloads/"+of+"/"+of+n+".jpg'/></td> </tr> </table>";
	aligncenter_mod("lightbox_comm");
}

function hideoverlayloader1()
{
	if(document.getElementById("overlay"))	document.getElementById("overlay").style.display="none"	;
	
	if(document.getElementById("lightbox")) document.getElementById("lightbox").style.display="none"	;
	
	document.getElementById("lightbox_comm").innerHTML = "";
}


