document.write("<script language='JavaScript' src='script/general.js'></script>");
document.write("<script language='JavaScript' src='script/popcalendar.js'></script>");
/*document.write("<script language='JavaScript' src='script/calendar.js'></script>");
*/document.write("<script language='JavaScript' src='script/calendar1.js'></script>");

//contains all javascript functions


/*
* Login page validation
*/
function validate_login(form)
{
	if(trim(form.username.value)=="")
	{
		alert("Please enter the username");
		form.username.focus();
		return false;
	}
	if(trim(form.password.value)=="")
	{
		alert("Please enter the password");
		form.password.focus();
		return false;
	}
}

function validate_login_auto(form)
{
	if(trim(form.username.value)=="")
	{
		alert("Please enter the username");
		form.username.focus();
		return false;
	}
	if(trim(form.username.value)!="")
	{
		if(!checkEmail(form.username.value)==true)
		{
		alert("Please enter a valid username");
		form.username.focus();
		return false;
		}
	}
	if(trim(form.password.value)=="")
	{
		alert("Please enter the password");
		form.password.focus();
		return false;
	}
}


/*
* Change Password page validation 
*/
function validate_changepassword(frm)
{
	if(trim(frm.opassword.value)=="")
	{
		alert("Please enter the old password ");
		frm.opassword.focus();
		return false;
	}
	
	if(trim(frm.npassword.value)=="")
	{
		alert("Please enter the new password");
		frm.npassword.focus();
		return false;
	}
	
	if(frm.npassword.value.length<6)
	{
		alert("Please enter atleast 6 charcters for new password");
		frm.npassword.focus();
		return false;
	}
	
	if(trim(frm.npassword.value)=="")
	{
		alert("Please enter the password");
		frm.npassword.focus();
		return false;
	}
	if(trim(frm.cpassword.value)=="")
	{
		alert("Please confirm the password");
		frm.cpassword.focus();
		return false;
	}
	if(trim(frm.npassword.value)!=trim(frm.cpassword.value))
	{
		alert("Confirm password must be same as new password");
		frm.cpassword.select();
		return false;
	}

return true;
}


/*
* Manage SIte COnfiguration Page Validation
*/
function validate_siteconfig(frm)
{  
	var ae =trim(frm.admin_email.value);
	var sae =trim(frm.sales_email.value);
	var sue =trim(frm.support_email.value);
	
	if(trim(frm.name.value)=="")
	{
		alert("Please enter the name ");
		frm.name.focus();
		return false;
	}
	
	isnum= isNaN(trim(frm.name.value))
	if(isnum!=true)
	{
		alert("Only numeric values are not accepted");
		frm.name.focus();
		return false;
	}
	
	if(trim(frm.url.value)=="")
	{
		alert("Please enter the URL ");
		frm.url.focus();
		return false;
	}
	if(!checkURL(frm.url.value))
	{ 
		alert("Please enter url as 'http://www.sitename.com'.");
	  	frm.url.focus();
		return false;
	}
	
	
	if(trim(frm.admin_email.value)=="")
	{
		alert("Please enter the admin email address");
		frm.admin_email.focus();
		return false;
	}
	if(checkEmail(ae)==false)
	{
		alert("Please enter the valid admin email address");
		frm.admin_email.focus();
		return false;
	}
	
	if(trim(frm.sales_email.value)=="")
	{
		alert("Please enter the sales email address  ");
		frm.sales_email.focus();
		return false;
	}
	if(checkEmail(sae)==false)
	{
		alert("Please enter a valid sales email address");
		frm.sales_email.focus();
		return false;
	}
	if(trim(frm.support_email.value)=="")
	{
		alert("Please enter the support email address");
		frm.support_email.focus();
		return false;
	}
	if(checkEmail(sue)==false)
	{
		alert("Please enter a valid support email address ");
		frm.support_email.focus();
		return false;
	}
	return true;
}


