function checkdel1()
{
	if(confirm("Are you sure to delete?")){
		
		return true;
	}
	else {
		return false;
	}
}

////Categories add validation function
function change_password()
{
	if(document.frm3.old_password.value=="")
					{
				       alert("Please enter Old Password");
				       document.frm3.old_password.focus();
					    return false;
					}
	if(document.frm3.new_password.value=="")
					{
				       alert("Please enter New Password");
				       document.frm3.new_password.focus();
					    return false;
					}
	if(document.frm3.retype_password.value!=document.frm3.new_password.value)
					{
				        alert("Password Mismatch");
						document.frm3.retype_password.value="";
						document.frm3.new_password.value="";
				        document.frm3.new_password.focus();
					    return false;
					}
}

function validate_classified_add()
{
			
			if(document.add_clssi_frm.title.value=="")
					{
				       alert("Please enter title");
				       document.add_clssi_frm.title.focus();
					    return false;
					}

			 
	
             if(document.add_clssi_frm.price.value=="")
					{
				       alert("Please enter price");
				       document.add_clssi_frm.price.focus();
					    return false;
					}

			else if(isNaN(document.add_clssi_frm.price.value))
					{
					alert("Enter numeric value for Price.")
						document.add_clssi_frm.price.value="";
					document.add_clssi_frm.price.focus();
					    return false;
					}

			if(document.add_clssi_frm.company.value=="")
					{
				       alert("Please enter company");
				       document.add_clssi_frm.company.focus();
					    return false;
					}

			if(document.add_clssi_frm.description.value=="")
					{
				       alert("Please enter brief description");
				       document.add_clssi_frm.description.focus();
					    return false;
					}

			if(document.add_clssi_frm.contactname.value=="")
					{
				       alert("Please enter name");
				       document.add_clssi_frm.contactname.focus();
					    return false;
					}

			
}
function validate_classified_edit()
{
			
			if(document.frm2.title.value=="")
					{
				       alert("Please enter title");
				       document.frm2.title.focus();
					    return false;
					}

			 
	
             if(document.frm2.price.value=="")
					{
				       alert("Please enter price");
				       document.frm2.price.focus();
					    return false;
					}

			else if(isNaN(document.frm2.price.value))
					{
					alert("Enter numeric value for Price.")
						document.frm2.price.value="";
					document.frm2.price.focus();
					    return false;
					}

			if(document.frm2.company.value=="")
					{
				       alert("Please enter company");
				       document.frm2.company.focus();
					    return false;
					}

			if(document.frm2.description.value=="")
					{
				       alert("Please enter brief description");
				       document.frm2.description.focus();
					    return false;
					}

			if(document.frm2.contact_name.value=="")
					{
				       alert("Please enter name");
				       document.frm2.contactname.focus();
					    return false;
					}

			
}

//Login validation function
function validate_login()
		{
			if(document.login_frm.login_username.value=="")
					{
				       alert("Please enter username");
				       document.login_frm.login_username.focus();
					    return false;
					}
             if(document.login_frm.login_pass.value=="")
					{
				       alert("Please enter password");
				       document.login_frm.login_pass.focus();
					    return false;
					}
			if(document.login_frm.login_username.value!="")
		{
	var emailStr;
	emailStr=document.login_frm.login_username.value;
	
var checkTLD=1;


var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;



var emailPat=/^(.+)@(.+)$/;



var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";


var validChars="\[^\\s" + specialChars + "\]";


var quotedUser="(\"[^\"]*\")";


var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;


var atom=validChars + '+';


var word="(" + atom + "|" + quotedUser + ")";


var userPat=new RegExp("^" + word + "(\\." + word + ")*$");


var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");



var matchArray=emailStr.match(emailPat);

if (matchArray==null) {


alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];


for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Ths username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
return false;
   }
}


if (user.match(userPat)==null) {


alert("The username doesn't seem to be valid.");
return false;
}


var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {


for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}

 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("The domain name does not seem to be valid.");
return false;
   }
}


if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}


if (len<2) {
alert("This address is missing a hostname!");
return false;
}

//return true;
}			
           return true;
		}

//Registration first validate function

function register_first()
		{
            if(document.regist_frm.email.value=="")
					{
				       alert("Please enter your email-id");
				       document.regist_frm.email.focus();
					    return false;
					}
            if(!validate_email(document.regist_frm.email.value))
				{
				    return false;
				}
				  
           return true;
		}


