//Admin Login
function loginval()
{
if(document.bigsfrm.username.value=="")
{
alert("Enter Admin UserID");
document.bigsfrm.username.focus();
return false;
}
if(document.bigsfrm.password.value=="")
{
alert("Enter Password");
document.bigsfrm.password.focus();
return false;
}
}
//Admin Chnage Password
function checkchangepass()
{
if(document.clchpass.oldpass.value=="")
{
alert ("Enter Old Password");
document.clchpass.oldpass.focus();
return false;
}


if(document.clchpass.oldpass.value!=document.clchpass.hpass.value)
{
alert ("Mismatch in Old Password");

document.clchpass.oldpass.focus();
return false;
}
//else
     //{
	 //  return true;
   //  }

if(document.clchpass.npass1.value=="")
{
alert ("Enter New Password");
document.clchpass.npass1.focus();
return false;
}
if(document.clchpass.npass2.value=="")
{
alert ("Enter  Con-Password");
document.clchpass.npass2.focus();
return false;
}
if(document.clchpass.npass1.value!=document.clchpass.npass2.value)
{
alert ("Mismatch in Password");
document.clchpass.npass1=="";
document.clchpass.npass2=="";
return false;
}
else
     {
	   return true;
     }
}

//Admin-Checkbox Validation
function CheckAll(s)
	{
		 temp = document.pdelete.elements.length  ;
         
    for (i=0; i < temp; i++)
		{       // alert(document.frm.elements[i].name)
		   document.pdelete.elements[i].checked=s;
	   	}

	}
	function invertSelection()
	{
	var temp
	temp=document.pdelete.elements.length;
		for (i=0;i<temp;i++)
		{
			if (document.pdelete.elements[i].checked==true)
				document.pdelete.elements[i].checked=false;
				else
				document.pdelete.elements[i].checked=true
		}
		}


//Image gallery

function imgview(nhead){ window.open('img_view.php?nhead='+nhead,"win40","toolbar=no,directories=no,resize=no,menubar=no,location=no,scrollbars=yes,width=600,height=430,maximize=null,top=50,left=300");}









//Admin- User Registration
function memval()
{
if(document.memfrm.user.value=="")
{
alert("Enter UserID, UserID should be a valid email ID");
document.memfrm.user.focus();
return false;
}

if(document.memfrm.user.value!="")
{
var data=document.memfrm.user.value;
var reg=/ /g;
if(data.indexOf('@')==-1|| data.indexOf('.')==-1)
     {
        alert("Check Your Email-id in correct format");
		document.memfrm.user.focus(); 
		return false
     }
else if((data.substring(0,data.indexOf("@")).replace(reg,""))=="" ||(data.substring(data.indexOf("@")+1,data.indexOf(".")).replace(reg,""))=="" || (data.substring(data.indexOf(".")+1,data.length).replace(reg,""))=="" ) 
	{
		alert("Check Your Email-id in correct format");
		document.memfrm.user.focus();  
		return false
	}
}

if(document.memfrm.pass.value=="")
{
alert("Enter Password");
document.memfrm.pass.focus();
return false;
}


if(document.memfrm.name.value=="")
{
alert("Enter your name");
document.memfrm.name.focus();
return false;
}

if(document.memfrm.phone.value=="")
{
alert("Enter your contact no");
document.memfrm.phone.focus();
return false;
}
}




//Client Validation
function cllogval()
{
if(document.cllogfrm.username.value=="")
{
alert("Enter UserID");
document.cllogfrm.username.focus();
return false;
}
if(document.cllogfrm.password.value=="")
{
alert("Enter Password");
document.cllogfrm.password.focus();
return false;
}
}



function newmemchk()
{
if(document.newmemfrm.txtemail.value=="")
{
alert("Enter UserID, UserID should be a valid email ID");
document.newmemfrm.txtemail.focus();
return false;
}

if(document.newmemfrm.txtemail.value!="")
{
var data=document.newmemfrm.txtemail.value;
var reg=/ /g;
if(data.indexOf('@')==-1|| data.indexOf('.')==-1)
     {
        alert("Check Your Email-id in correct format");
		document.newmemfrm.txtemail.focus(); 
		return false
     }
else if((data.substring(0,data.indexOf("@")).replace(reg,""))=="" ||(data.substring(data.indexOf("@")+1,data.indexOf(".")).replace(reg,""))=="" || (data.substring(data.indexOf(".")+1,data.length).replace(reg,""))=="" ) 
	{
		alert("Check Your Email-id in correct format");
		document.newmemfrm.txtemail.focus();  
		return false
	}
}

if(document.newmemfrm.txtpass.value=="")
{
alert("Enter Password");
document.newmemfrm.txtpass.focus();
return false;
}
var invalid = " "; // Invalid character is a space
var minLength = 6; // Minimum length
if (document.newmemfrm.txtpass.value.length < minLength) {
alert('Your password must be at least ' + minLength + ' characters long. Try again.');
document.newmemfrm.txtpass.focus();
return false;
}
if(document.newmemfrm.txtconpass.value=="")
{
alert("Enter Confirm Password");
document.newmemfrm.txtconpass.focus();
return false;
}
if(document.newmemfrm.txtconpass.value!=document.cadmlogin.txtpass.value)
{
alert ("Mismatch in Password");

document.newmemfrm.txtconpass.focus();
return false;
}


if(document.newmemfrm.name.value=="")
{
alert("Enter your name");
document.newmemfrm.name.focus();
return false;
}

if(document.newmemfrm.ph.value=="")
{
alert("Enter your contact no");
document.newmemfrm.ph.focus();
return false;
}
}