/*Validate for Edit Commission */ 
function validate_editaff(frm)
{	
	if(trim(frm.commision.value)=="")
	{
	  alert(" Please enter commission ");
	  frm.commision.focus();
	  return false;
	}
		else if(isNaN(frm.commision.value))
		{
			alert("Please enter only digits commission.");
			frm.commision.select();
			return false;
		}
		else if(frm.commision.value<=0)
		{
			alert("Please enter valid commission.");
			frm.commision.select();
			return false;
		}
	return true;
}
/*
* Validation For Shipping Cost Page
*/
/*function validate_shipcost(frm)
{
	if(trim(frm.first_item.value)=="")
	{
	  alert(" Please enter the first item cost ");
	  frm.first_item.focus();
	  return false;
	}
		else if(isNaN(frm.first_item.value))
		{
			alert("Please enter only digits for first item cost.");
			frm.first_item.select();
			return false;
		}
		else if(frm.first_item.value<=0)
		{
			alert("Please enter valid amount.");
			frm.first_item.select();
			return false;
		}
	if(trim(frm.additonal_item.value)=="")
	{
	  alert(" Please enter the extra items cost ");
	  frm.additonal_item.focus();
	  return false;
	}
		else if(isNaN(frm.additonal_item.value))
		{
			alert("Please enter only digits for extra items cost.");
			frm.additonal_item.select();
			return false;
		}
		else if(frm.additonal_item.value<=0)
		{
			alert("Please enter valid amount.");
			frm.additonal_item.select();
			return false;
		}
return true;
}*/
function validate_shipcost(frm)
{
	if(trim(frm.shippingtype.value)=="")
	{
	  alert(" Please enter the Shipping Type");
	  frm.shippingtype.focus();
	  return false;
	}
	if(trim(frm.additonal_item.value)=="")
	{
	  alert(" Please enter the amount for United States ");
	  frm.additonal_item.focus();
	  return false;
	}
		else if(isNaN(frm.additonal_item.value))
		{
			alert("Please enter only digits for United States.");
			frm.additonal_item.select();
			return false;
		}
		else if(frm.additonal_item.value<=0)
		{
			alert("Please enter valid amount for United States.");
			frm.additonal_item.select();
			return false;
		}
	if(trim(frm.international.value)=="")
	{
	  alert(" Please enter the amount for International");
	  frm.international.focus();
	  return false;
	}
		else if(isNaN(frm.international.value))
		{
			alert("Please enter only digits for International.");
			frm.international.select();
			return false;
		}
		else if(frm.international.value<=0)
		{
			alert("Please enter valid amount for International.");
			frm.international.select();
			return false;
		}
return true;
}

/*
* Add Category Page Validation
*/
function validate_addcat(frm)
{
	if(trim(frm.cat_name.value)=="")
	{
		alert("Please enter the category name");
		frm.cat_name.focus();
		return false;
	}
	
	if(trim(frm.image1.value)=="")
	{
		alert("Please select the category image");
		frm.image1.focus();
		return false;
	}
   if(frm.image1.value!="")
   {
		if(!checkFileType(frm.image1.value))
		{
			alert("Please select images of types .jpeg, .jpg, .png and .gif only");
			frm.image1.focus();
			return false;
		}
   }
	return true;
}

/*
* Edit category Page Validation
*/
function validate_editcat(frm)
{
	if(trim(frm.cat_name.value)=="")
	{
		alert("Please enter the category name");
		frm.cat_name.focus();
		return false;
	}
   if(frm.image1.value!="")
   {
		if(!checkFileType(frm.image1.value))
		{
			alert("Please select images of types .jpeg, .jpg, .png and .gif only");
			frm.image1.focus();
			return false;
		}
   }
   return true;
}


/*
* Show image in popup
*/
function show(winURL)
{
	winFeatures= "height=250,width=480";
	winName="test";
	url = "showimage.php?image="+winURL;
	theWin = window.open(url, winName, winFeatures);
	theWin.focus();
}


/*
*Validation for Add Faqs
*/

function  validate_addfaq(frm)
{
	if(trim(frm.question.value)=="")
	{
		alert("Please enter the faq question");
		frm.question.focus();
		return false;
	}
	if(trim(frm.answer.value)=="")
	{
		alert("Please enter the answer");
		frm.answer.focus();
		return false;
	}
	
return true;
}