function forgot_pass()
		{
            if(document.forgotpass.email.value=="")
					{
				       alert("Please enter your email-id");
				       document.forgotpass.email.focus();
					    return false;
					}
            if(!validate_email(document.forgotpass.email.value))
				{
				    return false;
				}
				  
           return true;
		}


//Mail validate function

function validate_email(mail)
	{
		var error=0;
		if(mail!="")
		{
	var emailStr;
	emailStr=mail;
	
var checkTLD=1;


var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;



var emailPat=/^(.+)@(.+)$/;



var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";


var validChars="\[^\\s" + specialChars + "\]";


var quotedUser="(\"[^\"]*\")";


var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;


var atom=validChars + '+';


var word="(" + atom + "|" + quotedUser + ")";


var userPat=new RegExp("^" + word + "(\\." + word + ")*$");


var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");



var matchArray=emailStr.match(emailPat);

if (matchArray==null) {


alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];


for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Ths username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
return false;
   }
}


if (user.match(userPat)==null) {


alert("The username doesn't seem to be valid.");
return false;
}


var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {


for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}

 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("The domain name does not seem to be valid.");
return false;
   }
}


if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}


if (len<2) {
alert("This address is missing a hostname!");
return false;
}

return true;
}

}


function email_check(email){
	if(email=="")
	{ 
		return false;	
	}

	if(email!="")
	{
		var space=email.indexOf(" ",0)
		var num=email.indexOf("@",0)
		var num1=email.indexOf(".",0)
		var ch=email.charAt(num+1);
		var ch1=email.charAt(num1+1);

		if(space >=0 || num < 0 || num1 < 0 || ch=="" || ch=="." || ch1 =="")
		{
			return false;
		}
	}
	return true;
}


function validate_registraion()
{
	if(document.regist_frm.has_mms_service.checked)
	{
		if(document.regist_frm.mobile_number.value == "")
		{
			alert("Please enter your mobile number.");
			document.regist_frm.mobile_number.focus();
			return false;
		}
		if(isNaN(document.regist_frm.mobile_number.value))
		{
			alert("Moobile number must be number.");
			document.regist_frm.mobile_number.value="";
			document.regist_frm.mobile_number.focus();
			return false;
		}
	}
	if(document.regist_frm.fname.value == "")
	{
		alert("Please enter your screen name");
		document.regist_frm.fname.focus();
		return false;
	}
	
/* if(document.regist_frm.lname.value=="")
{
   alert("Please enter your last name");
   document.regist_frm.lname.focus();
	return false;
}
*/
/*if(document.regist_frm.cname.value=="")
	{
		alert("Please enter your company name");
		document.regist_frm.cname.focus();
		return false;
	}
	if(document.regist_frm.address.value=="")
	{
		alert("Please enter your address");
		document.regist_frm.address.focus();
		return false;
	}
	if(document.regist_frm.telephone.value=="")
	{
		alert("Please enter your telephone no.");
		document.regist_frm.telephone.focus();
		return false;
	}
*/
	if(document.regist_frm.pass.value=="")
	{
		alert("Please enter your Password");
		document.regist_frm.pass.focus();
		return false;
	}
	if(document.regist_frm.pass1.value=="")
	{
		alert("Please re-enter your Password");
		document.regist_frm.pass1.focus();
		return false;
	}

	if(document.regist_frm.pass1.value!=document.regist_frm.pass.value)
	{
		alert("Passwords doesnot match");
		document.regist_frm.pass1.select();
		document.regist_frm.pass1.focus();
		return false;
	}
	if(!email_check(document.regist_frm.email.value))
	{
		alert("Please enter your Email");
		document.regist_frm.email.focus();
		return false;
	}

	var optInd = document.regist_frm.under_group.selectedIndex;
	if(optInd==0){
		alert("Please Select Valid Membership Plan");
		//document.regist_frm.under_group.select();
		//document.regist_frm.under_group.focus();
		return false;
	}
	
/*
	if(!document.regist_frm.terms[1].checked)
	{
		alert('You can not join if you do not agree with terms and conditions, Rules & Disclaimer.');
		return false;
	}
*/
return true;
}



