//////////////////////////////////////////////
//		KoolPassion.com
//		Script File 16-06-2010
//////////////////////////////////////////////
function checkLogin(){
	var uname ="";
	error =0;
	if (document.login.username.value=="") {
			document.login.username.style.background='#e0023f';
			uname = "Enter User Name";
			error =1;			
	}else{
		document.login.username.style.background='#FFF';
	}
	if (document.login.passwd.value=="") {
			document.login.passwd.style.background='#e0023f';
			var passw = "Please Enter Password";
			error =1;			
	}else{
		document.login.passwd.style.background='#FFF';
	}
if(error==1){
	//document.getElementById("loginError").style.display='block';
	document.getElementById("loginError").focus();
	document.getElementById("loginError").innerHTML="<div id=\"system-message\"><dd class=\"error\"><ul><li>" + uname + "</li><li>" + passw + "</li></ul></dd></div>";
	
	return false;
	}

return true;	
	
}
///////////////////////////////////////////////////////////////////
function checkIt(evt) 
	{
		evt = (evt) ? evt : window.event
		var charCode = (evt.which) ? evt.which : evt.keyCode
			if (charCode > 31 && (charCode < 48 || charCode > 57)) 
				{
				//alert("Mobile number can only be numbers.");
				return false
				}
		return true
	}
function checkItCharac(evt) 
	{
		evt = (evt) ? evt : window.event
		var charCode = (evt.which) ? evt.which : evt.keyCode
		if (charCode > 31 && (charCode >= 65 || charCode <= 90) || (charCode >= 97 || charCode <= 122)) 
			{
			//alert("Mobile number can only be numbers.");
			return false
			}
		return true
	}
//////////////////////////////////////////////////////////////////////////////////////
//// Comments Form Check
function FrmComments(){
	var error =0;
	var name ="";
	var email="";
	var contact ="";
	var commts ="";
	var vercode="";
	if (document.comments.name.value=="") {
			document.comments.name.style.background='#FF0000';
			name = "<li>Enter Your Name !</li>";
			error =1;			
	}else{
		document.comments.name.style.background='#FFF';
	}
	var emailchk = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	if (!emailchk.test(document.comments.email.value)) {
			document.comments.email.style.background='#FF0000';
			email = "<li>Please provide a valid email address!</li>";
			error =1;			
	}else{
		document.comments.email.style.background='#FFF';
	}
	if (document.comments.contact.value.length < 7) {
			document.comments.contact.style.background='#FF0000';
			contact = "<li>Enter Contact No. !</li>";
			error =1;			
	}else{
		document.comments.contact.style.background='#FFF';
	}
	
	if (document.comments.comment.value.length < 7) {
			document.comments.comment.style.background='#FF0000';
			commts = "<li>Enter Your Comments. !</li>";
			error =1;			
	}else{
		document.comments.comment.style.background='#FFF';
	}
	
	if ((document.comments.vercode.value.length < 6) || (document.comments.vercode.value.length > 6)) {
			document.comments.vercode.style.background='#FF0000';
			vercode = "<li>Enter Security Code !</li>";
			error =1;			
	}else{
		document.comments.vercode.style.background='#FFF';
	}

if(error==1){
	document.getElementById("ErrorBox").style.display='block';
	document.getElementById("ErrorBox").focus();
	document.getElementById("ErrorBox").innerHTML="<div id=\"system-message\"><dd class=\"error\"><ul>" + name + email + contact + commts + vercode +"</ul></dd></div>";

	return false;
	}

return true;	
}
//////////////////////////////////////////////////////////////////////////////////////
//// MOdle Pic Upload Form Check
function FrmModlePic(){
	var error =0;
	var name ="";
	var email="";
	var contact ="";
	var pic ="";
	var vercode="";
	if (document.modelpic.name.value=="") {
			document.modelpic.name.style.background='#FF0000';
			name = "<li>Enter Your Name !</li>";
			error =1;			
	}else{
		document.modelpic.name.style.background='#FFF';
	}
	if (document.modelpic.contact.value.length < 7) {
			document.modelpic.contact.style.background='#FF0000';
			contact = "<li>Enter Contact No. !</li>";
			error =1;			
	}else{
		document.modelpic.contact.style.background='#FFF';
	}
	var emailchk = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	if (!emailchk.test(document.modelpic.email.value)) {
			document.modelpic.email.style.background='#FF0000';
			email = "<li>Please provide a valid email address!</li>";
			error =1;			
	}else{
		document.modelpic.email.style.background='#FFF';
	}
	
	var fileName = document.modelpic.mpic.value.toLowerCase();
	if (document.modelpic.mpic.value=="") {
			document.modelpic.mpic.style.background='#FF0000';
			pic = "<li>Select Pic !</li>";
			error =1;			
	}else if(	(fileName.indexOf('.jpeg') != -1) ||
		(fileName.indexOf('.jpg') != -1)) {
			document.modelpic.mpic.style.background='#FFF';
	}else{
		
		document.modelpic.mpic.style.background='#FF0000';
			pic = "<li>Select Your Pic Jpg Only !</li>";
			error =1;
	}
	
	if ((document.modelpic.vercode.value.length < 6) || (document.modelpic.vercode.value.length > 6)) {
			document.modelpic.vercode.style.background='#FF0000';
			vercode = "<li>Enter Security Code !</li>";
			error =1;			
	}else{
		document.modelpic.vercode.style.background='#FFF';
	}

if(error==1){
	document.getElementById("ErrorBox").style.display='block';
	document.getElementById("ErrorBox").focus();
	document.getElementById("ErrorBox").innerHTML="<div id=\"system-message\"><dd class=\"error\"><ul>" + name + contact + email + pic + vercode +"</ul></dd></div>";

	return false;
	}

return true;	
}
///////////////////////////////////////////////////////////////////
//Disable right click script III- 
//For full source code, visit 
var message="No Dear";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
// --> 
//Disable select-text script (IE4+, NS6+)- By Andy Scott
//Exclusive permission granted to Dynamic Drive to feature script
/*function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")

//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
*/
/////Poll Poll Poll Poll Poll Poll Poll Poll Poll Poll Poll Poll Poll Poll 

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 getPoll(int)
	{
		xmlHttp=GetXmlHttpObject()
		// if browser not found
		if (xmlHttp==null)
		{
			 alert ("Browser does not support HTTP Request")
			 return
		 } 
		 // Server Url
		var url="include/poll.php"
		// Query string variable 
		var rand_no = Math.ceil(1000*Math.random())
		url=url+"?qid="+document.getElementById("qid").value+"&aid="+int+"&show="+rand_no;//+"&fname="+document.getElementById("txtFirstName").value+"&lname="+document.getElementById("txtLastName").value;
		// Call back function for check response state.
		xmlHttp.onreadystatechange=pollckh 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		
	}
	function pollckh() 
	{ 
		//document.getElementById("poll").innerHTML="<img src=images/loading.gif /><?php $_SESSION['poll']="+document.getElementById("qid").value+"; ?>";
		document.getElementById("poll").innerHTML="";
		
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			// Assign server reponse to div.
			
			 document.getElementById("poll").innerHTML=xmlHttp.responseText 
		 } 
	}

/*function getPoll(int)
{
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("poll").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","include/poll.php?vote="+int,true);
xmlhttp.send();
}
*/
/////////// Poll End Poll End Poll End Poll End Poll End 


function deleteAlert(name,id){
var conBox = confirm("Are you sure you want to delete: " + name);
if(conBox){ 
location.href="?idz="+ id + "&mode=remove";
}else{
return;
}
}