/*
* Add product Page Validation
*/
/*function validate_addproduct(frm)
{
	if(trim(frm.product_name.value)=="")
	{
		alert("Please enter the product title");
		frm.product_name.focus();
		return false;
	}

	if(trim(frm.item_number.value)=="")
	{
		alert("Please enter the item number");
		frm.item_number.focus();
		return false;
	}
			
	if(isNaN(frm.item_number.value))
	{
		alert("Please enter only numerics in the item number field");
		frm.item_number.focus();
		return false;
	}

	if(trim(frm.image1.value)=="")
	{
		alert("Please select a product image");
		frm.image1.focus();
		return false;
	}

	imagepath= trim(frm.image1.value);
	if(checkFileType(imagepath)!=true)
	{
		alert("Please select images of types .jpg, .png and .gif only");
		frm.image1.select();
		return false;
	}

	if(trim(frm.image1_thumb.value)=="")
	{
		alert("Please select a product thumb image");
		frm.image1_thumb.focus();
		return false;
	}

	imagepath= trim(frm.image1_thumb.value);
	if(checkFileType(imagepath)!=true)
	{
		alert("Please select images of types .jpg, .png and .gif only");
		frm.image1_thumb.select();
		return false;
	}

	imagepath2 = trim(frm.image2.value);
	if(imagepath2!="")
	{
		if(checkFileType(imagepath2)!=true)
		{
			alert("Please select images of types .jpg, .png and .gif only");
			frm.image2.select();
			return false;
		}
	}

	imagepath3 = trim(frm.image3.value);
	if(imagepath3!="")
	{
		if(checkFileType(imagepath3)!=true)
		{
		alert("Please select images of types .jpg, .png and .gif only");
		frm.image3.select();
		return false;
		}
	}		

	imagepath4 = trim(frm.image4.value);
	if(imagepath4!="")
	{
		if(checkFileType(imagepath4)!=true)
		{
		alert("Please select images of types .jpg, .png and .gif only");
		frm.image4.select();
		return false;
		}
	}

	imagepath5 = trim(frm.image5.value);
	if(imagepath5!="")
	{
		if(checkFileType(imagepath5)!=true)
		{
		alert("Please select image of type .GIF or .JPG or .JPEG or .PNG formats only");
		frm.image5.select();
		return false;
		}
	}

	if(trim(frm.specification.value)=="")
	{
		alert(" Please enter the product specifications");
		frm.specification.focus();
		return false;
	}

	if(trim(frm.price.value)=="")
	{
		alert("Please enter the price");
		frm.price.focus();
		return false;
	}

  var price = trim(frm.price.value) ; 
	if(isNaN(price))
	{
		alert("Please enter a valid price");
		frm.price.select();
		return false;
	}
	if(price<=0)
	{
		alert("Please enter price more than 0 ");
		frm.price.select();
		return false;
	}
	return true;
}
*/

/* New Product Validation */
function validate_newaddproduct(frm)
{
	if(trim(frm.product_name.value)=="")
	{
		alert("Please enter the product name");
		frm.product_name.focus();
		return false;
	}

	/*if(trim(frm.item_number.value)=="")
	{
		alert("Please enter the item number");
		frm.item_number.focus();
		return false;
	}*/
			
	/*if(isNaN(frm.item_number.value))
	{
		alert("Please enter only numerics in the item number field");
		frm.item_number.focus();
		return false;
	}*/

	/*if(trim(frm.image1.value)=="")
	{
		alert("Please select a product image");
		frm.image1.focus();
		return false;
	}
*/
	if(trim(frm.image1.value)!="")
	{
		imagepath= trim(frm.image1.value);
		if(checkFileType(imagepath)!=true)
		{
			alert("Please select product image of types .jpg, .png and .gif only");
			frm.image1.select();
			return false;
		}
	}

	if(trim(frm.specification.value)=="")
	{
		alert(" Please enter the product specifications");
		frm.specification.focus();
		return false;
	}

	if(trim(frm.price.value)=="")
	{
		alert("Please enter the price");
		frm.price.focus();
		return false;
	}

  var price = trim(frm.price.value) ; 
	if(isNaN(price))
	{
		alert("Please enter a valid price");
		frm.price.select();
		return false;
	}
	if(price<=0)
	{
		alert("Please enter price more than 0 ");
		frm.price.select();
		return false;
	}
	return true;
}