/////////////////NEW WINDOW SCRIPT FOR LOGIN
/*function openLogin(S)
{
	var win4 = window.open('login.php?page='+S,'pop','width=550,height=300,scrollbars=no');
	win4.focus();
}*/

/*function openLogin(S)
{
	var win = window.open('login.php?page='+S,'pop','width=550,height=300,scrollbars=no');
	win.focus();
}*/
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}

function openCatalog(S)
{
	var win1 = window.open(S,'pop','width=700,height=500,scrollbars=no');
	win1.focus();
}

function openForgetPass()
{
	var win2 = window.open('forgotpass.php','pop','width=500,height=300,scrollbars=no');
	win2.focus();
}

//KnowFish Search checking validation

function chk_search()
{
	if(document.frm.fish_search.value=="Search your Fish !!!" || document.frm.fish_search.value=="")
		{
		    alert("Please enter a search text");
            document.frm.fish_search.focus();
			return false;
		}
   return true;
}


function openCatalog_Details()
{
	var cat = window.open('catalog_details.php','pop','width=700,height=550,scrollbars=no');
	cat.focus();
}

function validate_project_posting()
{
	if(document.add_clssi_frm.project_name.value=="")
		{
		  alert("Please enter a project name");
          document.add_clssi_frm.project_name.focus();
		  return false;
		}
    if(document.add_clssi_frm.addinfo.value=="")
		{
		  alert("Please enter a project description");
          document.add_clssi_frm.addinfo.focus();
		  return false;
		}
   return true;
}

function win_open(memberid,tmp)
{
//alert(memberid+"---"+tmp);
window.open('upload.php?tmp='+tmp+'&memberid='+memberid,'150x250','toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,width=500,height=400');

}

function win_open_proj(memberid,tmp,p_id)
{
//alert(memberid+"---"+tmp);
window.open('upload_proj.php?tmp='+tmp+'&memberid='+memberid,'150x250','toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,width=500,height=400');

}

function validate_message()
{
	if(document.frm.pvt_message.value=="")
		{
		  alert("Please enter the message.");
          document.frm.pvt_message.focus();
		  return false;
		}
		return true;
}

function checkdel()
{
	if(confirm("Are you sure to delete?")){
		return true;
	}
	else 
		return false;
	
}

function validate_portfolio()
		{
			if(document.add_portfolio.project_name.value=="")
					{
				       alert("Please enter project name");
				       document.add_portfolio.project_name.focus();
					    return false;
					}
             if(document.add_portfolio.project_description.value=="")
					{
				       alert("Please enter project description");
				       document.add_portfolio.project_description.focus();
					    return false;
					}
					
           return true;
		}

function validate_project_bid(dt,month,year)
{
	if(document.add_clssi_frm.year.value<year)
	{
		alert("Please confirm the year");
		return false;
	}
	else
	{
		if(document.add_clssi_frm.year.value==year)
		{
			if(document.add_clssi_frm.month.value<month)
			{
				alert("Please confirm the month");
				return false;
			}
			else
			{
				if(document.add_clssi_frm.month.value==month)
				{
				
					if(document.add_clssi_frm.day.value<dt)
					{
						alert("Please confirm the date");
						return false;
					}
				}
				
			}
		}
		
	}
	

	if(document.add_clssi_frm.amt.value=="")
	{
		alert("Please enter amount");
		document.add_clssi_frm.amt.focus();
		return false;
	}
	if(isNaN(document.add_clssi_frm.amt.value))
	{
		alert("Enter numeric value for Price.")
		document.add_clssi_frm.amt.value="";
		document.add_clssi_frm.amt.focus();
		return false;
	}
	if(document.add_clssi_frm.addinfo.value=="")
	{
		alert("Please enter bid description");
		document.add_clssi_frm.addinfo.focus();
		return false;
	}
	if(document.add_clssi_frm.amt.value<50)
	{
		alert("The minimum bid for this project is $50");
		document.add_clssi_frm.amt.focus();
		return false;
	}	
	if(document.add_clssi_frm.amt.value>3000000)
	{
		alert("The maximum bid for this project is $3000000");
		document.add_clssi_frm.amt.focus();
		return false;
	}

	
	
	
	return true;
}


function openHood()
{
	var win = window.open('openhood.php','pop','width=500,height=450,scrollbars=yes');
	win.focus();
}