function forgot()
{ window.open('forgot_pass.php',"winpl1","toolbar=no,directories=no,resize=no,menubar=no,location=no,scrollbars=no,width=538,height=350,maximize=null,top=50,left=300");}

function checkfrgt()
{
if(document.frmfrgt.txtemail.value=="")
{
alert("Enter Email-Id(Username)");
document.frmfrgt.txtemail.focus();
return false;
}
}
function btview(nhead){ window.open('boat_view.php?nhead='+nhead,"win40","toolbar=no,directories=no,resize=no,menubar=no,location=no,scrollbars=yes,width=795,height=700,maximize=null,top=50,left=300");}
function subhm(){ window.open('msub_home.php',"win50","toolbar=no,directories=no,resize=no,menubar=no,location=no,scrollbars=yes,width=547,height=300,maximize=null,top=50,left=300");}
function newsview(nwhead){ window.open('news_view.php?nwhead='+nwhead,"win40","toolbar=no,directories=no,resize=no,menubar=no,location=no,scrollbars=yes,width=795,height=500,maximize=null,top=50,left=300");}
function eview(ehead){ window.open('events_view.php?ehead='+ehead,"win40","toolbar=no,directories=no,resize=no,menubar=no,location=no,scrollbars=yes,width=795,height=500,maximize=null,top=50,left=300");}
function enlarge1(nwid){ window.open('enlarge.php?nwid='+nwid,"win70","toolbar=no,directories=no,resize=no,menubar=no,location=no,scrollbars=no,width=465,height=460,maximize=null,top=50,left=300");}
function msgview(msgid){ window.open('message_view.php?msgid='+msgid,"win40","toolbar=no,directories=no,resize=no,menubar=no,location=no,scrollbars=yes,width=400,height=200,maximize=null,top=50,left=300");}
function msadview(msgadid){ window.open('mess_view.php?msgadid='+msgadid,"win40","toolbar=no,directories=no,resize=no,menubar=no,location=no,scrollbars=yes,width=400,height=200,maximize=null,top=50,left=300");}
function msgview1(msgid1){ window.open('message_view1.php?msgid1='+msgid1,"win40","toolbar=no,directories=no,resize=no,menubar=no,location=no,scrollbars=yes,width=400,height=200,maximize=null,top=50,left=300");}
function edit1(id){ window.open('client_ph_edit1.php?id='+id,"win40","toolbar=no,directories=no,resize=no,menubar=no,location=no,scrollbars=no,width=465,height=150,maximize=null,top=50,left=300");}
function nascc(){ window.open('conf.html',"win40","toolbar=no,directories=no,resize=no,menubar=no,location=no,scrollbars=no,width=620,height=397,maximize=null,top=50,left=300");}

function srbt()
{
if(document.frbt.btmake.value=="")
{
alert("Enter a value");
document.frbt.btmake.focus();
return false;
}
if(document.frbt.yr1.value=="")
{
alert("Enter Year for seacrh");
document.frbt.yr1.focus();
return false;
}
if(document.frbt.yr2.value=="")
{
alert("Enter Year for seacrh");
document.frbt.yr2.focus();
return false;
}
if(document.frbt.pr1.value=="")
{
alert("Enter Price for seacrh");
document.frbt.pr1.focus();
return false;
}
if(document.frbt.pr2.value=="")
{
alert("Enter Price for seacrh");
document.frbt.pr2.focus();
return false;
}
}
function srmm()
{

if(document.frmm.hobby.value=="")
{
alert("Enter Hobby");
document.frmm.hobby.focus();
return false;
}
if(document.frmm.ex1.value=="")
{
alert("Enter Year for seacrh");
document.frmm.ex1.focus();
return false;
}
if(document.frmm.ex2.value=="")
{
alert("Enter Experience for seacrh");
document.frmm.ex2.focus();
return false;
}

}