/*
* Edit Products Page Validation
*/
function validate_editproduct(frm)
{
	if(trim(frm.product_name.value)=="")
	{
		alert("Please enter the product title");
		frm.product_name.focus();
		return false;
	}

	if(trim(frm.item_number.value)=="")
	{
		alert("Please enter the item number");
		frm.item_number.focus();
		return false;
	}

	imagepath1= trim(frm.image1.value);
	if(imagepath1!="")
	{
		if(checkFileType(imagepath1)!=true)
		{
			alert("Please select product image of types .jpg, .png and .gif only");
			frm.image1.select();
			return false;
		}
	} 
	/*image_t= trim(frm.image1_thumb.value);
	if(image_t!="")
	{
		if(checkFileType(image_t)!=true)
		{
			alert("Please select image of type .GIF or .JPG or .JPEG or .PNG formats only");
			frm.image1_thumb.select();
			return false;
		}
	} 
	
	imagepath2 = trim(frm.image2.value);
	if(imagepath2!="")
	{
		if(checkFileType(imagepath2)!=true)
		{
			alert("Please select image of type .GIF or .JPG or .JPEG or .PNG formats only");
			frm.image2.select();
			return false;
		}
	}

	imagepath3 = trim(frm.image3.value);
	if(imagepath3!="")
	{
		if(checkFileType(imagepath3)!=true)
		{
			alert("Please select image of type .GIF or .JPG or .JPEG or .PNG formats only");
			frm.image3.select();
			return false;
		}
	}

	imagepath4 = trim(frm.image4.value);
	if(imagepath4!="")
	{
		if(checkFileType(imagepath4)!=true)
		{
			alert("Please select image of type .GIF or .JPG or .JPEG or .PNG formats only");
			frm.image4.select();
			return false;
		}
	}

	imagepath5 = trim(frm.image5.value);
	if(imagepath5!="")
	{
		if(checkFileType(imagepath5)!=true)
		{
			alert("Please select image of type .GIF or .JPG or .JPEG or .PNG formats only");
			frm.image5.select();
			return false;
		}
	}*/


	if(trim(frm.specification.value)=="")
	{
		alert("Please enter the product specifications");
		frm.specification.focus();
		return false;
	}

	if(trim(frm.price.value)=="")
	{
		alert("Please enter the price");
		frm.price.focus();
		return false;
	}

  var price = trim(frm.price.value) ; 
	if(isNaN(price))
	{
		alert("Please enter a valid price");
		frm.price.select();
		return false;
	}
	if(price<=0)
	{
		alert("Please enter price more than 0 ");
		frm.price.select();
		return false;
	}

	return true;
}


function validate_addtest(frm,post)
{
	//alert(post);
	if(trim(frm.title.value)=="")
	{
	alert("Please enter the testimonial title");
	frm.title.focus();
	return false;
	}
	if(trim(frm.testmonial.value)=="")
	{
	alert("Please enter the testimonial description");
	frm.testmonial.focus();
	return false;
	}
	if(trim(frm.postedby.value)=="")
	{
	alert("Please enter your name in the written by field");
	frm.postedby.focus();
	return false;
	}
	if(post=='add' || post=='write')
	{
		if(trim(frm.image1.value)=="")
		{
			alert("Please select  before image.");
			frm.image1.focus();
			return false;
		}
	}
   if(frm.image1.value!="")
   { //alert("HELLO");
		if(!checkFileType(frm.image1.value))
		{
			alert("Please select images of types .jpeg, .jpg, .png and .gif only");
			frm.image1.focus();
			return false;
		}
   }
   if(post=='add' || post=='write')
   {
		if(trim(frm.image2.value)=="")
		{
			alert("Please select after image.");
			frm.image2.focus();
			return false;
		}
   }
   if(frm.image2.value!="")
   {
		if(!checkFileType(frm.image2.value))
		{
			alert("Please select images of types .jpeg, .jpg, .png and .gif only");
			frm.image2.focus();
			return false;
		}
   }
	if(trim(frm.age.value)=="")
	{
	alert("Please enter your age .");
	frm.age.focus();
	return false;
	}
		if(isNaN(trim(frm.age.value)))
		{
			alert("Please enter only numeric values in the age field" );
			frm.age.focus();
			return false;
		}
	if(trim(frm.city.value)=="")
	{
	alert("Please enter your city");
	frm.city.focus();
	return false;
	}
	if(trim(frm.Country.value)=="")
	{
	alert("Please enter your Country");
	frm.Country.focus();
	return false;
	}
	if(trim(frm.points.value)=="")
	{
	alert("Please select any Rating.");
	frm.points.focus();
	return false;
	}
	
	
/*	if(trim(frm.day.value)=="")
	{
	alert("Please select a day in date field ");
	frm.day.focus();
	return false;
	}
		if(trim(frm.mon.value)=="")
	{
	alert("Please select a month in date field ");
	frm.mon.focus();
	return false;
	}
		if(trim(frm.year.value)=="")
	{
	alert("Please select a year in date field ");
	frm.year.focus();
	return false;
	}
	if((form.mon.value!="") && (form.day.value!="") && (form.year.value!=""))
	{
		var myDate=new Date()
		myDate.setFullYear(form.year.value,form.mon.value-1,form.day.value)
		
		var today = new Date();
		
			if(myDate<today)
			{
			alert("Past date is not allowed.");
			return false;
			}
			else
			{
			var DateVal = form.mon.value + "/" + form.day.value + "/" + form.year.value;
			var dt = new Date(DateVal);
			//alert(dt.getDate());
			if(dt.getDate()!=form.day.value){
			alert('Invalid Date !!!');
			return false ;
			}
		}
	}
*/	
return true;
}

