
 function startList() {

	//code only for IE
	if(!document.body.currentStyle) return;
	var subs = document.getElementsByName('submenu');
	for(var i=0; i<subs.length; i++) {
		var li = subs[i].parentNode;
		if(li && li.lastChild.style) {
			li.onmouseover = function() {
				this.lastChild.style.visibility = 'visible';
			}
			li.onmouseout = function() {
				this.lastChild.style.visibility = 'hidden';
			}
		}
	}
}

if (document.all || document.getElementById)
	window.onload= function (){
	startList();
}
function payment_validate(){
	
	
	 	 if (document.form_general.varemailadd.value== "" )
		 { 
			 alert ("Please Enter The Paypal Email Address");
			 document.frm_payment.varemailadd.focus();
			 return false;
		 }
	 	
}
//script for login validation 
function login_validation()
{
		 if (document.Login.txtUsername.value== "" )
		 { 
			 alert ("Please enter the User name");
			 document.Login.txtUsername.focus();
			 return false;
		 }
		 if (document.Login.txtPassword.value== "" )
		 { 
			 alert ("Please enter the Password");
			document.Login.txtPassword.focus();
			 return false;
		 }
}
//script for Subscriber validation 
function subscriber_validation()
{
		 if (document.CustomersForm.varName.value== "" )
		 { 
			 alert ("Please Enter your Name");
			 document.CustomersForm.varName.focus();
			 return false;
		 }
		 if (document.CustomersForm.varEmail.value== "" )
		 { 
			 alert ("Please Enter Your E-mail Address");
			 document.CustomersForm.varEmail.focus();
			 return false;
		 }
		  if (!validateEmail(document.CustomersForm.varEmail.value,1,1)) 
		 {
		 document.CustomersForm.varEmail.focus();
		 return false;
		 }
		
}
//script for Breaking News validation 
function frm_faq_validate()
{
		 if (document.frmproduct.Question.value== "" )
		 { 
			 alert ("Please Enter The Question");
			 document.frmproduct.Question.focus();
			 return false;
		 }
		  if (document.frmproduct.Answer.value== "" )
		 { 
			 alert ("Please Enter The Answer ");
			 document.frmproduct.Answer.focus();
			 return false;
		 }
		   if (document.frmproduct.Status.value== "" )
		 { 
			 alert ("Please Select The Status ");
			 document.frmproduct.Status.focus();
			 return false;
		 }
	}

//script for settnigs validation
function account_validate()
{
         var  txtCompany= document.frm_accountinfo.txtCompany.value;
		 if ( txtCompany== "" )
		 { 
			 alert ("Please enter the Name of the Company");
			 document.frm_accountinfo.txtCompany.focus();
			 return false;
		 }
         var  txtContact= document.frm_accountinfo.txtContact.value;
		 if ( txtContact== "" )
		 { 
			 alert ("Please enter  the Contact Person");
			 document.frm_accountinfo.txtContact.focus();
			 return false;
		 }
		 if (document.frm_accountinfo.txtEmail.value == "")
		 { 
			 alert ("Please enter the Email ");
			 document.frm_accountinfo.txtEmail.focus();
			 return false;
		 }
		 if (!validateEmail(document.frm_accountinfo.txtEmail.value,1,1)) 
		 {
		  document.frm_accountinfo.txtEmail.value="";
		 document.frm_accountinfo.txtEmail.focus();
		 return false;
		 }
	
		 var txtadminpage= document.frm_accountinfo.txtadminpage.value;
		 if (txtadminpage == "" )
		 { 
			 alert ("Please enter  the Admin Page Title");
			 document.frm_accountinfo.txtadminpage.focus();
			 return false;
		 }
	
		 var txthomepage= document.frm_accountinfo.txthomepage.value;
		 if (txthomepage== "" )
		 { 
			 alert ("Please enter  the Home Page Title");
			 document.frm_accountinfo.txthomepage.focus();
			 return false;
		 }
		 	 var intRows= document.frm_accountinfo.intRows.value;
		 if (intRows== "" )
		 { 
			 alert ("Please enter the No of Rows Displayed per page");
			 document.frm_accountinfo.intRows.focus();
			 return false;
		 }
		 if (isNaN(document.frm_accountinfo.intRows.value))
		 { 
			 alert ("No of Rows must be Numeric");
			 document.frm_accountinfo.intRows.value="";
			 document.frm_accountinfo.intRows.focus();
			 return false;
		 }
		 if((intRows.indexOf("-") >= 0))
				{
					alert("Type the valid Number");
			 document.frm_accountinfo.intRows.value="";
			 document.frm_accountinfo.intRows.focus();
							return false;
				}
		if((intRows.indexOf(".") >= 0))
				{
					alert("Type the valid Number");
			 document.frm_accountinfo.intRows.value="";
			 document.frm_accountinfo.intRows.focus();
							return false;
				}
	 var Datedisp= document.frm_accountinfo.Datedisp.value;
		 if (Datedisp== "select" )
		 { 
			 alert ("Please enter the Date format");
			 document.frm_accountinfo.Datedisp.focus();
			 return false;
		 }
		 
	}
