// JavaScript Document

function adsearch(par2)
{ 
if(par2=="advance")
{
document.getElementById("advance").style.display='';
document.getElementById("advancelink").style.display='none';
}
else
{
document.getElementById("advance").style.display='none';
document.getElementById("advancelink").style.display='';
}
}


function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID");
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID");
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID");
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID");
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }

 		 return true;					
	}
	
function subscriber(){
var emailID=document.frmnewsletter.subscriber_email;

	if (document.frmnewsletter.subscriber_email.value==""){
		alert("Please Enter Your Email.");
		frmnewsletter.subscriber_email.focus();
		return false;
	}
	if (echeck(emailID.value)==false){
		
			emailID.value="";
			emailID.focus();
			return false;
	}
return true;
}
function printThis(){
	window.print();
	window.close();
}

var stdOptions = "resizable=yes,directories=no,left=10,top=10,toolbar=no,status=no,location=no,menubar=no";

function opennewsemail(id){
	
		var url  = "news_email_form.php?news_id=" + id; //modules/imagegallery/
        var options = stdOptions + ",width=400,height=300,scrollbars=yes"; 
        window.open(url,"email",options); 
}

function PrintNews(id){
	var options = stdOptions + ",width=350,height=350,scrollbars=yes"; 
	var ww=window.open('news_print.php?news_id='+ id,null,options);
}
function openlarge(id,id1,id2){
	
		var url  = "large_image.php?imgpath=" + id; //modules/imagegallery/
        var options = stdOptions + ",width="+ id1+",height="+id2+",scrollbars=yes"; 
        window.open(url,"image",options); 
}
function checkreview(){
	var emailID=document.frmreview.semail;
	if(document.frmreview.uname.value==""){
		alert("Please Enter Your Name");
		document.frmreview.uname.focus();
		return false;
	}
	if(document.frmreview.semail.value==""){
		alert("Please Enter Your Email Address");
		document.frmreview.semail.focus();
		return false;
	}
	if (echeck(emailID.value)==false){
		
			emailID.value="";
			emailID.focus();
			return false;
	}
	if(document.frmreview.reviewwords.value==""){
		alert("Please Enter Your Opinion");
		document.frmreview.reviewwords.focus();
		return false;
	}
	if(document.frmreview.prod_rate.value==""){
		alert("Please Select Rate");
		document.frmreview.prod_rate.focus();
		return false;
	}
	   return true;
}

function goback(gofor){
//alert(gofor);
if(gofor!="")
document.location.href=gofor;// + ".html"
}

function installcheck(){

var emailID=document.frminstall.admin_email;
var url=/(https?:\/\/)/gi;
	
	if(document.frminstall.dbhost.value==""){
		alert("Please Enter Database Host name");
		document.frminstall.dbhost.focus();
		return false;
	}
	if(document.frminstall.dbname.value==""){
		alert("Please Enter Database name");
		document.frminstall.dbname.focus();
		return false;
	}      
	/*if(document.frminstall.tbl_prefix.value==""){
		alert("Please Enter Table Prefix");
		document.frminstall.tbl_prefix.focus();
		return false;
	}*/
	if(document.frminstall.dbuser.value==""){
		alert("Please Enter Database User Name");
		document.frminstall.dbuser.focus();
		return false;
	}
	/*if(document.frminstall.dbpwd.value==""){
		alert("Please Enter Database User Password");
		document.frminstall.dbpwd.focus();
		return false;
	}*/
	if(document.frminstall.mod1.checked==false && document.frminstall.mod2.checked==false && document.frminstall.mod3.checked==false && document.frminstall.mod4.checked==false && document.frminstall.mod5.checked==false && document.frminstall.mod6.checked==false && document.frminstall.mod7.checked==false && document.frminstall.mod8.checked==false){
		alert("Please Select Atleast one module.");
		document.frminstall.mod1.focus();
		return false;
	}
	if(document.frminstall.admin_email.value==""){
		alert("Please Enter Site Admin Email");
		document.frminstall.admin_email.focus();
		return false;
	}
	if (echeck(emailID.value)==false){
		
			emailID.value="";
			emailID.focus();
			return false;
	}
	if(document.frminstall.admin_uid.value==""){
		alert("Please Enter Admin User ID");
		document.frminstall.admin_uid.focus();
		return false;
	}
	if(document.frminstall.admin_pwd.value==""){
		alert("Please Enter Admin User Password");
		document.frminstall.admin_pwd.focus();
		return false;
	}
	if(document.frminstall.script_path_actual.value==""){
		alert("Please Enter Cms Physical Path");
		document.frminstall.script_path_actual.focus();
		return false;
	}
	if(document.frminstall.script_path_url.value==""){
		alert("Please Enter Cms Virtual Path(URL)");
		document.frminstall.script_path_url.focus();
		return false;
	}
	 if (document.frminstall.script_path_url.value.search(url)==-1) {
		 	alert("Not a Valid URL(Please Enter Full URL)");
          	document.frminstall.script_path_url.focus();
         	return false;
			}
	
return true;	
}

function submitcategory(){
	document.frmfaqcat.submit();
}

function ShowAns(num){
if(document.getElementById('ans'+num).style.display == "none"){
document.getElementById('ans'+num).style.display = "";
}
else{
document.getElementById('ans'+num).style.display = "none";
}
}

function faqcheck(){
	if(document.searchfaq.faqkey.value==""){
		alert("Please Enter Search Text");
		document.searchfaq.faqkey.focus();
		return false;
	}
	return true;
}
function installcheck2(){

	if(document.frminstall2.lfileno.value==""){
		alert("Please Enter Your Licence No.");
		document.frminstall2.lfileno.focus();
		return false;
	}
	      
	return true;
}	

function checknews(){
var emailID=document.frmnewsmail.fromemail;

	if(document.frmnewsmail.fromemail.value==""){
		alert("Please Enter From Email address");
		document.frmnewsmail.fromemail.focus();
		return false;
	}
	if (echeck(emailID.value)==false){
		
			emailID.value="";
			emailID.focus();
			return false;
	} 
	var emailID=document.frmnewsmail.toemail;

	if(document.frmnewsmail.toemail.value==""){
		alert("Please Enter To Email address");
		document.frmnewsmail.toemail.focus();
		return false;
	}
	/*if (echeck(emailID.value)==false){
		
			emailID.value="";
			emailID.focus();
			return false;
	} */
	if(document.frmnewsmail.subject.value==""){
		alert("Please Enter Subject");
		document.frmnewsmail.subject.focus();
		return false;
	}     
	return true;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0		
//alert(eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"));
//  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	var t;
	var x
	t=selObj.options[selObj.selectedIndex].value;
	x=t.substring(0,4);
	eval(targ+".location='"+x+"'");
	if (restore) selObj.selectedIndex=0;
}

function MM_pjumpMenu(targ,selObj,restore){ //v3.0		
//alert(eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"));
//  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	var t;
	var x
	t=selObj.options[selObj.selectedIndex].value;
	//x=t.substring(0,4);
	eval(targ+".location='"+t+"'");
	if (restore) selObj.selectedIndex=0;
}