function validate_affregister(frm,page)
{
		// banned affliate array list
		banned_list = new Array();
		banned_list[0]="affliates";
		banned_list[1]="backoffice";
		banned_list[2]="css";
		banned_list[3]="images";
		banned_list[4]="includes";
		banned_list[5]="script";
		banned_list[6]="store";
		banned_list[7]="support";
		banned_list[8]="templates";

        // For Checking the banned id's
		//alert(banned_list.length)
		
		if(page=='add')
		{
			for(i=0;i<banned_list.length;i++)
			{
				if(banned_list[i]==trim(frm.username.value))
				{
				alert("User name already exists");
				frm.username.select();
				return false;
				}
			}
			if(trim(frm.username.value)=="")
			{
				alert("Please enter the user name");
				frm.username.focus();
				return false;
			}
			if(trim(frm.password.value)=="")
			{
				alert("Please enter the password");
				frm.password.focus();
				return false;
			}
			var passval=trim(frm.password.value);
			if(passval.length<6)
			{
				alert("Password must be atleast 6 characters");
				frm.password.focus();
				return false;
			}
			if(trim(frm.cpassword.value)=="")
			{
				alert("Please confirm the password");
				frm.cpassword.focus();
				return false;
			}
			if(trim(frm.cpassword.value)!=trim(frm.password.value))
			{
				alert("Confirm password must be same as new password");
				frm.cpassword.select();
				return false;
			}
		}
		if(trim(frm.firstname.value)=="")
		{
			alert("Please enter the first name");
			frm.firstname.focus();
			return false;
		}
		if(trim(frm.email.value)=="")
		{
			alert("Please enter the email address");
			frm.email.focus();
			return false;
		}
		if(checkEmail(frm.email.value)==false)
		{
			alert("Please enter the valid email address");
			frm.email.focus();
			return false;
		}
 
		if(trim(frm.phone.value)=="")
		{
			alert("Please enter the phone number" );
			frm.phone.focus();
			return false;
		}
		if(isNaN(trim(frm.phone.value)))
		{
			alert("Please enter only numeric values in the phone number field" );
			frm.phone.focus();
			return false;
		}
		if(isNaN(frm.fax.value)!="")
		{
			alert("Please enter only numeric values in the fax field" );
			frm.fax.focus();
			return false;
		}
		
		if(trim(frm.addr1.value)=="")
		{
			alert("Please enter the address");
			frm.addr1.focus();
			return false;
		}
		if(trim(frm.city.value)=="")
		{
			alert("Please enter the city");
			frm.city.focus();
			return false;
		}
	
		if(trim(frm.state.value)=="")
		{
			alert("Please enter the state");
			frm.state.focus();
			return false;
		}
		if(trim(frm.country.value)=="")
		{
			alert("Please enter the country");
			frm.country.focus();
			return false;
		}
		if(trim(frm.zip.value)=="")
		{
			alert("Please enter the zipcode");
			frm.zip.focus();
			return false;
		}
		/*if(isNaN(trim(frm.zip.value)))
		{
			alert("Please enter only numeric values in the zipcode field");
			frm.zip.focus();
			return false;
		}
		var zipval = frm.zip.value;
		if(zipval.length<5)
		{
			alert("Zipcode must have atleast 5 numeric values");
			frm.zip.focus();
			return false;
		}
		if(zipval.length>6)
		{
			alert("Zipcode must have maximum of 6 numeric values");
			frm.zip.focus();
			return false;
		}*/
		
	return true;
}