// To Validate Password Field in changepassword file
function pass_validate()
{
	     var Old = document.frm_change.Old.value;
		 if (Old == "" )
		 { 
			 alert ("Please enter Your Old Password");
			 document.frm_change.Old.focus();
			 return false;
		 }
		 var Password = document.frm_change.Password.value;
		 if (Password == "" )
		 { 
			 alert ("Please enter Your New Password");
			 document.frm_change.Password.focus();
			 return false;
		 }
		 var Conpassword = document.frm_change.Conpassword.value;
		 if (Conpassword == "" )
		 { 
			 alert ("Please enter Your Confirm Password");
			 document.frm_change.Conpassword.focus();
			 return false;
		 }
		 var Conpassword = document.frm_change.Conpassword.value;
		 if (document.frm_change.Conpassword.value != document.frm_change.Password.value)
		 { 
			 alert ("Password and Confirm Password must be same");
			document.frm_change.Conpassword.value="";
			 document.frm_change.Conpassword.focus();
			 return false;
		 }
}

//Banner Validation
function banner_validation(val,val1)
{

/*if (document.bannerForm.Adposition.value== "" ) { 
alert("Please enter the Ads Position ");
document.bannerForm.Adposition.focus();
return false;
}*/
if (document.bannerForm.varBannername.value== "" ) { 
alert("Please enter the Banner Title ");
document.bannerForm.varBannername.focus();
return false;
}

// set var radio_choice to false
var radio_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0;  counter < document.bannerForm.bannerads.length; counter++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
if (document.bannerForm.bannerads[counter].checked)
radio_choice = true; 
var chackbox_val=document.bannerForm.bannerads[counter].value;

}
if (!radio_choice)
{
// If there were no selections made display an alert box 
alert("Please select a Banner file options.")
return (false);
	}else if(radio_choice){
		for (counter = 0;  counter < document.bannerForm.bannerads.length; counter++)
		{
		
			if (document.bannerForm.bannerads[counter].checked){
				if(document.bannerForm.bannerads[counter].value=="google"){
				if (document.bannerForm.VarGoogleads.value== "" ) { 
							alert("Please enter the Google Ads Script");
							document.bannerForm.VarGoogleads.focus();
							return false;
						}
				
					}
				if(val1!="imageads"){
				if(document.bannerForm.bannerads[counter].value=="imageads"){
					if(val!="Update"){
				if (document.bannerForm.varUploadBannerimg.value== "" ){ 
									alert("Please Upload the Banner Image");
									document.bannerForm.varUploadBannerimg.focus();
									return false;
								}
					}
					if (document.bannerForm.varBannerlink.value== "" ){ 
									alert("Please Enter the Banner Link");
									document.bannerForm.varBannerlink.focus();
									return false;
								}

					}
				 }
			}
		}
	}
	 
}



//
function calldel(m)
{
  if(!confirm(m))
  {
    return false;
  }
  else
  return true;
}
function calldelno(m)
{
	
  if(alert(m))
  {
    return false;
  }
 return false;
}
// Valid Email  Script
function validateEmail(addr,man,db) {
	if (addr == '' && man) {
	   if (db) alert('Email address is mandatory');
	   return false;
	}
	var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
	for (i=0; i<invalidChars.length; i++) {
	   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
		  if (db) alert('Email address contains invalid characters');
		  return false;
	   }
	}
	for (i=0; i<addr.length; i++) {
	   if (addr.charCodeAt(i)>127) {
		  if (db) alert("Email address contains non ascii characters.");
		  return false;
	   }
	}

	var atPos = addr.indexOf('@',0);
	if (atPos == -1) {
	   if (db) alert('Email address must contain an @');
	   return false;
	}
	if (atPos == 0) {
	   if (db) alert('Email address must not start with @');
	   return false;
	}
	if (addr.indexOf('@', atPos + 1) > - 1) {
	   if (db) alert('Email address must contain only one @');
	   return false;
	}
	if (addr.indexOf('.', atPos) == -1) {
	   if (db) alert('Email address must contain a period in the domain name');
	   return false;
	}
	if (addr.indexOf('@.',0) != -1) {
	   if (db) alert('period must not immediately follow @ in email address');
	   return false;
	}
	if (addr.indexOf('.@',0) != -1){
	   if (db) alert('period must not immediately precede @ in email address');
	   return false;
	}
	if (addr.indexOf('..',0) != -1) {
	   if (db) alert('two periods must not be adjacent in email address');
	   return false;
	}
	var suffix = addr.substring(addr.lastIndexOf('.')+1);
	if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
	   if (db) alert('invalid primary domain in email address');
	   return false;
	}