function openOpenings()
{
	var win = window.open('openings.php','pop','width=500,height=450,scrollbars=yes');
	win.focus();
}

function openPlastic()
{
	var win = window.open('plastic.php','pop','width=500,height=450,scrollbars=yes');
	win.focus();
}

function openOverflow()
{
	var win = window.open('overflow.php','pop','width=500,height=450,scrollbars=yes');
	win.focus();
}

function openWater()
{
	var win = window.open('water.php','pop','width=500,height=450,scrollbars=yes');
	win.focus();
}

function openFiltration()
{
	var win = window.open('filtration.php','pop','width=500,height=450,scrollbars=yes');
	win.focus();
}

function openAccessories()
{
	var win = window.open('accessories.php','pop','width=500,height=450,scrollbars=yes');
	win.focus();
}

function openMedia()
{
	var win = window.open('media.php','pop','width=500,height=450,scrollbars=yes');
	win.focus();
}

function openCanopy()
{
	var win = window.open('canopy.php','pop','width=500,height=450,scrollbars=yes');
	win.focus();
}

function openStand()
{
	var win = window.open('stand.php','pop','width=500,height=450,scrollbars=yes');
	win.focus();
}

function openLighting()
{
	var win = window.open('lighting.php','pop','width=500,height=450,scrollbars=yes');
	win.focus();
}

function openWoodtype()
{
	var win = window.open('woodtype.php','pop','width=500,height=450,scrollbars=yes');
	win.focus();
}

function openCorals()
{
	var win = window.open('corals.php','pop','width=500,height=450,scrollbars=yes');
	win.focus();
}

function openFiltrationProcess()
{
	var filter = window.open('filtrationprocess.php','process','width=550,height=500,scrollbars=yes');
	filter.focus();
}

function unique_screen_name()
{
	if(document.frm3.screen_name.value=="")
					{
				       alert("Please enter screen name");
				       document.frm3.screen_name.focus();
					    return false;
					}
	return true;
}

function chk_feedback()
{
	if(document.add_portfolio.can_res.value=="")
					{
				       alert("Please enter your Feedback");
				       document.add_portfolio.can_res.focus();
					    return false;
					}
	return true;
}

function showBige(imageName, windowName, width, height)
{
  winB = window.open("big.html?path="+imageName,'winB',"width="+Number(width+30)+",height="+Number(height+60)+",left=17,top=17,statusbar=no,toolbar=no,scrollbars= yes,navbar=no");
  winB.focus();
}


function openRegHelp()
{
	var win20 = window.open('reghelp.php','pop1','width=550,height=300,scrollbars=no');
	win20.focus();
}

function validate_article()
	{
        if(document.post_article.name1.value=="")
			{
			     alert("Please enter your name.");
                 document.post_article.name1.focus();
				 return false;
			}
         if(document.post_article.email.value=="")
			{
			     alert("Please enter your email address.");
                 document.post_article.email.focus();
				 return false;
			}
         if(document.post_article.a_title.value=="")
			{
			     alert("Please enter your article title.");
                 document.post_article.a_title.focus();
				 return false;
			}
         if(document.post_article.comments.value=="")
			{
			     alert("Please enter your comments.");
                 document.post_article.comments.focus();
				 return false;
			}
          if(!validate_email(document.post_article.email.value))
			  return false;
return true;
	}


function openMemDet()
{
	var win21 = window.open('reg_memdet_pop.php','pop1','width=550,height=400,scrollbars=yes');
	win21.focus();
}

function openMMS_Help()
{
	var win22 = window.open('mms_howto_pop.php','pop1','width=550,height=400,scrollbars=yes');
	win22.focus();
}

function openMMS1_Help()
{
	var win23 = window.open('mms_howto_pop1.php','pop1','width=550,height=400,scrollbars=yes');
	win23.focus();
}

function openMMS2_Help(M)
{
	var win24 = window.open('mms_howto_pop2.php?mms_id='+M,'pop2','width=550,height=400,scrollbars=yes');
	win24.focus();
}
function moreinfo() { if
(this.document.all.moreinfo.style.display=="none")
(this.document.all.moreinfo.style.display="block") ;
else (this.document.all.moreinfo.style.display="none") ; 
} 