/*
* Manage VOlume Discounts page Validation
*/
function validate_volume(frm)
{
	if(trim(frm.volume.value)=="")
	{
		alert("Please enter the volume");
		frm.volume.focus();
		return false;
	}
	if(isNaN(frm.volume.value))
	{
		alert("Please enter only numeric values in the volume field");
		frm.volume.select();
		return false;
	}
	if(trim(frm.discount.value)=="")
	{
		alert("Please enter discount in %");
		frm.discount.focus();
		return false;
	}
	if(isNaN(frm.discount.value))
	{
		alert("Please enter only numeric values in the discount field");
		frm.discount.select();
		return false;
	}
	if(frm.discount.value>100)
	{
		alert("Discount percentage must be lessthan or equal to 100");
		frm.discount.select();
		return false;
	}
	return true;
}


function validate_article(frm)
{
	if(trim(frm.vcharFileName.value)=="")
	{
		alert("Please enter file name");
		frm.vcharFileName.focus();
		return false;
	}
	if(checkforspecialchars(frm.vcharFileName.value))
	{
		alert("File name should consist of only Alphanumerics & space.");
		frm.vcharFileName.focus();
		return false;
	}
	if(trim(frm.vcharShortDesc.value)=="")
	{
		alert("Please enter short description");
		frm.vcharShortDesc.focus();
		return false;
	}
	 updateRTEs();
	 //alert()
	 if(trim(htmlDecode(frm.ltDescription.value))=="")
	 {
		  alert("Please enter description.");
		  frm.ltDescription.focus();
		  return false;
	 } 
/*	if(frm.ltDescription.value=="")
	{
		alert("Please enter description");
		frm.ltDescription.focus();
		return false;
	}
*/	return true;
}


function opennew(url)
{
	win =  window.open (url, 'win', "height=400, width=777, toolbar=no, menubar=no, scrollbars=1, resizable=yes, location=no, directories=no, status=no");
	win.focus();
}

/*
* Add Product Section
*/
function validate_addsec(frm)
{
	if(trim(frm.sec_name.value)=="")
	{
		alert("Please enter the section name");
		frm.sec_name.focus();
		return false;
	}
	return true;
}

/*
* Add Sub Admin
*/
function validate_addsubadmin(frm)
{
	//alert('maddy')
	
	if(trim(frm.admin_login.value)=="")
	{
		alert("Please enter the subadmin ID");
		frm.admin_login.focus();
		return false;
	}
	if(trim(frm.password.value)=="")
	{
		alert("Please enter the password ");
		frm.password.focus();
		return false;
	}
	if(frm.password.value.length<6)
	{
		alert("Password must be atleast 6 characters ");
		frm.password.focus();
		return false;
	}
	return true;
}

/*
*Validation for Add Manufacturer
*/
function validate_addman(form)
{	
	if(trim(form.m_name.value)=="")
	{
	alert(" Please enter the manufacturer name");
	form.m_name.focus();
	return false;
	}
	if(trim(form.m_desc.value)=="")
	{
	alert("Please enter the description ");
	form.m_desc.focus();
	return false;
	}
   if(form.image1.value!="")
   {
		if(!checkFileType(form.image1.value))
		{
			alert("Please select images of types .jpeg, .jpg, .png and .gif only");
			form.image1.focus();
			return false;
		}
   }
	return true;
}