return true;
}




function calendarCallbackleft2(date, month, year)
	{

		if(date<10) date="0"+date;
		if(month<10) month="0"+month;
		date = year + '-' + month + '-' + date;
		
		document.frm_addadver.VarPostDate.value = date;
	
	}
function calendarCallbackleft(date, month, year)
	{

		if(date<10) date="0"+date;
		if(month<10) month="0"+month;
		date = year + '-' + month + '-' + date;
		
		document.frm_addadver.VarExpDate.value = date;
	
	}

function transfrm()

{
 if (document.tran_frm.Varname.value== "" )

		 { 

			 alert ("Please Enter the Name");

			 document.tran_frm.Varname.focus();

			 return false;

		 }
			 if (document.tran_frm.Varemail.value== "" )

		 { 

			 alert ("Please Enter Your E-mail Address");

			 document.tran_frm.Varemail.focus();

			 return false;

		 }

		  if (!validateEmail(document.tran_frm.Varemail.value,1,1)) 

		 {

		 document.tran_frm.Varemail.focus();

		 return false;

		 }
		
		 		 if (document.tran_frm.Subject.value== "" )

		 { 

			 alert ("Please Enter the Subject");

			 document.tran_frm.Subject.focus();

			 return false;

		 }
 if (document.tran_frm.Message.value== "" )

		 { 

			 alert ("Please Enter Your Comments");

			 document.tran_frm.Message.focus();

			 return false;

		 }

}

function validateno()

{
	
	if((event.keyCode<48) || (event.keyCode>58))
	{
		if(event.keyCode!=13 && event.keyCode!=46)
		{
			event.keyCode=0;
			alert("Enter Numeric Value");		
	}
	}
}

function addcat_validate(value){
	 if (document.frm_addcat.txtCatname.value== "" )
		 { 
			 alert ("Please enter the Category Name");
			 document.frm_addcat.txtCatname.focus();
			 return false;
		 }

	
}
function  contactfrm(){
	var Name=document.frm_contact.varName.value;
if(Name=="")
{
alert("Please enter the Full Name");
document.frm_contact.varName.focus();
return false;
}
 if (document.frm_contact.VarEmail.value== "" )

		 { 

			 alert ("Please Enter Your E-mail Address");

			 document.frm_contact.VarEmail.focus();

			 return false;

		 }

		  if (!validateEmail(document.frm_contact.VarEmail.value,1,1)) 

		 {

		 document.frm_contact.VarEmail.focus();

		 return false;

		 }
}




function TextAreaLimit() {
	// Replace 'TheTextField' with the id of
	// your text area.
	var sTextArea 	= document.getElementById('VarBriefDescrip');
 
	// Replace 'RemainingChars' with the id of
	// a <span> or <div> which you want to hold
	// the remaining chars.
	var sNotifyArea = document.getElementById('RemainingChars');
 
	// Change the value here for the maximum
	// number of characters that are allowed.
	var iMaxChars 	= 300;
 
	if (sTextArea.value.length > iMaxChars){
		sTextArea.value = sTextArea.value.substring(0, iMaxChars);
	}else{
		sNotifyArea.innerHTML = iMaxChars - sTextArea.value.length;
	}
}

function page_validation(){
	var subpagename=document.cms.Heading.value;
if(subpagename=="")
{
alert("Please Enter the Heading");
document.cms.Heading.focus();
return false;
}
}

function addprod_validate(){

		 if (document.frm_addprod.txtproductname.value== "" )

		 { 

			 alert ("Please Enter the File Name");

			 document.frm_addprod.txtproductname.focus();

			 return false;

		 }


		 if (document.frm_addprod.largeimg.value== "" )

		 { 

			 alert ("Please Upload the  File");

			 document.frm_addprod.largeimg.focus();

			 return false;

		 } 
	
	

}