/*
* Add Topic Page Validaion
*/
function validate_addtopic(frm)
{
	if(trim(frm.topic_name.value)=="")
	{
		alert("Please enter the topic title ");
		frm.topic_name.focus();
		return false;
	}
}
function validate_cms(frm)
{
	if(trim(frm.vcharCmsname.value)=="")
	{
		alert("Please enter the cms name ");
		frm.vcharCmsname.focus();
		return false;
	}

    if(frm.txtdesc.value=="")
	{	
		str="Please enter the decsription.";
		alert(str);
		frm.txtdesc.focus();
		return false;
	}
	return true;
}
function validate_news(frm)
{
	if(trim(frm.vcharTitle.value)=="")
	{
		alert("Please enter the news title ");
		frm.vcharTitle.focus();
		return false;
	}
	if(trim(frm.vcharImage.value)=="")
	{
		alert("Please select a image");
		frm.vcharImage.focus();
		return false;
	}

	imagepath= trim(frm.vcharImage.value);
	if(checkFileType(imagepath)!=true)
	{
		alert("Please select images of types .jpg, .png and .gif only");
		frm.vcharImage.select();
		return false;
	}
	if(frm.txtshortdesc.value=="")
	{	
		str="Please enter the short decsription.";
		alert(str);
		frm.txtshortdesc.focus();
		return false;
	}
    if(frm.txtdesc.value=="")
	{	
		str="Please enter the decsription.";
		alert(str);
		frm.txtdesc.focus();
		return false;
	}
	
	
	return true;
}
function validate_editnews(frm)
{
	if(trim(frm.vcharTitle.value)=="")
	{
		alert("Please enter the news title ");
		frm.vcharTitle.focus();
		return false;
	}
	
	if(frm.txtshortdesc.value=="")
	{	
		str="Please enter the short decsription.";
		alert(str);
		frm.txtshortdesc.focus();
		return false;
	}
    if(frm.txtdesc.value=="")
	{	
		str="Please enter the decsription.";
		alert(str);
		frm.txtdesc.focus();
		return false;
	}
	
	
	return true;
}
function validate_contactus(frm)
{
  
 if(trim(frm.topic.value)=="")
  {
  alert("Please enter the question topic");
  frm.topic.focus();
  return false;
  }
  if(trim(frm.fullname.value)=="")
  {
  alert("Please enter Fullname");
  frm.fullname.focus();
  return false;
  }
/*  if(trim(frm.orderid.value)!="")
  {
 	if(isNaN(frm.orderid.value))
	  {
	  alert("Order Id must contain only numerics");
	  frm.orderid.focus();
	  return false;
	  }
  }
*/  
 if(trim(frm.email.value)=="")
  {
  alert("Please enter the email address");
  frm.email.focus();
  return false;
  }
	if(checkEmail(frm.email.value)==false)
	{
		alert("Please enter the valid email address");
		frm.email.focus();
		return false;
	}
	
  if(trim(frm.email.value)!=trim(frm.confirmemail.value))
  {
  alert("Email & Confirm Email must be same");
  frm.confirmemail.focus();
  return false;
  }
  if(checkEmail(trim(frm.email.value))==false)
  {
  alert("Please enter the valid email address");
  frm.email.focus();
  return false;
  }
  if(isNaN(frm.phone.value)!='')
	  {
	  alert("Phone must contain only numerics");
	  frm.phone.focus();
	  return false;
	  }
  if(trim(frm.bcountry.value)=="")
  {
  alert("Please select Country name");
  frm.bcountry.focus();
  return false;
  }
  if(trim(frm.comment.value)=="")
  {
  alert("Please enter the Question/Comments/Inquiries");
  frm.comment.focus();
  return false;
  }
}

function validate_radiobutton(frm)
{
  frm.radiouser.checked;
  if(!frm.radiouser.checked)
  {
	  alert("Please select radio button .");
	  frm.radiouser.focus();
	  return false;
	  }
}


function hideSection_payopt(ss)
{
	ele1=document.getElementById('Credit Card');
	//ele2=document.getElementById('Fax');
	
	if(ss=='Credit Card')
	{ 
		ele1.style.display = "block";
		//ele2.style.display = "none";
	}
	else if(ss=='Fax')
	{	
		ele1.style.display = "none";
		//ele2.style.display = "block";
	}
}


function validate_addcoupons(frm)
{
	if(trim(frm.vcharCouponName.value)=="")
	{
		alert("Please enter the Coupon ");
		frm.vcharCouponName.focus();
		return false;
	}
	/*if(trim(frm.dateStartDate.value)=="")
	{
		alert("Please select start date.");
		frm.dateStartDate.focus();
		return false;
	}
	if(trim(frm.dateEndDate.value)=="")
	{
		alert("Please select end date.");
		frm.dateEndDate.focus();
		return false;
	}*/
	if(trim(frm.floatSavings.value)=="")
	{
		alert("Please enter the savings");
		frm.floatSavings.focus();
		return false;
	}
	if(trim(frm.floatSavings.value)!="")
	{
		if(isNaN(frm.floatSavings.value) || trim(frm.floatSavings.value)<=0 || trim(frm.floatSavings.value)>100)
			{
				alert("Please enter valid numeric less than 100");
				frm.floatSavings.focus();
				return false;
			}
	}
	return true;
}

/*****}******************************************************************************************/
