// JavaScript Document
function validate_friendmail(s){
	if(trim(s.yourname.value)==""){
		alert("Please specify your name")
		s.yourname.focus()
		return false
	}
	if(trim(s.youremail.value)==""){
		alert("Please specify your email")
		s.youremail.focus()
		return false
	} else {
		st=s.youremail.value;
		if(checkEmail(st)==false)
		{
			alert("Please Enter Correct Email")
			s.youremail.focus();
			return false
		}
	}
	if(trim(s.yourfriendname.value)==""){
		alert("Please specify your friend name")
		s.yourfriendname.focus()
		return false
	}
	if(trim(s.yourfriendemail.value)==""){
		alert("Please specify your friend email")
		s.yourfriendemail.focus()
		return false
	} else {
		st=s.yourfriendemail.value;
		if(checkEmail(st)==false)
		{
			alert("Please Enter Correct Email")
			s.yourfriendemail.focus();
			return false
		}
	}
}
function validate_addnewblog(s){
	if(trim(s.blogheading.value)==""){
		alert("Please enter blog heading")
		s.blogheading.focus()
		return false
	}
	if(trim(s.blogtitle.value)==""){
		alert("Please enter blog title")
		s.blogtitle.focus()
		return false
	}
	if(trim(s.desp1.value)==""){
		alert("Please enter blog brief description")
		s.desp1.focus()
		return false
	}
	if(trim(s.desp3.value)==""){
		alert("Please enter blog description")
		s.desp3.focus()
		return false
	}
}
function validate_postentry(s){
	if(trim(s.name1.value)==""){
		alert("Please enter name")
		s.name1.focus()
		return false
	}
	if(trim(s.emailid.value)==""){
		alert("Please enter emailid")
		s.emailid.focus()
		return false
	} else {
		st=s.emailid.value;
		if(checkEmail(st)==false)
		{
			alert("Please Enter Correct Email")
			s.emailid.focus();
			return false
		}
	}
	if(trim(s.comments.value)==""){
		alert("Please enter comments")
		s.comments.focus()
		return false
	}	
}
function validate_register(s){
	if(trim(s.uname.value)==""){
		alert("Please enter username")
		s.uname.focus()
		return false
	}
	charset=s.uname.value
	if (charset.indexOf(" ")>0)
		{
			alert("Spaces are not allowed bewtween username")
			s.uname.focus()
			return false
		}
	if(trim(s.pwd.value)==""){
		alert("Please enter password")
		s.pwd.focus()
		return false
	}
	charset=s.pwd.value
	if (charset.indexOf(" ")>0)
		{
			alert("Spaces are not allowed bewtween username")
			s.pwd.focus()
			return false
		}
	if(trim(s.cpwd.value)==""){
		alert("Please enter confirm password")
		s.cpwd.focus()
		return false
	}
	if(trim(s.pwd.value)!=s.cpwd.value){
		alert("Password and confirm password are not the same")
		s.pwd.focus()
		return false
	}
	if(trim(s.name1.value)==""){
		alert("Please enter name")
		s.name1.focus()
		return false
	}
	if(trim(s.dispname.value)==""){
		alert("Please enter display name")
		s.dispname.focus()
		return false
	}
	if(trim(s.emailid.value)==""){
		alert("Please enter emailid")
		s.emailid.focus()
		return false
	} else {
		st=s.emailid.value;
		if(checkEmail(st)==false)
		{
			alert("Please Enter Correct Email")
			s.emailid.focus();
			return false
		}
	}
	
}

function validate_listingcenter(s1){
	if(trim(s1.nm.value)==""){
		alert("please enter name")
		s1.nm.focus()
		return false
	}
	if(trim(s1.addr.value)==""){
		alert("please enter address")
		s1.addr.focus()
		return false
	}
	if(trim(s1.city.value)==""){
		alert("please enter city")
		s1.city.focus()
		return false
	}
	if(trim(s1.email_id.value)==""){
		alert("please enter emailid")
		s1.email_id.focus()
		return false
	}else{
					st=s1.email_id.value;
					if(checkEmail(st)==false)
					{
						alert("Please Enter Correct Email")
						s1.email_id.focus();
						return false
					}
	}

}

function validate()

	{

		var g=window.document.forms[0];

		if(g){

			if(g.product_name.value==""){

				alert("Enter Product Name");

				g.product_name.focus();

				return false;

			}

			if(g.textdesc.value==""){

				alert("Enter Product Description");

				return false;

			}

			if(g.textship.value==""){

				alert("Enter Shipping Description");

				g.textship.focus();

				return false;

			}

		}

	}

function validate_reverse(form)
{
	if(form.login.value == "")
	{
		alert("Please Login before you participate in the bidding");
		location.href = "login.php?frm=reverse_auction_detail_display.php?p_id="+form.p_id.value;
		return false;
	}
	if(form.login.value != "")
	{
		if(form.login.value == form.user.value)
		{
			alert("Buyer cannot participate in the Auction");
			return false;
		}
	}
 	if(form.bid_amt.value == "")
	{
		alert("Enter the Bid amount");
		form.bid_amt.focus();
		return false;
	}
	if(form.login.value!= "")
	{
		if(form.login.value == form.user.value)
		{
			alert("Seller cannot participate in the Bidding");
			return false;
		}
	
	}
	return true;
}

function validate_editshipping(frm)
{
	if(frm.from.value == "")
	{
		alert("Enter the Price From value")	
		frm.from.focus()
		return false;
	}
	if(!(parseFloat(frm.from.value)))
	{
		alert("Value should be numeric")
		frm.from.value = ""
		frm.from.focus()
		return false;
	}
	if(frm.to.value == "")
	{
		alert("Enter the Price To value")	
		frm.to.focus()
		return false;
	}
	if(!(parseFloat(frm.to.value)))
	{
		alert("Value should be numeric")
		frm.to.value = ""
		frm.to.focus()
		return false;
	}
	if(frm.first.value == "")
	{
		alert("Enter the Price for First Item")	
		frm.first.focus()
		return false;
	}
	if(!(parseFloat(frm.first.value)))
	{
		alert("Value should be numeric")
		frm.first.value = ""
		frm.first.focus()
		return false;
	}
	if(frm.add.value == "")
	{
		alert("Enter the Price for Additional Item")	
		frm.add.focus()
		return false;
	}
	if(!(parseFloat(frm.add.value)))
	{
		alert("Value should be numeric")
		frm.add.value = ""
		frm.add.focus()
		return false;
	}
}

function function_search(s1){
	if(trim(s1.value)==""){
		alert("Please enter search text")
		s1.focus()
	} else {
		location.href="gen_search.php?search="+s1.value
	}
}
function validate_payment ()
{
	var checked = false;
	var buttons = frm1.btn;   
	var temp;   // for storing the index value
	//alert(buttons)
	lens=buttons.length
	value1=""
	if (buttons==null)
		return false
	//alert(lens)
	if (lens>1) {
		for (var i=0; i<buttons.length; i++)
		{      
			if (buttons[i].checked) 
			{ 
			   checked = true; 
			   value1=buttons[i].value
			   temp = i;
			   
			   /////////////////// filed validation code //////////////////////
			   
			   if(buttons[temp].value == "Authorize")
		{
			if(frm1.owner0.value == "")
			{
				alert("Enter the Name")
				frm1.owner0.focus()
				return false;
			}
			else if(frm1.number0.value == "")
			{
				alert("Enter the Credit Card Number")
				frm1.number0.focus()
				return false;
			}
			else if(!(checkCreditCard(frm1.number0.value)))
			{
				alert("Enter a Valid Credit Card Number (without any spaces)")
				frm1.number0.value =""
				frm1.number0.focus()
				return false;
			}
			if(dropdown_validator(frm1.authorizenet_cc_expires_month0.value,frm1.authorizenet_cc_expires_year0.value) == false)
			{
				return false;
			}
		}
		else if(buttons[temp].value == "Cash On Delivery")
		{
		}
		else if(buttons[temp].value == "Check / Money Order")
		{
		}
		else if(buttons[temp].value == "Direct Deposit")
		{
		}
		else if(buttons[temp].value == "2Checkout")
		{
			if(frm1.fname4.value == "")
			{
				alert("Enter the First Name")
				frm1.fname4.focus()
				return false;
			}
			else if(frm1.lname4.value == "")
			{
				alert("Enter the Last Name")	
				frm1.lname4.focus()
				return false;
			}
			else if(frm1.number4.value == "")
			{
				alert("Enter the Credit Card Number")
				frm1.number4.focus()
				return false;
			}
			else if(frm1.check4.value == "")
			{
				alert("Enter the Credit Card Check number")
				frm1.check4.focus()
				return false;
			}
			else if(!(checkCreditCard(frm1.number4.value)))
			{
				alert("Enter a Valid Credit Card Number (without any spaces)")
				frm1.number4.value =""
				frm1.number4.focus()
				return false;
			}
			if(dropdown_validator(frm1.authorizenet_cc_expires_month4.value,frm1.authorizenet_cc_expires_year4.value) == false)
			{
				return false;
			}
		}
		else if(buttons[temp].value == "Secpay")
		{
		}
		else if(buttons[temp].value == "ipayment")
		{
			if(frm1.owner6.value == "")
			{
				alert("Enter the Name")
				frm1.owner6.focus()
				return false;
			}
			else if(frm1.number6.value == "")
			{
				alert("Enter the Credit Card Number")
				frm1.number6.focus()
				return false;
			}
			else if(frm1.check6.value == "")
			{
				alert("Enter the Credit Card Check number")
				frm1.check6.focus()
				return false;
			}
			else if(!(checkCreditCard(frm1.number6.value)))
			{
				alert("Enter a Valid Credit Card Number (without any spaces)")
				frm1.number6.value =""
				frm1.number6.focus()
				return false;
			}
			else if(dropdown_validator(frm1.authorizenet_cc_expires_month6.value,frm1.authorizenet_cc_expires_year6.value) == false)
			{
				return false;
			}
		}
		else if(buttons[temp].value == "psigate")
		{
			if(frm1.owner7.value == "")
			{
				alert("Enter the Name")
				frm1.owner7.focus()
				return false;
			}
			else if(frm1.number7.value == "")
			{
				alert("Enter the Credit Card Number")
				frm1.number7.focus()
				return false;
			}
			else if(!(checkCreditCard(frm1.number7.value)))
			{
				alert("Enter a Valid Credit Card Number (without any spaces)")
				frm1.number7.value =""
				frm1.number7.focus()
				return false;
			}
			else if(dropdown_validator(frm1.authorizenet_cc_expires_month7.value,frm1.authorizenet_cc_expires_year7.value) == false)
			{
				return false;
			}
		}
		else if(buttons[temp].value == "Worldpay")
		{
		}
		else if(buttons[temp].value == "Paypal")
		{
		}
		
			   ////////////////// field validation code ending....////////////////////
			}     
		}   
	} else {
		//alert(buttons.checked)
		//return false
		if (buttons.checked) 
		{ 
		   checked = true;  
		   value1=buttons.value
		   //temp = i;
		   //////////////////////////////////////////// field validation code not control array//////////////////////////
		   
		   
		   if(buttons.value == "Authorize")
			{
				if(frm1.owner0.value == "")
				{
					alert("Enter the Name")
					frm1.owner0.focus()
					return false;
				}
				else if(frm1.number0.value == "")
				{
					alert("Enter the Credit Card Number")
					frm1.number0.focus()
					return false;
				}
				else if(!(checkCreditCard(frm1.number0.value)))
				{
					alert("Enter a Valid Credit Card Number (without any spaces)")
					frm1.number0.value =""
					frm1.number0.focus()
					return false;
				}
				if(dropdown_validator(frm1.authorizenet_cc_expires_month0.value,frm1.authorizenet_cc_expires_year0.value) == false)
				{
					return false;
				}
			}
			else if(buttons.value == "Cash On Delivery")
			{
			}
			else if(buttons.value == "Check / Money Order")
			{
			}
			else if(buttons.value == "Direct Deposit")
			{
			}
			else if(buttons.value == "2Checkout")
			{
				if(frm1.fname4.value == "")
				{
					alert("Enter the First Name")
					frm1.fname4.focus()
					return false;
				}
				else if(frm1.lname4.value == "")
				{
					alert("Enter the Last Name")	
					frm1.lname4.focus()
					return false;
				}
				else if(frm1.number4.value == "")
				{
					alert("Enter the Credit Card Number")
					frm1.number4.focus()
					return false;
				}
				else if(frm1.check4.value == "")
				{
					alert("Enter the Credit Card Check number")
					frm1.check4.focus()
					return false;
				}
				else if(!(checkCreditCard(frm1.number4.value)))
				{
					alert("Enter a Valid Credit Card Number (without any spaces)")
					frm1.number4.value =""
					frm1.number4.focus()
					return false;
				}
				if(dropdown_validator(frm1.authorizenet_cc_expires_month4.value,frm1.authorizenet_cc_expires_year4.value) == false)
				{
					return false;
				}
			}
			else if(buttons.value == "Secpay")
			{
			}
			else if(buttons.value == "ipayment")
			{
				if(frm1.owner6.value == "")
				{
					alert("Enter the Name")
					frm1.owner6.focus()
					return false;
				}
				else if(frm1.number6.value == "")
				{
					alert("Enter the Credit Card Number")
					frm1.number6.focus()
					return false;
				}
				else if(frm1.check6.value == "")
				{
					alert("Enter the Credit Card Check number")
					frm1.check6.focus()
					return false;
				}
				else if(!(checkCreditCard(frm1.number6.value)))
				{
					alert("Enter a Valid Credit Card Number (without any spaces)")
					frm1.number6.value =""
					frm1.number6.focus()
					return false;
				}
				else if(dropdown_validator(frm1.authorizenet_cc_expires_month6.value,frm1.authorizenet_cc_expires_year6.value) == false)
				{
					return false;
				}
			}
			else if(buttons.value == "psigate")
			{
				if(frm1.owner7.value == "")
				{
					alert("Enter the Name")
					frm1.owner7.focus()
					return false;
				}
				else if(frm1.number7.value == "")
				{
					alert("Enter the Credit Card Number")
					frm1.number7.focus()
					return false;
				}
				else if(!(checkCreditCard(frm1.number7.value)))
				{
					alert("Enter a Valid Credit Card Number (without any spaces)")
					frm1.number7.value =""
					frm1.number7.focus()
					return false;
				}
				else if(dropdown_validator(frm1.authorizenet_cc_expires_month7.value,frm1.authorizenet_cc_expires_year7.value) == false)
				{
					return false;
				}
			}
			else if(buttons.value == "Worldpay")
			{
			}
			else if(buttons.value == "Paypal")
			{
			}
		   
		   ///////////////////////////////////////////// field validation code not control array ending//////////////
		} 
	}
	if(!checked)
	{      
		alert("Choose a Payment Method (Radio Button)");     
		return false;
	}
	else if(checked == true)
	{
		frm1.pay.value=value1;	
	}
	
	//location.href = "final_checkout.php?inv="+frm1.inv.value+"&paytype="+buttons[temp].value
	return true; 
}

function adm_banner_validate(s1){
	if (trim(s1.seller_logo.value)==""){
		alert("Upload banner image")
		return false
	} 	
	if (trim(s1.cat_name2.value)==""){
		alert("Please enter link URL with http://")
		s1.cat_name2.focus()
		return false
	} 
}
function store_search(s1)
{
	alert(satish)
	if (trim(s1.search1.value)=="")
	{
		alert("Plese enter a keyword")
		return false
	}
}
function allDigits(str)
{
	return inValidCharSet(str,"0123456789");
}
	
function inValidCharSet(str,charset)
{
	var result = true;
	for (var i=0;i<str.length;i++)
		if (charset.indexOf(str.substr(i,1))<0)
		{
			result = false;
			break;
		}
	
	return result;
}
	
function MM_openBrWindow(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=242';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_h(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=103';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_01(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=291';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_02(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=621';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_03(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=621';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_04(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=103';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_05(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=138';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_06(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=75';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_07(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=105';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_08(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=50';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_09(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=120';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_10(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=50';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_11(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=140';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_12(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=100';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_13(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=450';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_14(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=120';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_15(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=50';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_16(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=245';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_17(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=245';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_18(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=155';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_19(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=50';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_20(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=345';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_21(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=105';
  window.open(theURL,winName,features);
}
function MM_openBrWindow_22(theURL,winName,features) { //v2.0
  features='toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=500,height=105';
  window.open(theURL,winName,features);
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}		
function LTrim(str)
{
   var whitespace = new String("\t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {
      // We have a string with leading blank(s)...

      var j=0, i = s.length;

      // Iterate from the far left of string until we
      // don't have any more whitespace...
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;

      // Get the substring from the first non-whitespace
      // character to the end of the string...
      s = s.substring(j, i);
   }
   return s;
}

function RTrim(str)
{
   // We don't want to trip JUST spaces, but also tabs,
   // line feeds, etc.  Add anything else you want to
   // "trim" here in Whitespace
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      // We have a string with trailing blank(s)...
     var i = s.length - 1;       // Get length of string
      // Iterate from the far right of string until we
      // don't have any more whitespace...
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;
      // Get the substring from the front of the string to
      // where the last non-whitespace character is...
      s = s.substring(0, i+1);
   }

   return s;
}


function trim(str)
{
   return RTrim(LTrim(str));
}

function checkEmail(str)
	{
		if((str.indexOf("@")==-1) || (str.indexOf(".")==-1))
		{
			fstr="Please Enter @ or .";
			return false;
		}
		else
		{
		if((str.indexOf("@") == 0) || (str.indexOf(".") == 0))
		{
			fstr="@ or . Cannot Be first";
			return false;
		}
		if((str.indexOf("@") == (str.length-1)) || (str.indexOf(".") == (str.length-1)))
		{
			fstr="@ or . Cannot Be Last";
			return false;
		}

		/*if(str.indexOf("@") > str.indexOf("."))
		{
			fstr="@ Should be After .";
			return false;
		}*/
		if((str.indexOf("@")+1) == str.indexOf("."))
		{
			fstr="@. IS Invalid Email";
			return false;
		}
		}
		var cp=0;					
	
		if(cp==2)
		{
			fstr="@ cannnot be repeated";
			return false;
		}
		return true;
	}

function EmailCheck(myForm)
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(trim(myForm))) 
	{
		return true;
	}		
	return false 
}
function checkNum(str) {

				 for(i=0;i<str.length;i++) { 

					 c=str.charAt(i);

					  b=(((c >= "0") && (c <= "9")) || (c==" ") || (c=="(")|| (c==")")|| (c=="-") ) 

					  if(b==true) 

					  continue; 

					  else 

					  return false; 

				  } 

				  return true; 

			  }

function UNIXday(D) {
  return Date.UTC(D[0], D[1]-1, D[2])/864e5 
  }
  function ValidDate(y, m, d) { // m = 0..11 ; y m d integers, y!=0
  with (new Date(y, m, d))
    return (getMonth()==m && getDate()==d) /* was y, m */ }
function ReadISO8601date(Q) { var T // adaptable for other layouts
  if ((T = /^(\d+)([-\/])(\d\d)(\2)(\d\d)$/.exec(Q)) == null)
    { return -2 } // bad format
  for (var j=1; j<=5; j+=2) T[j] = +T[j] // some use needs numbers
  if (!ValidDate(T[1], T[3]-1, T[5])) { return -1 } // bad value
  return [ T[1], T[3], T[5] ] }
  
function DiffYD(S1, S2) {


  var D1 = ReadISO8601date(S1) ; 
  var D2 = ReadISO8601date(S2) ; 
  var DY = D1[0]-D2[0]
  //alert("in here")
  if ( (D1[1]<D2[1]) || ( (D1[1]==D2[1]) && (D1[2]<D2[2] ) ) ) 
  		DY--
  D2[0] += DY
  return [ DY ] 
  }
//////////////////////////////// all buyer panel functions///////////////////////////////
/// function to upgrade Seller...
function upgrade_seller(s)
{
 var g=s;
 if(trim(g.company_name.value)=="")
 {
	 alert ("Please enter Company name");
	 g.company_name.focus();
	 return false;
 }
 /*if(trim(g.cctype.value)=="")
 {
	 alert ("Please Select card type");
	 g.cctype.focus();
	 return false;
 }
  if(trim(g.card_name.value)=="")
 {
	 alert ("Please enter Card name");
	 g.card_name.focus();
	 return false;
 }
 if(trim(g.card_num.value)=="")
 {
	 alert ("Please enter Card number");
	 g.card_num.focus();
	 return false;
 }

 if(isNaN(g.card_num.value))
 {
	 alert ("Please enter correct value");
	 g.card_num.focus();
	 return false;
 }
 if(checkCreditCard(g.card_num.value))
			{
				alert("Enter a Valid Credit Card Number (without any spaces)")
				g.card_num.value=""
				g.card_num.focus()
				return false;
			}
 if(trim(g.address.value)=="")
 {
	 alert ("Please enter Address");
	 g.address.focus();
	 return false;
 }
	var exp_dt=g.exp_year.value+""+g.exp_month.value;
	var exp_yr=g.ydate.value;
	if(exp_yr>=exp_dt)
	{
	alert("Card Expiry date is less than Today");
	return false;
	}*/
}
/// function to upgrade Music Seller...
function upgrade_music_seller(s)
{
 var g=s;
 if(trim(g.id_proof.value)=="")
 {
	 alert ("Please enter Identity Proof");
	 g.id_proof.focus();
	 return false;
 }
 if(trim(g.company_name.value)=="")
 {
	 alert ("Please enter Company name");
	 g.company_name.focus();
	 return false;
 }
 if(trim(g.cctype.value)=="")
 {
	 alert ("Please Select card type");
	 g.cctype.focus();
	 return false;
 }
  if(trim(g.card_name.value)=="")
 {
	 alert ("Please enter Card name");
	 g.card_name.focus();
	 return false;
 }
 if(trim(g.card_num.value)=="")
 {
	 alert ("Please enter Card number");
	 g.card_num.focus();
	 return false;
 }

 if(isNaN(g.card_num.value))
 {
	 alert ("Please enter correct value");
	 g.card_num.focus();
	 return false;
 }
 if(checkCreditCard(g.card_num.value))
	{
		alert("Enter a Valid Credit Card Number (without any spaces)")
		g.card_num.value=""
		g.card_num.focus()
		return false;
	}
 if(trim(g.address.value)=="")
 {
	 alert ("Please enter Address");
	 g.address.focus();
	 return false;
 }
	var exp_dt=g.exp_year.value+""+g.exp_month.value;
	var exp_yr=g.ydate.value;
	if(exp_yr>=exp_dt)
	{
	alert("Card Expiry date is less than Today");
	return false;
	}
}

// Validate credit card info.

function dropdown_validator(mnth,yr)
{
	// Variables for the current date, year and month
	var right_now=new Date();
	var the_year=right_now.getYear();
	var the_month=right_now.getMonth();
	
	// Check for input in both the month and year fields
	if (mnth == "" || yr == "")
	{
		alert("Please select a month and year");
		return false;
	}
	// Check to see if the request is within the current year and month
	if (yr == the_year && mnth <= the_month)
	{
		alert("Please check the month of your request.");
		return (false);
	}
	// Check to see if the year request is calid
	if (yr < the_year)
	{
		alert("Please check the year of your request.");
		return (false);
	}
	else
		return true;
}

// Validate credit card info.

function checkCreditCard (x)
{   
	if(isCreditCard(x))
	return(isAnyCard(x))
}

function isCreditCard(st) {
  // Encoding only works on cards with less than 19 digits
  if (st.length > 19)
    return (false);

  sum = 0; mul = 1; l = st.length;
  for (i = 0; i < l; i++) {
    digit = st.substring(l-i-1,l-i);
    tproduct = parseInt(digit ,10)*mul;
    if (tproduct >= 10)
      sum += (tproduct % 10) + 1;
    else
      sum += tproduct;
    if (mul == 1)
      mul++;
    else
      mul--;
  }
// Uncomment the following line to help create credit card numbers
// 1. Create a dummy number with a 0 as the last digit
// 2. Examine the sum written out
// 3. Replace the last digit with the difference between the sum and
//    the next multiple of 10.

//  document.writeln("<BR>Sum      = ",sum,"<BR>");
//  alert("Sum      = " + sum);

  if ((sum % 10) == 0)
    return (true);
  else
    return (false);

} // END FUNCTION isCreditCard()



/*  ================================================================
    FUNCTION:  isVisa()
 
    INPUT:     cc - a string representing a credit card number

    RETURNS:  true, if the credit card number is a valid VISA number.
		    
	      false, otherwise

    Sample number: 4111 1111 1111 1111 (16 digits)
    ================================================================ */

function isVisa(cc)
{
  if (((cc.length == 16) || (cc.length == 13)) &&
      (cc.substring(0,1) == 4))
    return isCreditCard(cc);
  return false;
}  // END FUNCTION isVisa()




/*  ================================================================
    FUNCTION:  isMasterCard()
 
    INPUT:     cc - a string representing a credit card number

    RETURNS:  true, if the credit card number is a valid MasterCard
		    number.
		    
	      false, otherwise

    Sample number: 5500 0000 0000 0004 (16 digits)
    ================================================================ */

function isMasterCard(cc)
{
  firstdig = cc.substring(0,1);
  seconddig = cc.substring(1,2);
  if ((cc.length == 16) && (firstdig == 5) &&
      ((seconddig >= 1) && (seconddig <= 5)))
    return isCreditCard(cc);
  return false;

} // END FUNCTION isMasterCard()





/*  ================================================================
    FUNCTION:  isAmericanExpress()
 
    INPUT:     cc - a string representing a credit card number

    RETURNS:  true, if the credit card number is a valid American
		    Express number.
		    
	      false, otherwise

    Sample number: 340000000000009 (15 digits)
    ================================================================ */

function isAmericanExpress(cc)
{
  firstdig = cc.substring(0,1);
  seconddig = cc.substring(1,2);
  if ((cc.length == 15) && (firstdig == 3) &&
      ((seconddig == 4) || (seconddig == 7)))
    return isCreditCard(cc);
  return false;

} // END FUNCTION isAmericanExpress()




/*  ================================================================
    FUNCTION:  isDinersClub()
 
    INPUT:     cc - a string representing a credit card number

    RETURNS:  true, if the credit card number is a valid Diner's
		    Club number.
		    
	      false, otherwise

    Sample number: 30000000000004 (14 digits)
    ================================================================ */

function isDinersClub(cc)
{
  firstdig = cc.substring(0,1);
  seconddig = cc.substring(1,2);
  if ((cc.length == 14) && (firstdig == 3) &&
      ((seconddig == 0) || (seconddig == 6) || (seconddig == 8)))
    return isCreditCard(cc);
  return false;
}



/*  ================================================================
    FUNCTION:  isCarteBlanche()
 
    INPUT:     cc - a string representing a credit card number

    RETURNS:  true, if the credit card number is a valid Carte
		    Blanche number.
		    
	      false, otherwise
    ================================================================ */

function isCarteBlanche(cc)
{
  return isDinersClub(cc);
}




/*  ================================================================
    FUNCTION:  isDiscover()
 
    INPUT:     cc - a string representing a credit card number

    RETURNS:  true, if the credit card number is a valid Discover
		    card number.
		    
	      false, otherwise

    Sample number: 6011000000000004 (16 digits)
    ================================================================ */

function isDiscover(cc)
{
  first4digs = cc.substring(0,4);
  if ((cc.length == 16) && (first4digs == "6011"))
    return isCreditCard(cc);
  return false;

} // END FUNCTION isDiscover()





/*  ================================================================
    FUNCTION:  isEnRoute()
 
    INPUT:     cc - a string representing a credit card number

    RETURNS:  true, if the credit card number is a valid enRoute
		    card number.
		    
	      false, otherwise

    Sample number: 201400000000009 (15 digits)
    ================================================================ */

function isEnRoute(cc)
{
  first4digs = cc.substring(0,4);
  if ((cc.length == 15) &&
      ((first4digs == "2014") ||
       (first4digs == "2149")))
    return isCreditCard(cc);
  return false;
}



/*  ================================================================
    FUNCTION:  isJCB()
 
    INPUT:     cc - a string representing a credit card number

    RETURNS:  true, if the credit card number is a valid JCB
		    card number.
		    
	      false, otherwise
    ================================================================ */

function isJCB(cc)
{
  first4digs = cc.substring(0,4);
  if ((cc.length == 16) &&
      ((first4digs == "3088") ||
       (first4digs == "3096") ||
       (first4digs == "3112") ||
       (first4digs == "3158") ||
       (first4digs == "3337") ||
       (first4digs == "3528")))
    return isCreditCard(cc);
  return false;

} // END FUNCTION isJCB()



/*  ================================================================
    FUNCTION:  isAnyCard()
 
    INPUT:     cc - a string representing a credit card number

    RETURNS:  true, if the credit card number is any valid credit
		    card number for any of the accepted card types.
		    
	      false, otherwise
    ================================================================ */

function isAnyCard(cc)
{
  if (!isCreditCard(cc))
    return false;
  if (!isMasterCard(cc) && !isVisa(cc) && !isAmericanExpress(cc) && !isDinersClub(cc) &&
      !isDiscover(cc) && !isEnRoute(cc) && !isJCB(cc)) {
    return false;
  }
  return true;

} // END FUNCTION isAnyCard()




function IsCC (st) {
    return isCreditCard(st);
}

function IsVisa (cc)  {
  return isVisa(cc);
}

function IsVISA (cc)  {
  return isVisa(cc);
}

function IsMasterCard (cc)  {
  return isMasterCard(cc);
}

function IsMastercard (cc)  {
  return isMasterCard(cc);
}

function IsMC (cc)  {
  return isMasterCard(cc);
}

function IsAmericanExpress (cc)  {
  return isAmericanExpress(cc);
}

function IsAmEx (cc)  {
  return isAmericanExpress(cc);
}

function IsDinersClub (cc)  {
  return isDinersClub(cc);
}

function IsDC (cc)  {
  return isDinersClub(cc);
}

function IsDiners (cc)  {
  return isDinersClub(cc);
}

function IsCarteBlanche (cc)  {
  return isCarteBlanche(cc);
}

function IsCB (cc)  {
  return isCarteBlanche(cc);
}

function IsDiscover (cc)  {
  return isDiscover(cc);
}

function IsEnRoute (cc)  {
  return isEnRoute(cc);
}

function IsenRoute (cc)  {
  return isEnRoute(cc);
}

function IsJCB (cc)  {
  return isJCB(cc);
}

function IsAnyCard(cc)  {
  return isAnyCard(cc);
}

function IsCardMatch (cardType, cardNumber)  {
  return isCardMatch (cardType, cardNumber);
}

				//// Deleting email..
function validate_b_inbox(k)
{
	flag="No"
	if(form1.Mid)
{
	i=form1.Mid.length
	if (i>1)
	{
		for(i1=0;i1<i;i1++)
		{
		 	if(form1.Mid[i1].checked)
			flag="yes"
		}
	}
	else
	{
		if(form1.Mid.checked)
		flag="yes"
	}
}
	if (flag=="yes")
	{
		form1.action='buyer/buyer_tasks1.php';
		form1.submit();
		return true;
	}
	else
	{
		alert("Select records to delete")
		return false
	}
}					

// deleting email over ..

//////////////////////////////// all buyer panel functions Ending///////////////////////////////

//////////////////////////////// all Seller panel functions ///////////////////////////////

function form_querystring(s)
{
	//alert(s);
	var g=window.document.forms[0];
	
	/* if(trim(g.textpay.value)=="")
 	 { 
		alert("Please Enter payment Details");

		g.textpay.focus();
		return false; 
	 }

	 if(trim(g.textship.value)=="")
 	 {
		alert("Please Enter Shipping Details");

		g.textship.focus();
		return false; 
	 }
	 	
	 if(trim(g.textwarranty.value)=="")
 	 {
		alert("Please Enter Warranty description");

		g.textwarranty.focus();
		return false; 
	 }  */
	 if(g.subtitle.value != "")
	 	subtitle = 1;
	else
		subtitle = 0	
 	if(g.auctiontype.value == "estore")
		window.open("product_estore_preview.php?id="+s.id.value+"&image1="+s.imagename1.value+"&extra="+s.extra.value+"&flag="+s.flag.value+"&flag2="+s.flag2.value+"&bold="+s.bold1.value+"&border="+s.border1.value+"&highlight="+s.highlight1.value+"&subtitle="+subtitle,'Preview'); 
	else
		window.open("product_auction_preview.php?id="+s.id.value+"&image1="+s.imagename1.value+"&extra="+s.extra.value+"&flag="+s.flag.value+"&flag2="+s.flag2.value+"&bold="+s.bold1.value+"&border="+s.border1.value+"&highlight="+s.highlight1.value+"&subtitle="+subtitle,'Preview');

//window.open("auction_product_detail_display.php?p_id=41");
}

/////////////////////html area function

var editor = null;
function initEditor() {
  // create an editor for the "ta" textbox
  editor = new HTMLArea("textdesc");

  // register the TableOperations plugin with our editor
  editor.registerPlugin("TableOperations");

  editor.generate();
  return false;
}

function insertHTML() {
  var html = prompt("Enter some HTML code here");
  if (html) {
    editor.insertHTML(html);
  }
}
function highlight() {
  editor.surroundHTML('<span style="background-color: yellow">', '</span>');
}

///// category options...
function validate_option(k)
{
if (k.chk_option!=null)
	{ 
		flag=false
		var pids="";
		var i=k.chk_option.length;
		//alert(g.payment_methods.length);
		if(i>1)
		{
			for(i1=0;i1<i;i1++)
			{
				if(k.chk_option[i1].checked)
				{
					if(i1==0)
					{
						pids=k.chk_option[i1].value;
					}
					else
					{
						pids=pids+",";
						pids=pids + k.chk_option[i1].value;
					}
					flag=true;
				}
			}
			k.pids.value=pids;
		}
		else
		{
			if(k.chk_option[0].checked)
			{
				pids=k.chk_option[0].value;
				flag=true
				k.pids.value=pids;
			}
		}
		if(flag==false)
		{
		    alert("Select an option value")
			
			return false;
			
		}
	}
	else
	{
		alert("Cann't Proceed")
		return false
	}
}

//// E-store Functions....
function validate_step1_estore(s1,step2,step3)
{
	if(trim(s1.id.value)=="")
	{
		alert("Please Select Category to List Product")
		return false
	}
	if(trim(s1.product_name.value)=="")
	{
		alert("Please Enter Product Name")
		s1.product_name.focus()
		return false
	}
	if(trim(editor.getInnerHTML())=="")
	{
		alert("Please Describe About Your Product, Enter Description")
		//s1.textdesc.focus()
		return false
	}
	//s1.tid.value=s1.Category3.value;
	hide_display(step2,step3)

}

function validate_step2_estore(s1,step3,step2)
{
	if(trim(s1.cost.value)=="")
	{
		alert("Enter Product cost")
		s1.cost.focus()
		return false
	}
	else
	{
		if (trim(s1.cost.value)==0)
		{
			alert("Product cost Greater Than '0'")
			s1.cost.focus
			return false
		}
		if (checkFloat(s1.cost.value)!=true)
		{ 
				alert("Enter a Valid Product cost");	
				s1.cost.focus();
				return false;
		}
	}
	if(trim(s1.item_location.value)=="")
	{
				alert("Enter Item location");	
				s1.item_location.focus();
				return false;
	}
	if(s1.Qty.value=="")
 		{
			alert("Enter the Quantity");
			s1.Qty.focus();
			return false; 
		}
		else if (s1.Qty.value==0)
		{
			alert("Quantity Should Greater Than '0'");
			s1.Qty.focus();
			return false; 
		}
		else 
		{
			x = allDigits(s1.Qty.value);
			if(x == false)
			{
				alert("Quantity Should be an Integer value");
				s1.Qty.focus();
				return false;
			}
		}
	
	if(s1.ListingStartTime.value=="")
	{
		alert("Please Select Bid Start Date & Time")
		s1.ListingStartTime.focus()
		return false
	}

	hide_display(step3,step2)	
}
function change_val(frm)
{
	frm.extra.value = frm.ListingDuration.value;
	return true;
}

/// E-store product adding completed...

// product Add functions
function validate_step1(s1,step2,step3)
{
	x = new Array()
	
	for (var i=0; i < 2; i++)
   	{
	   	if(s1.two_w[i].checked)	
		{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[0] = "2W Anti-Lock Brakes - "+str;
			
		}
		if(s1.four_w[i].checked)	
		{
			if(s1.four_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[1] = "4W Anti-Lock Brakes - "+str;
		}
		if (s1.front[i].checked)
	  	{
		  if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[2] = "Front Air Conditioning - "+str;
		}
		if (s1.front_rear[i].checked)
	  	{
		 	if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[3] = "Front &amp; Rear Air Conditioning - "+str;
		}
		if (s1.cruise_control[i].checked)
	  	{
		 	if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[4] = "Cruise Control - "+str;
		}
		if (s1.fm_radio[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[5] = "AM/FM Radio - "+str;
		}
		if (s1.cassette[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[6] = "Cassette - "+str;
		}
		if (s1.cd[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[7] = "Compact Disc - "+str;
		}
		if (s1.cd_changer[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[8] = "CD Changer - "+str;
		}
		if (s1.premium_radio[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[9] = "Premium Radio - "+str;
		}
		if (s1.dvd[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[10] = "DVD Entertainment System - "+str;
		}
		if (s1.cup_holder[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[11] = "Cup Holder - "+str;
		}
		if (s1.leather_seats[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[12] = "Leather seats - "+str;
		}
		if (s1.navigation_sys[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[13] = "Navigation System - "+str;
		}
		if (s1.privacy_glass[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[14] = "Privacy Glass - "+str;
		}
		if (s1.hands_free[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[15] = "Hands Free Phone - "+str;
		}
		if (s1.power_locks[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[16] = "Power Locks - "+str;
		}
		if (s1.power_outlets[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[17] = "Power Outlets - "+str;
		}
		if (s1.power_mirror[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[18] = "Power Mirrors - "+str;
		}
		if (s1.remote_mirror[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[19] = "Remote Mirrors - "+str;
		}
		if (s1.power_seat[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[20] = "Power Seat - "+str;
		}
		if (s1.dual_power[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[21] = "Dual Power Seats - "+str;
		}
		if (s1.folding_rear[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[22] = "Folding Rear Seat - "+str;
		}
		if (s1.moon[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[23] = "Moon Roof - "+str;
		}
		if (s1.sun[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[24] = "Sun Roof - "+str;
		}
		if (s1.remote_key[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[25] = "Remote Keyless Entry - "+str;
		}
		if (s1.luggage[i].checked)
	  	{
		  if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[26] = "Luggage Rack - "+str;
		}
		if (s1.rear_win[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[27] = "Rear Window Defroster - "+str;
		}
		if (s1.tilt[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[28] = "Tilt Wheel - "+str;
		}
		if (s1.tachometer[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[29] = "Tachometer - "+str;
		}
		if (s1.traction[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[30] = "Traction Control - "+str;
		}
		if (s1.power_win[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[31] = "Power Windows - "+str;
		}
		if (s1.upgraded[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[32] = "Upgraded Wheels - "+str;
		}
		if (s1.power_steer[i].checked)
	  	{
			if(s1.two_w[i].value == 0){
				str="Standard"
			}
			else {
				str="Not available"
			}
			x[33] = "Power Steering - "+str;
		}
	}
	s1.equipment.value = x
	//confirm(x)
	//alert(x.length)
	
	if(trim(s1.id.value)=="")
	{
		alert("Please Select Category to List Product")
		return false
	}
	if(trim(s1.product_name.value)=="")
	{
		alert("Please Enter Product Name")
		s1.product_name.focus()
		return false
	}
	if(trim(editor.getInnerHTML())=="")
	{
		alert("Please Describe About Your Product, Enter Description")
	//	s1.textdesc.focus()
		return false
	}
	if(s1.flag.value == 1)
	{
		if(s1.model.value == "")
		{
			alert("Enter the Model")
			s1.model.focus()
			return false;
		}
		if(s1.make.value == "")
		{
			alert("Enter the Make")
			s1.make.focus()
			return false;
		}
		if(s1.year1.value == "0")
		{
			alert("Select the Year")
			s1.year1.focus()
			return false;
		}
		if(s1.vin.value == "")
		{
			alert("Enter the Vehicle Identification Number")
			s1.vin.focus()
			return false;
		}
		if(isNaN(s1.vin.value))
		{
			alert("Vehicle Identification Number should be numeric")
			s1.vin.focus()
			return false;
		}
		if(s1.mileage.value == "")
		{
			alert("Enter the Mileage")
			s1.mileage.focus()
			return false;
		}
		if(isNaN(s1.mileage.value))
		{
			alert("Mileage should be numeric")
			s1.mileage.focus()
			return false;
		}
		/*if(add_prod.color.value == "0")
		{
			alert("Select the Color")
			add_prod.color.focus()
			return false;
		}*/
		if(s1.cc.value == "")	
		{
			alert("Enter the Cubic Capacity(CC)")
			s1.cc.focus()
			return false;
		}
		if(isNaN(s1.cc.value))	
		{
			alert("Cubic Capacity(CC) should be numeric")
			s1.cc.focus()
			return false;
		}
	}
	if(s1.flag.value == 2)
	{
		if(s1.address.value == "")
		{
			alert("Enter the Address")
			add_prod.address.focus()
			return false;
		}
	/*	if(s1.zip.value == "")
		{
			alert("Enter the Zip")
			s1.zip.focus()
			return false;
		}
		if(isNaN(s1.zip.value))
		{
			alert("Zip should be numeric")
			s1.zip.focus()
			return false;
		}  */
		if(s1.avail.value == "0")
		{
			alert("Select the Availability")
			s1.avail.focus()
			return false;
		}
		if(s1.type.value == "0")
		{
			alert("Select the Type")
			s1.type.focus()
			return false;
		}
		if(s1.year2.value == "")
		{
			alert("Enter the Year")
			s1.year2.focus()
			return false;
		}
		if(s1.sft.value == "")
		{
			alert("Enter the Square Foot")
			s1.sft.focus()
			return false;
		}
		if(isNaN(s1.sft.value))
		{
			alert("Square Foot should be numeric")
			s1.sft.focus()
			return false;
		}
		if(s1.size.value == "")
		{
			alert("Enter the Size(Acres)")
			s1.size.focus()
			return false;
		}
		if(isNaN(s1.size.value))
		{
			alert("Size(Acres) should be numeric")
			s1.size.focus()
			return false;
		}
		if(isNaN(s1.no_bedroom.value))
		{
			alert("No. of Bed Rooms should be numeric")
			s1.no_bedroom.focus()
			return false;
		}
		if(isNaN(s1.no_bathroom.value))
		{
			alert("No. of Bath Rooms should be numeric")
			s1.no_bathroom.focus()
			return false;
		}
	}
	if(s1.flag.value == 3)
	{
		if(s1.title.value == "")
		{
			alert("Enter the Song Title")
			s1.title.focus()
			return false;
		}
		if(s1.artist.value == "")
		{
			alert("Enter the Artist Name")
			s1.artist.focus()
			return false;
		}
		if(s1.album.value == "")
		{
			alert("Enter the Album Name")
			s1.album.focus()
			return false;
		}
		if(s1.release_date.value == "")
		{
			alert("Enter the Release Date")
			s1.release_date.focus()
			return false;
		}
		if(s1.label.value == "")
		{
			alert("Enter the Label")
			s1.label.focus()
			return false;
		}
		if(s1.genre.value == "")
		{
			alert("Enter the Genre")
			s1.genre.focus()
			return false;
		}
		if(s1.file_format.value == "")
		{
			alert("Enter the File Format")
			s1.file_format.focus()
			return false;
		}
		if(s1.add_info.value == "")
		{
			alert("Enter the Additional Information")
			s1.add_info.focus()
			return false;
		}
		if(s1.samp_url.value == "")
		{
			alert("Upload the Sample Audio file")
			s1.samp_url.focus()
			return false;
		}
		if(s1.prod_url.value == "")
		{
			alert("Upload the Audio file")
			s1.prod_url.focus()
			return false;
		}
	}
	hide_display(step2,step3)
}

function validate_step2(s1,step3,step2)
{
	if(trim(s1.auctiontype.value)=="")
	{
		alert("Select an Auction type")
		s1.auctiontype.focus()
		return false
	}
	if(trim(s1.bidstartamt.value)=="")
	{
		if(s1.auctiontype.value == "estore")
		alert("Enter the Product Cost")
		else
		alert("Enter Bid Start Amount")
		s1.bidstartamt.focus()
		return false
	}
	if(s1.auctiontype.value == "estore")
	{
		if((s1.exc.value == "0")||(s1.exc.value == ""))
		{
			alert("Enter the Exchange Rate")
			s1.exc.focus();
			return false;
		}
	}
	else
	{
		if (trim(s1.bidstartamt.value)==0)
		{
			alert("Bid Start Amount Greater Than '0'")
			s1.bidstartamt.focus
			return false
		}
		if (checkFloat(s1.bidstartamt.value)!=true)
		{ 
			alert("Enter a Valid Bid Start Amount");	
			s1.bidstartamt.focus();
			return false;
		}
		
	}
	if(s1.auctiontype.value == "Dutch Auction")
	{
		if(s1.Qty.value=="")
 		{
			alert("Enter the Quantity");
			s1.Qty.focus();
			return false; 
		}
		else if (s1.Qty.value==0)
		{
			alert("Quantity Should Greater Than '0'");
			s1.Qty.focus();
			return false; 
		}
		else 
		{
			x = allDigits(s1.Qty.value);
			if(x == false)
			{
				alert("Quantity Should be an Integer value");
				s1.Qty.focus();
				return false;
			}
		}
	}
	if(s1.auctiontype.value == "Reserve Auction")
	{
		if(s1.prodreserveprice.value=="")
	 	{
			alert("Enter the Reserve Price");	
			s1.prodreserveprice.focus();
			return false; 
		}
		if (checkFloat(s1.prodreserveprice.value)!=true)
		{ 
				alert("Enter a Valid Reserve Price");	
				s1.prodreserveprice.focus();
				return false;
		}
		if(eval(s1.prodreserveprice.value)<=eval(s1.bidstartamt.value))
	 	{
			alert("Reserve Price Should Greater Than Start Amount");	
			s1.prodreserveprice.focus();
			return false; 
		}
	}
	if(s1.auctiontype.value == "Ghana Auction")
	{
		if(s1.tseconds.value=="")
	 	{
			alert("Enter the T Seconds");	
			s1.tseconds.focus();
			return false; 
		}
		if(s1.noofrunners.value=="")
	 	{
			alert("Enter the No of Runners");	
			s1.noofrunners.focus();
			return false; 
		}
		if(!(parseInt(s1.noofrunners.value)))
		{
			alert("No of Runners should be an Integer value");	
			s1.noofrunners.focus();
			return false; 
		}
		if(s1.prodmax.value=="")
	 	{
			alert("Enter the Product Selling Max Price");	
			s1.prodmax.focus();
			return false; 
		}
		if (checkFloat(s1.prodmax.value)!=true)
		{ 
				alert("Enter a Valid Max Price");	
				s1.prodmax.focus();
				return false;
		}
		if(eval(s1.prodmax.value)<=eval(s1.bidstartamt.value))
	 	{
			alert("Max Price Should Always Greater than Start Amount");	
			s1.prodmax.focus();
			return false; 
		}
		if(s1.prodcost.value == "")
		{
			alert("Enter the Fixed Amount");
			s1.prodcost.focus();
			return false;
		}
	}
	if(s1.auctiontype.value == "Extreme Auction")
	{
		if(s1.prodmax.value=="")
	 	{
			alert("Enter the Product Selling Max Price");	
			s1.prodmax.focus();
			return false; 
		}
		if (checkFloat(s1.prodmax.value)!=true)
		{ 
				alert("Enter a Valid Max Price");	
				s1.prodmax.focus();
				return false;
		}
		if(eval(s1.prodmax.value)<=eval(s1.bidstartamt.value))
	 	{
			alert("Max Price Should Always Greater than Start Amount");	
			s1.prodmax.focus();
			return false; 
		}
		if(s1.prodcost.value == "")
		{
			alert("Enter the Fixed Amount");
			s1.prodcost.focus();
			return false;
		}
	}
	if (s1.prodcost.value!="") {
		if (checkFloat(s1.prodcost.value)!=true)
			{ 
					alert("Enter a Valid Price");	
					s1.prodcost.focus();
					return false;
			}
	}
	if(s1.ListingStartTime.value=="")
	{
		alert("Please Select Bid Start Date & Time")
		s1.ListingStartTime.focus()
		return false
	}
	if(s1.weight.value == "")
	{
		alert("Please enter the Weight")
		s1.weight.focus()
		return false
	}
	if(!(parseFloat(s1.weight.value)))
	{
		alert("Enter the weight in Numerics only ")
		s1.weight.focus()
		return false
	}
	
/*	
	
	if(g.auctiontype.value == "Stock Pile!")
	{
		if(g.Qty.value=="")
 		{
			alert("Enter the Quantity");
			g.Qty.focus();
			return false; 
		}	
	}
	//for valued buys or Dutch Auction
	if(g.auctiontype.value == "Valued Buys")
	{
		if(g.prodcost.value=="")
 		{
			alert("Enter the Fixed Amount");
			g.prodcost.focus();
			return false; 
		}
		if(g.prodreserveprice.value=="")
	 	{
			alert("Enter the Reserve Price");	
			g.prodreserveprice.focus();
			return false; 
		}
	}
	
	//for Challenger Auction
	if(g.auctiontype.value == "Challenger Auction")
	{
		if(g.prodcost.value=="")
 		{
			alert("Enter the Fixed Amount");
			g.prodcost.focus();
			return false; 
		}
		if(g.prodmax.value=="")
		{
			alert("Enter the Maximum Price");
			g.prodmax.focus();
			return false; 
		}
		if(g.noofrunners.value=="")
 		{
			alert("Enter the No. of runners");
			g.noofrunners.focus();
			return false; 
		}	
	}
	
	//for Extreme Auction
	if(g.auctiontype.value == "Extreme Auction")
	{
		if(g.prodcost.value=="")
 		{
			alert("Enter the Fixed Amount");
			g.prodcost.focus();
			return false; 
		}
		if(g.prodmax.value=="")
		{
			alert("Enter the Maximum Price");
			g.prodmax.focus();
			return false; 
		}		
	}
	
	if(trim(g.prodreserveprice.value)!="")
	{
		if(checkFloat(g.prodreserveprice.value)!=true)			
		{
			alert("Enter a Valid Reserve amount");	 
			g.prodreserveprice.focus();
			return false;
		}
		else
		{
			if((trim(g.bidstartamt.value)=="")||(trim(g.bidstartamt.value)==0))
			{
				alert("Enter Bid start amount");	
				g.bidstartamt.focus();
				return false;			 
			}
			else if (checkFloat(g.bidstartamt.value)!=true)
			{ 
				alert("Enter a Valid Bid start amount");	
				g.bidstartamt.focus();
				return false;
			}
			else if(parseFloat(g.prodreserveprice.value) < parseFloat(g.bidstartamt.value))
			{
					//alert(g.prodreserveprice.value)
					//alert(g.bidstartamt.value)
				alert("Reserve price should be Greater than Bid start amount"); 	 
				g.prodreserveprice.focus();
				return false;
			}	
		}
	} */
	
	if(s1.flag2.value != "0")
	{
	    if((s1.imagename5.value=="") && (s1.imagename6.value=="") && (s1.imagename7.value=="") && (s1.imagename8.value=="") && (s1.imagename9.value==""))
		{
			alert("Select atleast one image")
			return false;
		}
	}
	hide_display(step3,step2)	
}
function validate_step3(s1)
{
	
}
function hide(a1)
{ 
	if (a1.auctiontype.value == "Extreme Auction")
	{		
		document.getElementById('fixed').style.display="";
		document.getElementById('fixed').style.visibility='visible';
		document.getElementById('maximum').style.display="";
		document.getElementById('maximum').style.visibility='visible';
		document.getElementById('reserve').style.display="none";
		document.getElementById('reserve').style.visibility='hidden';
		document.getElementById('quantity').style.display="none";
		document.getElementById('quantity').style.visibility='hidden';
		document.getElementById('tsec').style.display="none";
		document.getElementById('tsec').style.visibility='hidden';
		document.getElementById('nor').style.display="none";
		document.getElementById('nor').style.visibility='hidden';

		return true;
	}
    else if (a1.auctiontype.value == "Reserve Auction")
	{
		document.getElementById('fixed').style.display="";
		document.getElementById('fixed').style.visibility='visible';
		document.getElementById('reserve').style.display="";
		document.getElementById('reserve').style.visibility='visible';
		document.getElementById('quantity').style.display="none";
		document.getElementById('quantity').style.visibility='hidden';
		document.getElementById('maximum').style.display="none";
		document.getElementById('maximum').style.visibility='hidden';
		document.getElementById('tsec').style.display="none";
		document.getElementById('tsec').style.visibility='hidden';
		document.getElementById('nor').style.display="none";
		document.getElementById('nor').style.visibility='hidden';

		return true;
	}
	else if (a1.auctiontype.value == "Ghana Auction")
	{
		document.getElementById('fixed').style.display="";
		document.getElementById('fixed').style.visibility='visible';
		document.getElementById('maximum').style.display="";
		document.getElementById('maximum').style.visibility='visible';
		document.getElementById('tsec').style.display="";
		document.getElementById('tsec').style.visibility='visible';
		document.getElementById('nor').style.display="";
		document.getElementById('nor').style.visibility='visible';
		document.getElementById('quantity').style.display="none";
		document.getElementById('quantity').style.visibility='hidden';
		document.getElementById('reserve').style.display="none";
		document.getElementById('reserve').style.visibility='hidden';
		return true;
	}
	else if (a1.auctiontype.value == "Dutch Auction")
	{
		document.getElementById('quantity').style.display="";
		document.getElementById('quantity').style.visibility='visible';
		document.getElementById('reserve').style.display="none";
		document.getElementById('reserve').style.visibility='hidden';
		document.getElementById('fixed').style.display="none";
		document.getElementById('fixed').style.visibility='hidden';
		document.getElementById('maximum').style.display="none";
		document.getElementById('maximum').style.visibility='hidden';
		document.getElementById('tsec').style.display="none";
		document.getElementById('tsec').style.visibility='hidden';
		document.getElementById('nor').style.display="none";
		document.getElementById('nor').style.visibility='hidden';

		return true;
	}
	else if (a1.auctiontype.value == "Standard Auction")
	{
		document.getElementById('fixed').style.display="";
		document.getElementById('fixed').style.visibility='visible';
		document.getElementById('quantity').style.display="none";
		document.getElementById('quantity').style.visibility='hidden';
		document.getElementById('reserve').style.display="none";
		document.getElementById('reserve').style.visibility='hidden';
		document.getElementById('maximum').style.display="none";
		document.getElementById('maximum').style.visibility='hidden';
		document.getElementById('tsec').style.display="none";
		document.getElementById('tsec').style.visibility='hidden';
		document.getElementById('nor').style.display="none";
		document.getElementById('nor').style.visibility='hidden';

		return true;
	}
}


function getvalue(x,id)
{
	id.value=x.value;
	//alert(id.value);
}

function hide_display(div1,s1)
{
	if (s1=="step1")
	{
		step1.style.display=""
		step2.style.display="none"
		step3.style.display="none"
	} 
	else if(s1=="step2") {
		step2.style.display=""
		step1.style.display="none"
		step3.style.display="none"
	}
	else if (s1=="step3"){
		if(add_prod.case1.value != 11)
			ship.style.display=""
		step3.style.display=""
		step1.style.display="none"
		step2.style.display="none"
	}
}

function display_pictures()
{
	if(pictures.style.display=="none")
	{
		pictures.style.display=""
		add_prod.flag2.value = 1
	}
	else
	{
		add_prod.flag2.value = 0
		pictures.style.display="none"
	}
}

function hide_all()
{
	step2.style.display="none"
	step3.style.display="none"
}

// deleting email...
		
		
function validate_s_inbox(k)
{
	flag="No"
	if(form1.Mid)
{
	i=form1.Mid.length
	if (i>1)
	{
		for(i1=0;i1<i;i1++)
		{
		 	if(form1.Mid[i1].checked)
			flag="yes"
		}
	}
	else
	{
		if(form1.Mid.checked)
		flag="yes"
	}
}
	if (flag=="yes")
	{
		form1.action='seller/seller_tasks1.php';
		form1.submit();
		return true;
	}
	else
	{
		alert("Select records to delete")
		return false
	}
}
// deleting email over ..

/// estore functions

function validate_estore(s1)
{
	if(trim(s1.store_name.value)=="")
	{
		alert("Enter Store Name")
		s1.store_name.focus()
		return false;
	}
	if(trim(s1.abt.value)=="")
	{
		alert("Enter Store Description")
		s1.abt.focus()
		return false;
	}
	if(trim(s1.cat.value)=="")
	{
		alert("Enter Store Category")
		s1.cat.focus()
		return false;
	}
	if(trim(s1.policy.value)=="")
	{
		alert("Enter Store Privacy Policy")
		s1.policy.focus()
		return false;
	}
	if(trim(s1.ship_policy.value)=="")
	{
		alert("Enter Store Shipping Policy")
		s1.ship_policy.focus()
		return false;
	}
}
/// add payment methods

function location_addpayment(form)
	{
		location.href = "add_payment_gateway.php?pay="+form.paytype.value;
	}
	function validate_addpayment(form)
	{
		if((form.pay.value== "Authorize") || (form.pay.value== "2checkout") || (form.pay.value== "Secpay") || (form.pay.value== "psigate") || (form.pay.value== "Worldpay") || (form.pay.value== "Paypal"))
		{
			if(form.login.value == "")
			{
				alert("Enter the login");
				return false;
			}
		}
		else
		{
			if(form.addinfo.value == "")
			{
				alert("Enter the additional information");
				return false;
			}
		}
		return true;
	}


function validate_payment_one(g)
{
	// var g=window.document.forms[0];
	 if(g.addinfo.value=="")
	 {
		 alert ("Please enter the additional info");
		 g.addinfo.focus();
		 return false;
	 }
	 return true;
}
function validate_payment_two(g)
{
	// var g=window.document.forms[0];
	 if(g.login.value=="")
	 {
		 alert ("Please enter login");
		 g.login.focus();
		 return false;
	 }
	 return true;
}

/// Editing the Seller details..
function submit_seller_edit(regform)
{
		
			flg= true;
		//clrflds(regform);
	day=regform.day.value;
	month=regform.month.value;
	year=regform.year.value;

	date=year+"-"+month+"-"+day;
	regform.dateofbirth.value=date;
	a2=DiffYD(trim(regform.dobvalidate.value),date)

	 if(trim(regform.firstname.value)=="")
	 {
	// alert("ok")
	 	alert("Please Enter First Name")
		regform.firstname.focus();
		return false
	 }
	 if(trim(regform.lastname.value)=="")
	 {
		alert("Please Enter Last Name")
		regform.lastname.focus();
		return false
	 } 
	if(trim(regform.company.value)=="")
	 {
		alert("Please Enter Company Name")
		regform.company.focus();
		return false
	 }

	if(trim(regform.street.value)=="")
	 {
		alert("Please Enter Street Name")
		regform.street.focus();
		return false
	 }
	if(trim(regform.city.value)=="")
	 {
		alert("Please Enter City Name")
		regform.city.focus();
		return false
	 }
	 if(trim(regform.state.value)=="")
	 {
	 	alert("Please Enter State Name")
		regform.state.focus();
		return false
	 }
	 /*
	if(trim(regform.zip.value)=="")
	 {
	 	alert("Please Enter Zip Code")
		regform.zip.focus();
		return false
	 }
	if (checkNum(regform.zip.value)!=true)
	{
		alert("Please Enter Correct Zip Code")
		regform.zip.focus();
		return false
	}*/
	/*if(regform.country.value=="USA"){
		var s=regform.zip.value;
		if (s.length!=5)
		{
			alert("Please Enter Correct Zip Code")
			regform.zip.focus();
			return false
		}
	}*/
		 
	if(trim(regform.email.value)=="")
	 {
	 	alert("Please Enter Email")
		regform.email.focus();
		return false
    }
	 else
	{
					st=regform.email.value;
					if(checkEmail(st)==false)
					{
						alert("Please Enter Correct Email")
						regform.email.focus();
						return false
					}
		}
	    if(trim(regform.day.value)=="")
	 {
		alert("Please Select Day")
		regform.day.focus();
		return false
	 }
	 if(trim(regform.month.value)=="")
	 {
		alert("Please Select Month")
		regform.month.focus();
		return false
	 }
	 if(trim(regform.year.value)=="")
	 {
		alert("Please Select year")
		regform.year.focus();
		return false
	 }
	 if(a2<18)
	{
		
		alert("Sorry, You are Under-aged, you cannot proceed further");
		//}
		regform.day.focus();
		return false; 
	}
	else
	{
		regform.age.value=a2
		
	}
	 if(trim(regform.comp_phone.value)=="")
	 {
		alert("Please Enter Company Phone")
		regform.comp_phone.focus();
		return false
	 }	  
	 else
	 {
	 	 if (checkNum(regform.comp_phone.value)!=true)
		{
			alert("Please Enter Valid Phone No.")
			regform.comp_phone.focus();
			return false
		}
	 }
	 if(trim(regform.phone1.value)=="")
	 {
		alert("Please Enter Phone")
		regform.phone1.focus();
		return false
	 }	  
	 else
	 {
	 	 if (checkNum(regform.phone1.value)!=true)
		{
			alert("Please Enter Valid Phone No.")
			regform.phone1.focus();
			return false
		}
	 }
	 if (checkNum(regform.phone2.value)!=true)
	{
		alert("Please Enter Valid Phone No.")
		regform.phone2.focus();
		return false
	}
	 if(trim(regform.ship_pol.value)=="")
	 {
		alert("Please Enter Shipping policy")
		regform.ship_pol.focus();
		return false
	 }	  
	 if(trim(regform.sell_pol.value)=="")
	 {
		alert("Please Enter Seller's Policy")
		regform.sell_pol.focus();
		return false
	 }	  
	 if(trim(regform.seller_logo.value)=="")
	 {
		alert("Please Upload Seller's Logo")
		regform.seller_logo.focus();
		return false
	 }	  

	 if(regform.age.value=="")
	 {
		alert("Please Enter Age")
		regform.age.focus();
		return false
	 }
	if (checkNum(regform.age.value)!=true)
	{
		alert("Please Valid Age")
		regform.age.focus();
		return false
	}

	 if(trim(regform.userid.value)=="")
	 {
		alert("Please Enter Userid")
		regform.userid.focus();
		return false
	 }
	 else
	 {
	 	var s=regform.userid.value;
		if (s.length<6)
		{
			alert("UserID should have min. '6' characters")
			regform.userid.focus();
			return false
		}
	 }
	 if(trim(regform.password.value)=="")
	 {
		alert("Please Enter Password")
		regform.password.focus();
		return false
	 }
	 else
	 {
	 	var s=regform.password.value;
		if (s.length<6)
		{
			alert("Password should have min. '6' characters")
			regform.password.focus();
			return false
		}
	 }
	if(trim(regform.confirmpassword.value)=="")
	 {
		alert("Please Confirm Password")
		regform.confirmpassword.focus();
		return false
	 }
	if(regform.password.value!=regform.confirmpassword.value)
	 {
		alert("Password and Confirm Password are not Same")
		regform.confirmpassword.focus();
		return false
	 }
	 
    if(trim(regform.s_answer.value)=="")
	 {
		alert("Please Enter Answer for Secret Question")
		regform.s_answer.focus();
		return false
	 }
	 if(regform.terms.checked==false)
	  {
	 	alert("To Register You have to Accept Our Terms & Conditions")
		return false
	 }
  	 
}
function validate_check(s)
{
	
	flag=false
	if(s.service_id)
	{
		var len=s.service_id.length
		if (len>1)
		{
			for(i=0;i<len;i++)
			{
				if(s.service_id[i].checked)	
					flag=true;
			}
	
		}
		else
		{
			if(s.service_id.checked)	
				flag=true;
		}
			
	}
	if (flag==false)	
	{
		alert("Select a plan to proceed")
		return false
	}
	else
	{
		return true
	}
}


function validate_flatplan(s)
{
	if (s.txtDeliveryMethod.value=="")
	{
		alert("Please Enter Delivery Method")
		s.txtDeliveryMethod.focus();
		return false;
	}
	
	if (s.startprice.value!=="")
	{
		if ((checkFloat(s.startprice.value))!= true)
		{
		alert("Enter a Valid Starting Price");	
				s.startprice.focus();
				return false;
		}
	}
	else
	{
		alert("Please Enter Starting Price");	
		s.startprice.focus();
		return false;
	}
	if (s.endprice.value!=="")

	{
		if ((checkFloat(s.endprice.value))!= true)
	{
			alert("Enter a Valid Ending Price");	
			s.endprice.focus();
			return false;
	}
	}
	else
	{
			alert("Please enter Ending Price");	
			s.endprice.focus();
			return false;
	}
	if (s.txtfirstitemprice.value!=="")
	{
	
		if ((checkFloat(s.txtfirstitemprice.value))!= true)
		{
			alert("Enter a Valid First Item Price");	
			s.txtfirstitemprice.focus();
			return false;
		}
	}
	else
	{
			alert("Please enter First Item Price");	
			s.txtfirstitemprice.focus();
			return false;
	}
	if (s.txtadditionalprice.value!=="")
	{
		if ((checkFloat(s.txtadditionalprice.value))!= true)
		{
			alert("Enter a Valid Additional Item Price");	
			s.txtadditionalprice.focus();
			return false;
		}
	}
	else
	{
			alert("Please enter Additional Item Price");	
			s.txtadditionalprice.focus();
			return false;
	}
	

	
}
function checkFloat(str)
 {
	if (!str) return 0;
	dot = 0;
	for (var i = 0; i < str.length; i++) 
	{
		var ch = str.substring(i, i+1);
		if ((ch < "0" || "9" < ch) && ch != '.')
		{
			return false;
		}
		else
		{
			if(ch==".")
			{
			dot++;
			}
			
		}
		if(dot>1)
		{
		return false
		}
	 }
	return true;
  }

function ship_type_validate(s)
{
	if ((s.shipping_type.value=="flat") && (s.flatrate_count.value=="0"))
	{
		alert("Before You Select Flat Rate, You Need to Define the Plans First")
		return false
	}
}
function show_window(s1)
{
	if (s1.value!="")
	{
		MM_openBrWindow_scroll('../templates/default_template_preivew.php?css='+s1.value,'aa','')
	}
}

//////////////////////////////// all Seller panel functions Ending///////////////////////////////

//////////////////////////////// all admin panel functions///////////////////////////////

				//// Deleting email..
function validate_a_inbox(k)
{
	flag="No"
	if(form1.Mid)
{
	i=form1.Mid.length
	if (i>1)
	{
		for(i1=0;i1<i;i1++)
		{
		 	if(form1.Mid[i1].checked)
			flag="yes"
		}
	}
	else
	{
		if(form1.Mid.checked)
		flag="yes"
	}
}
	if (flag=="yes")
	{
		form1.action='adm_task1.php';
		form1.submit();
		return true;
	}
	else
	{
		alert("Select records to delete")
		return false
	}
}					

// deleting email over ..
function validate_service_plan(s)
{
 var g=s;
 if(g.name.value=="")
 {
	 alert ("Please enter Plan name");
	 g.name.focus();
	 return false;
 }
 if(g.price.value=="")
 {
	 alert ("Please enter Plan Charge");
	 g.price.focus();
	 return false;
 }
 if(isNaN(g.price.value))
 {
	 alert ("Please enter correct value");
	 g.price.focus();
	 return false;
 }

}


// start add new / update news validation process//
function adm_add_new_news_validate(form)
{
	if(trim(form.news_title.value)=="")
	{
		alert ("Please Enter News Title");
		form.news_title.focus();
		return false
	}
	if(trim(form.news_description.value)=="")
	{
		alert ("Please Enter Description");
		form.news_description.focus();
		return false
	}
	if(trim(form.published_date.value)=="")
	{
		alert ("Please Select Date");
		form.published_date.focus();
		return false
	}
	if(trim(form.published_by.value)=="")
	{
		alert ("Please Enter Publisher Name");
		form.published_by.focus();
		return false
	}
	if(trim(form.status.value)=="")
	{
		alert ("Please Select News Status");
		form.status.focus();
		return false
	}	
}

// end add new / update news validation process//

function validate_contact(s)
{
	if(trim(s.c_name3.value)=="")
	{
		alert("Enter Subject")
		s.c_name3.focus()
		return false
	}
	if(trim(s.msg.value)=="")
	{
		alert("Enter Message")
		s.msg.focus()
		return false
	}
}
function adm_template_validate(s)
{
	if(trim(s.cat_name.value)=="")
	{
		alert("Please Enter Template Name")
		s.cat_name.focus()
		return false
	}
	
	if(trim(s.imagename1.value)=="")
	{
		alert("Please Upload Template File")
		return false
	}
}
function write_function(c)
{
	cat_name.innerHTML=c.MainCategory.options[c.MainCategory.selectedIndex].text + c.Category2.options[c.Category2.selectedIndex].text
}
function write_function_property(c)
{
	cat_name.innerHTML=c.MainCategory.options[c.MainCategory.selectedIndex].text + c.Category2.options[c.Category2.selectedIndex].text +"-->"+ c.Category3.options[c.Category3.selectedIndex].text
}
function adm_login_validate(s)
{
	if(s.Admin.value=="")
	{
		alert("Please Enter Your Login ID")
		s.Admin.focus();
		return false
	}
	if(s.pw.value=="")
	{
		alert("Please Enter Your Password")
		s.pw.focus();
		return false
	}
}

function adm_topcat_validate(s)
{
	if(trim(s.cat_name.value)=="")
	{
		alert("Please Enter Category Name")
		s.cat_name.focus()
		return false
	}
}
//---------------> list box function <-----------------------

function listboxItemSelected(oList1,oList2)
{
	music1=document.getElementById("music")
	if(oList1.value == 1)
	{
		auto.style.display = ""
		real.style.display = "none"
		if(music1!=null)
			music.style.display = "none"
		add_prod.flag.value = 1
		add_prod.case1.value = 1
		add_prod.ListingDuration.options[4] =  new Option('14 days', '14')
	}
	else if(oList1.value == 11)
	{
		real.style.display = ""
		auto.style.display = "none"
		if(music1!=null)
			music.style.display = "none"
		add_prod.flag.value = 2
		add_prod.case1.value = 11
		add_prod.ListingDuration.options[4] =  new Option('14 days', '14')
	}
	else if(oList1.value == 23)
	{
		real.style.display = "none"
		auto.style.display = "none"
		if(music1!=null)
			music.style.display = ""
		add_prod.flag.value = 3
	}
	else
	{
		auto.style.display = "none"
		real.style.display = "none"
		if(music1!=null)
			music.style.display = "none"
		add_prod.flag.value = 0
		add_prod.case1.value = 0
		if (add_prod.extra.value!=""){
			add_prod.ListingDuration.options[4] =  new Option('10 days ($ '+add_prod.extra.value+' fee)', '10')
		}
	}
	
	id="";
	
	if (oList2!=null)
	{
		clearComboOrList(oList2);
	
		if (oList1.selectedIndex == -1)
		{
			oList2.options[oList2.options.length] = new Option('Please make a selection from the list', '');
		} 
		else 
		{
			//alert(oList1.name + '=' + oList1.options[oList1.selectedIndex].value)
			fillListbox(oList2, oList1.name + '=' + oList1.options[oList1.selectedIndex].value);
			//alert(getvalue(oList1,k));
		}
	}
}


function listboxItemSelected1(oList1,oList2)
{
	id="";
	
	if (oList2!=null){
	clearComboOrList(oList2);
	
	if (oList1.selectedIndex == -1){
	oList2.options[oList2.options.length] = new Option('Please make a selection from the list', '');
	} else {
	//alert(oList1.name + '=' + oList1.options[oList1.selectedIndex].value)
		fillListbox(oList2, oList1.name + '=' + oList1.options[oList1.selectedIndex].value);
	//alert(getvalue(oList1,k));
	}
	}
}


function clearComboOrList(oList)
{
	//alert(oList.options.length)
	for (var i = oList.options.length - 1; i >= 0; i--)
	{
		oList.options[i] = null;
	}
	oList.selectedIndex = -1;
	//if (oList.onchange)	oList.onchange();
}

function fillListbox(oList, vValue){

if (vValue != '') {
if (assocArray[vValue]){
var arrX = assocArray[vValue];
for (var i = 0; i < arrX.length; i = i + 2){
if (arrX[i] != 'EOF') 
{
	s1=arrX[i + 1];
	oList.options[oList.options.length] = new Option(s1.replace("&#39","'"), arrX[i]);
}
}
//alert (oList.options.length)
if (oList.options.length == 1){
//oList.selectedIndex=0;
//if (oList.onchange)	oList.onchange();
}
} else {
		
			oList.options[0] = new Option('No Subcategories', '');
}
}
}


///////////////////////////// all admin panel functions ending///////////////////////////////////

/////////////////////////////// all general side function//////////////////////////////

function validate_browse(k)
{
if(trim(k.brw.value)=="")
{
alert("Please enter Search text");
k.brw.focus();
return false;
} else
{
location.href ="search_items.php?s_text="+k.brw.value;
}
}

function location_change(sid,k)
{
//alert(sid);
var sort_r=k.value;
location.href ="?id="+sid+"&sort_r="+sort_r;

}

function validate_sort(k)
{ 
var sort_r=k.sort_k.value;
var id=k.id.value;
var level=k.level.value;
var p_type=k.p_type.value;
var frid=k.frid.value;
location.href ="?id="+id+"&level="+level+"&p_type="+p_type+"&frid="+frid+"&search="+k.search.value+"&sort_r="+sort_r;
//return true;

}


function validate_askseller(k)
{
	if(trim(k.name.value)=="")
	 {
	 	alert("Please Enter Name")
		k.name.focus();
		return false;
	 }

	if(trim(k.mailid.value)=="")
	 {
	 	alert("Please Enter Email Address")
		k.mailid.focus();
		return false;
	 }
	  else
	{
					st=k.mailid.value;
					if(checkEmail(st)==false)
					{
						alert("Please Enter Correct Email")
						k.mailid.focus();
						return false;
					}
		}
	
	 if(trim(k.msg.value)=="")
	 {
	 	alert("Please Enter your query")
		k.msg.focus();
		return false;
	 }
}

function validate_error(k)
{
	if(trim(k.txtFriend.value)=="")
	 {
	 	alert("Please Enter Email Address")
		k.txtFriend.focus();
		return false;
	 }
	  else
	{
					st=k.txtFriend.value;
					if(checkEmail(st)==false)
					{
						alert("Please Enter Correct Email")
						k.txtFriend.focus();
						return false;
					}
		}
	
	 if(trim(k.description.value)=="")
	 {
	 	alert("Please Enter Description")
		k.description.focus();
		return false;
	 }

}


function validate_favorite(t,t2){
	if(!t) return;
	else if (!(t2.login.value==""))
	{
		MM_openBrWindow(t,'AddList','width=300,height=450');
	}
	else
	{
		alert("To add wish list you have to login");
		location.href = "signin.php";//?frm=auction_product_detail_display.php?p_id="+t2.p_id.value;
		//MM_openBrWindow(t,'AddList','width=300,height=450');
		//return true;
	}
}

function send_friend(k)
{
	 if(trim(k.txtFriend.value)=="")
	 {
	 	alert("Please Enter Email Address")
		k.txtFriend.focus();
		return false;
	 }
	  else
	{
					st=k.txtFriend.value;
					if(checkEmail(st)==false)
					{
						alert("Please Enter Correct Email")
						k.txtFriend.focus();
						return false;
					}
		}

	 if(trim(k.description.value)=="")
	 {
	 	alert("Please Enter Message")
		k.description.focus();
		return false;
	 }

}


function submit_validate(regform)
{
		
	flg= true;
		//clrflds(regform);
	day=regform.day.value;
	month=regform.month.value;
	year=regform.year.value;

	date=year+"-"+month+"-"+day;
	regform.dateofbirth.value=date;
	a2=DiffYD(trim(regform.dobvalidate.value),date)

	 if(trim(regform.firstname.value)=="")
	 {
	// alert("ok")
	 	alert("Please Enter First Name")
		regform.firstname.focus();
		return false
	 }
	 if(trim(regform.lastname.value)=="")
	 {
		alert("Please Enter Last Name")
		regform.lastname.focus();
		return false
	 }
	if(trim(regform.street.value)=="")
	 {
		alert("Please Enter Street Name")
		regform.street.focus();
		return false
	 }
	if(trim(regform.city.value)=="")
	 {
		alert("Please Enter City Name")
		regform.city.focus();
		return false
	 }
	 if(trim(regform.state.value)=="")
	 {
	 	alert("Please Enter State Name")
		regform.state.focus();
		return false
	 }
/*	if(trim(regform.zip.value)=="")
	 {
	 	alert("Please Enter Zip Code")
		regform.zip.focus();
		return false
	 }
	if (checkNum(regform.zip.value)!=true)
	{
		alert("Please Enter Correct Zip Code")
		regform.zip.focus();
		return false
	} */
	/*if(regform.country.value=="USA"){
		var s=regform.zip.value;
		if (s.length!=5)
		{
			alert("Please Enter Correct Zip Code")
			regform.zip.focus();
			return false
		}
	}*/
		 
	if(trim(regform.email.value)=="")
	 {
	 	alert("Please Enter Email")
		regform.email.focus();
		return false
    }
	 else
	{
			st=regform.email.value;
			if(checkEmail(st)==false)
			{
				alert("Please Enter Correct Email")
				regform.email.focus();
				return false
			}
	}
	if(trim(regform.day.value)=="")
	 {
		alert("Please Select Day")
		regform.day.focus();
		return false
	 }
	 if(trim(regform.month.value)=="")
	 {
		alert("Please Select Month")
		regform.month.focus();
		return false
	 }
	 if(trim(regform.year.value)=="")
	 {
		alert("Please Select year")
		regform.year.focus();
		return false
	 }
	 if(a2<18)
	{
		
		alert("Sorry, You are Under-aged, you cannot proceed further");
		//}
		regform.day.focus();
		return false; 
	}
	else
	{
		regform.age.value=a2
		
	}

	 if(regform.phone1.value=="")
	 {
		alert("Please Enter Phone")
		regform.phone1.focus();
		return false
	 }	  
	 else
	 {
	 	 if (checkNum(regform.phone1.value)!=true)
		{
			alert("Please Enter Valid Phone No.")
			regform.phone1.focus();
			return false
		}
	 }
	 if (checkNum(regform.phone2.value)!=true)
	{
		alert("Please Enter Valid Phone No.")
		regform.phone2.focus();
		return false
	}
	 if(regform.age.value=="")
	 {
		alert("Please Enter Age")
		regform.age.focus();
		return false
	 }
	if (checkNum(regform.age.value)!=true)
	{
		alert("Please Valid Age")
		regform.age.focus();
		return false
	}

	 if(trim(regform.userid.value)=="")
	 {
		alert("Please Enter User ID")
		regform.userid.focus();
		return false
	 }
	 else
	 {
	 	var s=regform.userid.value;
		if (s.length<6)
		{
			alert("User ID should have min. '6' characters")
			regform.userid.focus();
			return false
		}
		if(s.match(" "))
		{
			alert("User ID should not have spaces")
			regform.userid.focus();
			return false; 
		}
		
		var re = /^[A-Za-z]\w{6,}$/;
		
		if (!re.test(regform.userid.value)) { alert("Please enter a valid User ID"); regform.userid.focus(); return false}
	 }
	 if(trim(regform.password.value)=="")
	 {
		alert("Please Enter Password")
		regform.password.focus();
		return false
	 }
	 else
	 {
	 	var s=regform.password.value;
		if (s.length<6)
		{
			alert("Password should have min. '6' characters")
			regform.password.focus();
			return false
		}
		var re = /^[A-Za-z]\w{6,}$/;
		
		if (!re.test(regform.password.value)) { alert("Please enter a valid Password"); regform.password.focus(); return false}
	 }
	if(trim(regform.confirmpassword.value)=="")
	 {
		alert("Please Confirm Password")
		regform.confirmpassword.focus();
		return false
	 }
	if(regform.password.value!=regform.confirmpassword.value)
	 {
		alert("Password and Confirm Password are not Same")
		regform.confirmpassword.focus();
		return false
	 }
	 
    if(trim(regform.s_answer.value)=="")
	 {
		alert("Please Enter Answer for Secret Question")
		regform.s_answer.focus();
		return false
	 }
	 if(regform.terms.checked==false)
	  {
	 	alert("To Register You have to Accept Our Terms & Conditions")
		return false
	 }
  	 
}
function USAchck(regform)
{
	g=regform.country;
		if (g.options[g.selectedIndex].value=="USA") 
		{
			regform.state.style.display=""
			regform.state2.style.display="none"
			//regform.zip.maxlength=5;
		}

		if (g.options[g.selectedIndex].value!="USA")
		{
			regform.state.style.display="none"
			regform.state2.style.display=""
			//regform.zip.maxlength=6;
		}
	}
function validate_login_new(s)
{
	if(trim(s.userid.value)=="")
	{
		alert("Please Enter UserID")
		s.userid.focus()
		return false
	}
	 else
	 {
	 	var s1=s.userid.value;
		if (s1.length<6)
		{
			alert("UserID should have min. '6' characters")
			s.userid.focus();
			return false
		}
	 }
	 if(trim(s.password.value)=="")
	{
		alert("Please Enter Password")
		s.password.focus()
		return false
	}
	 else
	 {
	 	var s1=s.password.value;
		if (s1.length<6)
		{
			alert("Password should have min. '6' characters")
			s.password.focus();
			return false
		}
	 }
}
function validate_password(s)
{
	if (trim(s.oldpw.value)=="")
	{
		alert("Enter Old Password")
		s.oldpw.focus();
		return false;
	}

	if (trim(s.newpw.value)=="")
	{
		alert("Enter New Password")
		s.newpw.focus();
		return false;
	}
	 else
	 {
	 	var s1=s.newpw.value;
		if (s1.length<6)
		{
			alert("Password should have min. '6' characters")
			s.newpw.focus();
			return false
		}
	 }

	if (trim(s.confirmpw.value)=="")
	{
		alert("Enter Confirm Passwrod")
		s.confirmpw.focus();
		return false;

	}
	if (s.newpw.value!=s.confirmpw.value)
	{
		alert("Confirm Passwrod should be same with new password")
		s.confirmpw.focus();
		return false;
	}

}

function validate_serach(s)
{
	if(s.cate.value=="0")
	{
		alert("No Categories")
		return false
	}
}

function txtfocus()
{
	buy.buyitnow.focus();
}

// for slide show rotation of the products
current = 0;
function next(slideform) 
{
	if (slideform.slide[current+1]) 
	{
		slideform.show.src = slideform.slide[current+1].value;
		slideform.slide.selectedIndex = ++current;
   	}
	else first(slideform);
}
function previous(slideform) 
{
	if (current-1 >= 0) 
	{
		slideform.show.src = slideform.slide[current-1].value;
		slideform.slide.selectedIndex = --current;
   	}
	else last(slideform);
}
function first(slideform) 
{
	current = 0;
	slideform.show.src = slideform.slide[0].value;
	slideform.slide.selectedIndex = 0;
}
function last(slideform) 
{
	current = slideform.slide.length-1;
	slideform.show.src = slideform.slide[current].value;
	slideform.slide.selectedIndex = current;
}
function ap(slideform,text) 
{
	slideform.slidebutton.value = (text == "Stop") ? "Start" : "Stop";
	rotate();
}
function change(slideform,a1,a2,wd,he) 
{
	current = a2;
	slideform.show.width=wd
	slideform.show.height=he
	slideform.show.src = a1;
	
	//alert(slideform.show.)
}
function rotate(slideform) 
{
	if (slideform.slidebutton.value == "Stop") 
	{
		current = (current == slideform.slide.length-1) ? 0 : current+1;
		slideform.show.src = slideform.slide[current].value;
		slideform.slide.selectedIndex = current;
		window.setTimeout("rotate()", rotate_delay);
   	}
}
function search_estore_validate(s1)
{
	if(trim(s1.search1.value)=="")
	{
		alert("Enter search key word")
		s1.search1.focus()
		return false
	}
}
function validate_new_extra_plan(frm)
{
	if(frm.fee_type.value == "")
	{
		alert("Enter the Fee Type");
		frm.fee_type.focus()
		return false;
	}
	else if(frm.label.value == "")
	{
		alert("Enter the Label");
		frm.label.focus()
		return false;
	}
	else if(frm.amount.value == "")
	{
		alert("Enter the Amount");
		frm.amount.focus()
		return false;
	}
	else if (isNaN(frm.amount.value))
	{
		alert("Amount should be Numeric");
		frm.amount.value = ""
		frm.amount.focus()
		return false;
	}
	frm.action= "added_new_plan.php?fee_type="+frm.fee_type.value+"&label="+frm.label.value+"&amount="+frm.amount.value;
}

function validate_extra_plan_edit(frm)
{
	if(trim(frm.amount.value) == "")
	{
		alert("Enter the Amount")
		frm.amount.focus()
		return false
	}
	if(parseFloat(frm.amount.value))
		return true
	else
	{
		alert("Enter Numeric values only")
		frm.amount.value = ""
		frm.amount.focus()
		return false
	}
}

function check_bold()
{
	if(add_prod.bold1.value == "yes")
		add_prod.bold1.value = "no"
	else
		add_prod.bold1.value = "yes"
}

function check_border()
{
	if(add_prod.border1.value == "yes")
		add_prod.border1.value = "no"
	else
		add_prod.border1.value = "yes"
}

function check_highlight()
{
	if(add_prod.highlight1.value == "yes")
		add_prod.highlight1.value = "no"
	else
		add_prod.highlight1.value = "yes"
}
/*
function check_user()
{
	if(ss.login.value == ss.user.value)
	{
		alert("Seller Cannot participate in the Auction")
		return false;
	}
	if((ss.bid_amt.value == "")&&(ss.maxbid.value == "" ))
	{
		alert("Enter the Bid Value or the Max. Bid Value");
		return false;	
	}
	if(isNaN(ss.bid_amt.value))
	{
		alert("Bid Amount should be a Numeric value")
		ss.bid_amt.value = ""
		ss.bid_amt.focus()
		return false;
	}
	if(isNaN(ss.maxbid.value))
	{
		alert("Max. Bid Amount should be a Numeric value")
		ss.maxbid.value = ""
		ss.maxbid.focus()
		return false;
	}
	else
		return true;
}*/

function validate(form)
{
	if(form.login.value == "")
	{
		alert("Please Login before you participate in the bidding");
		location.href = "signin.php?frm=auction_product_detail_display.php?p_id="+form.p_id.value;
		return false;
	}
	if(form.login.value != "")
	{
		if(form.login.value == form.user.value)
		{
			alert("Seller cannot participate in the Auction");
			return false;
		}
	}
	if(form.maxbid)
	{
		if(form.bid_amt.value == "" && form.maxbid.value == "")
		{
			alert("Enter the Exact Bid or the Maximum Bid");
			return false;
		}
		else if(parseFloat(form.maxbid.value) < parseFloat(form.min_bid.value))
		{
			alert("Bid value should be greater than "+form.min_bid.value);
			form.maxbid.value = "";
			form.maxbid.focus();
			return false;	
		}
		else if(parseFloat(form.bid_amt.value) < parseFloat(form.min_bid.value))
		{
			alert("Bid value should be atleast "+form.min_bid.value);
			form.bid_amt.value = "";
			form.bid_amt.focus();
			return false;
		}
		if(form.qty)
		{
				if(form.qty.value == "")
				{
					alert("Enter the Quantity");
					form.qty.focus();
					return false;
				}
				else if(form.qty.value <= 0)
				{
					alert("Qunatity entered should be a positive integer");
					form.qty.focus();
					form.qty.value = "";
					return false;
				}
				if(parseInt(form.qty.value) > parseInt(form.qty1.value))
				{
					alert("The Max. Quantity available is "+form.qty1.value+" Re - enter the Quantity");
					form.qty.value = "";
					form.qty.focus();
					return false;
				}
				if(!(isInteger(form.qty.value)))
				{
					alert("Enter an integer value");
					form.qty.value = "";
					form.qty.focus();
					return false;
				}
				else
				{}
			}
			else
				return true;
	}
	else if(form.bid_amt.value == "")
	{
		alert("Enter the Bid amount");
		form.bid_amt.focus();
		return false;
	}
	if(form.bid_amt.value != "")
	{
			if(!(isFloat(form.bid_amt.value)))
			{
				alert("Enter float value");
				form.bid_amt.value = "";
				form.bid_amt.focus();
				return false;
			}
			if(parseFloat(form.bid_amt.value) < parseFloat(form.min_bid.value))
			{
				alert("Bid value should be atleast "+form.min_bid.value);
				form.bid_amt.value = "";
				form.bid_amt.focus();
				return false;
			}
			if(form.qty)
			{
				if(form.qty.value == "")
				{
					alert("Enter the Quantity");
					form.qty.focus();
					return false;
				}
				else if(form.qty.value <= 0)
				{
					alert("Qunatity entered should be a positive integer");
					form.qty.focus();
					form.qty.value = "";
					return false;
				}
				if(parseInt(form.qty.value) > parseInt(form.qty1.value))
				{
					alert("The Max. Quantity available is "+form.qty1.value+" Re - enter the Quantity");
					form.qty.value = "";
					form.qty.focus();
					return false;
				}
				if(!(isInteger(form.qty.value)))
				{
					alert("Enter an integer value");
					form.qty.value = "";
					form.qty.focus();
					return false;
				}
				else
				{}
			}
	}
	if(form.login.value!= "")
	{
			if(form.login.value == form.user.value)
			{
				alert("Seller cannot participate in the Bidding");
				return false;
			}
			else
				return true;
	}
	return true;
}

/*	else if(!(isNaN(form.bid_amt.value)))
	{
		alert("Bid amount should be Numeric");
		form.bid_amt.focus();
		return false;
	}
	else if(!(isNaN(form.maxbid.value)))
	{
		alert("Max Bid should be Numeric");
		form.maxbid.focus();
		return false;
	}*/
	
function checklogin(form)
{
	if(form.login.value != "")
	{
		if(form.login.value == form.user.value)
		{
			alert("Seller cannot participate in the Auction");
			return false;
		}
		else
		{
			location.href = "buynow_2.php?p_id="+form.p_id.value+"&login="+form.login.value+"&bidpos="+form.bidpos.value+"&qty="+form.qty_text.value;
			return true;
		}
	}
	else
	{
		alert("Please Login before you buy this item");
		location.href = "signin.php?frm=auction_product_detail_display.php?p_id="+form.p_id.value;
		return false;
	}
	return true;
}
// Bidding Process Confirm_bid	

function submit1()
{
	location.href = "confirm_bid2.php?confirmation_flag="+form1.confirmation_flag.value+"&login="+form1.login.value+"&p_id="+form1.p_id.value+"&margin_price="+form1.margin_price.value+"&min_bid="+form1.min_bid.value+"&maxbid="+form1.maxbid.value+"&bid_amt="+form1.bid_amt1.value;
}
function submit2()
{
	if(parseFloat(form1.high_prxy.value) >= parseFloat(form1.maxbid.value))
	{
		alert("Enter the amount higher than the existing Highest Proxy to proceed further");
		return false
	}	
	else
		location.href = "confirm_bid2.php?confirmation_flag="+form1.confirmation_flag.value+"&login="+form1.login.value+"&p_id="+form1.p_id.value+"&margin_price="+form1.margin_price.value+"&min_bid="+form1.min_bid.value+"&maxbid="+form1.maxbid.value;
}
function submit3()
{
	if(parseFloat(form1.high_prxy.value) == parseFloat(form1.bid_amt.value))
	{
		alert("Enter the amount that is higher or lesser than the Proxy amount existing in the system");
		return false  
	}	
	else
		location.href = "confirm_bid2.php?confirmation_flag="+form1.confirmation_flag.value+"&login="+form1.login.value+"&p_id="+form1.p_id.value+"&margin_price="+form1.margin_price.value+"&min_bid="+form1.min_bid.value+"&bid_amt="+form1.bid_amt.value;
}
function contact_seller()
{
	seller.style.display="";
}
function preview()
{
	if(window.opener.add_prod.MainCategory.value == 1)
	{
		auto.style.display=""
	}
	else if(window.opener.add_prod.MainCategory.value == 11)
	{
		real.style.display=""
	}
}
function auto_preview()
{
	s1 = window.opener.add_prod;
	for (var i=0; i < 2; i++)
		{
			if(s1.two_w[i].checked)	
			{
				if(s1.two_w[i].value == 0){
					str1="Standard"
				}
				else {
					str1="Not available"
				}
			}
			if(s1.four_w[i].checked)	
			{
				if(s1.four_w[i].value == 0){
					str2="Standard"
				}
				else {
					str2="Not available"
				}
			}
			if (s1.front[i].checked)
			{
			  if(s1.two_w[i].value == 0){
					str3="Standard"
				}
				else {
					str3="Not available"
				}
			}
			if (s1.front_rear[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str4="Standard"
				}
				else {
					str4="Not available"
				}
			}
			if (s1.cruise_control[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str5="Standard"
				}
				else {
					str5="Not available"
				}
			}
			if (s1.fm_radio[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str6="Standard"
				}
				else {
					str6="Not available"
				}
			}
			if (s1.cassette[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str7="Standard"
				}
				else {
					str7="Not available"
				}
			}
			if (s1.cd[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str8="Standard"
				}
				else {
					str8="Not available"
				}
			}
			if (s1.cd_changer[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str9="Standard"
				}
				else {
					str9="Not available"
				}
			}
			if (s1.premium_radio[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str10="Standard"
				}
				else {
					str10="Not available"
				}
			}
			if (s1.dvd[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str11="Standard"
				}
				else {
					str11="Not available"
				}
			}
			if (s1.cup_holder[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str12="Standard"
				}
				else {
					str12="Not available"
				}
			}
			if (s1.leather_seats[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str13="Standard"
				}
				else {
					str13="Not available"
				}
			}
			if (s1.navigation_sys[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str14="Standard"
				}
				else {
					str14="Not available"
				}
			}
			if (s1.privacy_glass[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str15="Standard"
				}
				else {
					str15="Not available"
				}
			}
			if (s1.hands_free[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str16="Standard"
				}
				else {
					str16="Not available"
				}
			}
			if (s1.power_locks[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str17="Standard"
				}
				else {
					str17="Not available"
				}
			}
			if (s1.power_outlets[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str18="Standard"
				}
				else {
					str18="Not available"
				}
			}
			if (s1.power_mirror[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str19="Standard"
				}
				else {
					str19="Not available"
				}
			}
			if (s1.remote_mirror[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str20="Standard"
				}
				else {
					str20="Not available"
				}
			}
			if (s1.power_seat[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str21="Standard"
				}
				else {
					str21="Not available"
				}
			}
			if (s1.dual_power[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str22="Standard"
				}
				else {
					str22="Not available"
				}
			}
			if (s1.folding_rear[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str23="Standard"
				}
				else {
					str23="Not available"
				}
			}
			if (s1.moon[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str24="Standard"
				}
				else {
					str24="Not available"
				}
			}
			if (s1.sun[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str25="Standard"
				}
				else {
					str25="Not available"
				}
			}
			if (s1.remote_key[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str26="Standard"
				}
				else {
					str26="Not available"
				}
			}
			if (s1.luggage[i].checked)
			{
			  if(s1.two_w[i].value == 0){
					str27="Standard"
				}
				else {
					str27="Not available"
				}
			}
			if (s1.rear_win[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str28="Standard"
				}
				else {
					str28="Not available"
				}
			}
			if (s1.tilt[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str29="Standard"
				}
				else {
					str29="Not available"
				}
			}
			if (s1.tachometer[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str30="Standard"
				}
				else {
					str30="Not available"
				}
			}
			if (s1.traction[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str31="Standard"
				}
				else {
					str31="Not available"
				}
			}
			if (s1.power_win[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str32="Standard"
				}
				else {
					str32="Not available"
				}
			}
			if (s1.upgraded[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str33="Standard"
				}
				else {
					str33="Not available"
				}
			}
			if (s1.power_steer[i].checked)
			{
				if(s1.two_w[i].value == 0){
					str34="Standard"
				}
				else {
					str34="Not available"
				}
			}
		}
		document.write("2W Anti-Lock Brakes - "+str1);
		document.write(" , 4W Anti-Lock Brakes - "+str2);
		document.write(" , Front Air Conditioning - "+str3);
		document.write(" , Front &amp; Rear Air Conditioning - "+str4);
		document.write(" , Cruise Control - "+str5);
		document.write(" , AM/FM Radio - "+str6);
		document.write(" , Cassette - "+str7);
		document.write(" , Compact Disc - "+str8);
		document.write(" , CD Changer - "+str9);
		document.write(" , Premium Radio - "+str10);
		document.write(" , DVD Entertainment System - "+str11);
		document.write(" , Cup Holder - "+str12);
		document.write(" , Leather seats - "+str13);
		document.write(" , Navigation System - "+str14);
		document.write(" , Privacy Glass - "+str15);
		document.write(" , Hands Free Phone - "+str16);
		document.write(" , Power Locks - "+str17);
		document.write(" , Power Outlets - "+str18);
		document.write(" , Power Mirrors - "+str19);
		document.write(" , Remote Mirrors - "+str20);
		document.write(" , Power Seat - "+str21);
		document.write(" , Dual Power Seats - "+str22);
		document.write(" , Folding Rear Seat - "+str23);
		document.write(" , Moon Roof - "+str24);
		document.write(" , Sun Roof - "+str25);
		document.write(" , Remote Keyless Entry - "+str26);
		document.write(" , Luggage Rack - "+str27);
		document.write(" , Rear Window Defroster - "+str28);
		document.write(" , Tilt Wheel - "+str29);
		document.write(" , Tachometer - "+str30);
		document.write(" , Traction Control - "+str31);
		document.write(" , Power Windows - "+str32);
		document.write(" , Upgraded Wheels - "+str33);
		document.write(" , Power Steering - "+str34);

}
function check_login1(s1,s2,s3,s4)
{
	alert(s4.value)
}
function check_login()
{
	alert("To continue with the shopping cart, you have to login")
//  	frm1.method="post";
	location.href = "signin.php?frm=estore_product_detail_display.php?id="+frm1.id.value+"&uid="+frm1.uid.value;
}

function shippinp_add()
{
	frm1.method="post";
	frm1.action="shipping_address.php?id="+frm1.id.value+"&oid="+frm1.oid.value;
	frm1.submit();
}
function chkqty()
{
	var val1,val2;
	val1 = form1.qty_text.value;
	val2 = form1.txtQty.value;
	val2 = val2-val1;
	if(val2 > 0)
	{
		alert(" Max. Quantity available is "+val1);
		form1.txtQty.value="";
		form1.txtQty.focus();
		return false;
	}
	else
	funval1();
		
	return true;
}
function funval1()
{
	var g=form1;
	if(g){
		var r=eval(g.txtrate.value);
		if(g.txtQty.value == "" || g.txtQty.value == 0)
		{
			alert("Enter the Quantity");
			g.txtQty.focus();
			return false;
		}	
		else
			var q=eval(g.txtQty.value);
		
		if(g.qty_text.value == "" || g.qty_text.value == 0)
		{
			alert("Quantity not available");
			return false;
		}
		if(q > eval(g.qty_text.value))
		{
			
			alert("Max Quantity available is "+g.qty_text.value);
			g.txtQty.focus();
			return false;
		}
		
		var s=0;
		
		if(q > 1)
		{
			var temp2;
			temp2 = q-1;
			charge = (g.add_price.value*temp2);
			charge = (charge)+(g.price.value*1)
			s = charge;
			s=eval(g.txtQty.value-1)*eval(g.add_price.value)+eval(g.first_item.value);
			//alert(s)
		}
		else
			s=eval(g.txtShip.value);
		g.txtcost.value=(r*q);
		g.txtShip.value=Math.round((s)*100)/100;
		g.txttotal.value=(r*q)+s;
		return true;
	}
	return false;
}

function funval()
{
		var g=form1;
		if(g){
		if(g.txtcost.value=="" || g.txtShip2.value=="" || g.txttotal.value=="")
		{
			alert("click on calculate");
			g.recal.focus();
			return false;
		}
		if(g.txtQty.value=="")
		{
			alert("Enter Quantity");
			g.txtQty.focus();
			return false;
		}
		if(eval(g.txtQty.value)<=0)
		{
			alert("Enter Atlest one Quantity");
			g.txtQty.focus();
			return false;
		}
		if(eval(g.txtQty.value)>0)
		{
			if(eval(g.txtQty.value)>eval(g.qty_text.value))
			{
				alert("Max Quantity Available is "+g.qty_text.value);
				g.txtQty.focus();
				return false;
			}
		}
		if(funval1())
			return true;
		else
			return false;
	}
	return false;
}
function fun123()
{
	var val1,val2;
	if(!(parseInt(form1.txtQty.value)))
	{
		alert("Please enter integer values only");
		form1.txtQty.value = ""
		form1.txtQty.focus()
		return false
	}
	if(form1.txtQty.value == "")
	{
		alert("Enter the Quantity");
		form1.txtQty.focus();
		return false;
	}
	val1 = form1.qty_text.value;
	val2 = form1.txtQty.value;
	val2 = val2-val1;
	if(val2 > 0)
	{
		alert(" Max. available Quantity is "+val1);
		form1.txtQty.value="";
		form1.txtQty.focus();
		return false;
	}
	else
	funval1();
		
	return true;
}
function validate1(frm1)
{
	frm1.action="sellerwise_invoice.php?id="+frm1.id.value
	return true;
}
function inv_validate(s)
{
	var flag=false
	var dids="";
	if (s.slno!=null)
	{
		i=s.slno.length
		if(i>1)
		{
			for(i1=0;i1<i;i1++)
			{
				if(s.slno[i1].checked)
				{
					flag=true
					if(dids=="")
					{
						dids= s.slno[i1].value
					}
					else
					{
						dids= dids+","+ s.slno[i1].value
					}
									
				}
			}
			
		}
		else
		{
			if(s.slno.checked)
			{
				flag=true
				dids= s.slno.value
			}
		}
	}
	if(flag==false)
	{
		alert("Select transactions to raise invoices")
		return false
	}
	else
	{
		s.ids.value=dids
		return true
	}
}
function validate_editlisting(frm)
{
	if(frm.cat_name.value == "")
	{
		alert("Enter the listing fee amount")
		frm.cat_name.focus()
		return false;
	}
	
}
function validate_edittrans1(frm)
{
	if(frm.cat_name222.value == "")
	{	
		alert("Enter the plan name")
		frm.cat_name222.focus()
		return false;
	}
	if(frm.cat_name22.value == "")
	{	
		alert("Enter the price range from")
		frm.cat_name22.focus()
		return false;
	}
	if(frm.cat_name23.value == "")
	{
		alert("Enter the price range to")
		frm.cat_name23.focus()
		return false;
	}
	if(frm.cat_name2.value == "")
	{
		//alert("Enter the price range to")
		frm.cat_name2.value="0"
		//return false;
	}
	if(frm.cat_name.value==""){
		frm.cat_name.value="0"
	}
	
}

function validate_edittrans(frm)
{
	if(frm.cat_name22.value == "")
	{	
		alert("Enter the price range from")
		frm.cat_name22.focus()
		return false;
	}
	if(frm.cat_name23.value == "")
	{
		alert("Enter the price range to")
		frm.cat_name23.focus()
		return false;
	}
	if(frm.cat_name2.value == "")
	{
		//alert("Enter the price range to")
		frm.cat_name2.value="0"
		//return false;
	}
	if(frm.cat_name.value==""){
		frm.cat_name.value="0"
	}
	
}
function validate_editcomm(frm)
{
	if(frm.cat_name2.value == "")
	{	
		alert("Enter the Commission Amount")
		frm.cat_name2.focus()
		return false;
	}
	else if(frm.cat_name.value == "")
	{
		alert("Enter the Discount")
		frm.cat_name.focus()
		return false;
	}
	else if(eval(frm.cat_name2.value) < eval(frm.cat_name.value))
	{
		alert("Commission Amount should be more than Discount")
		return false;
	}
}
function validate_editinvoice(frm)
{
	if(frm.cat_name2.value == "")
	{	
		alert("Enter the Invoice Amount")
		frm.cat_name2.focus()
		return false;
	}
	else if(frm.cat_name.value == "")
	{
		alert("Enter the Discount")
		frm.cat_name.focus()
		return false;
	}
	else if(eval(frm.cat_name2.value) < eval(frm.cat_name.value))
	{
		alert("Invoice Amount should be more than Discount")
		return false;
	}
}
function validate_auctionrelist()
{
	var g=window.document.forms[0];
	if(g)
	{
		if(g.product_name.value=="")
		{
			alert("Enter Product Name");
			g.product_name.focus();
			return false;
		}
		if(g.textship.value=="")
		{
			alert("Enter Shipping Description");
			g.textship.focus();
			return false;
		}
		if(g.imagename1.value=="")
		{
			alert("Upload Image Name");
			g.imagename1.focus();
			return false;
		}
		if((g.imagename1.value=="") && (g.imagename2.value=="") && (g.imagename3.value=="") && (g.imagename4.value==""))
		{
			alert("Upload Image File");
			g.margin_price.focus();
			return false;
		}
		if((g.mkdef[0].checked==false) && (g.mkdef[1].checked==false) && (g.mkdef[2].checked==false) && (g.mkdef[3].checked==false))
		{
			alert("Select The Default Image");
			g.mkdef[0].focus();
			return false;
		}
	}
}

function funck(t)
{
	if(t)
	{
		if(t.checked)
		{
			var vb=window.document.forms[0];
			var bh1=vb.mkdef[0].checked;
			var bh2=vb.mkdef[1].checked;
			var bh3=vb.mkdef[2].checked;
			var bh4=vb.mkdef[3].checked;

			if(((t.value=="1") && (vb.imagename1.value==""))  || ((t.value=="2") && (vb.imagename2.value=="")) || ((t.value=="3") && (vb.imagename3.value=="")) || ((t.value=="4") && (vb.imagename4.value=="")))
			{
				t.checked=false;
				alert("First Upload File");
				return;
			}
		}
	}
}
function validate_auctionedit()
{
	var g=window.document.forms[0];
	if(g)
	{
		if(g.product_name.value=="")
		{
			alert("Enter Product Name");
			g.product_name.focus();
			return false;
		}
		if(g.textdesc.value=="")
		{
			alert("Enter Product Description");
			g.textdesc.focus();
			return false;
		}
		if(g.textship.value=="")
		{
			alert("Enter Shipping Description");
			g.textship.focus();
			return false;
		}
		if(g.imagename1.value=="")
		{
			alert("Upload Image Name");
			g.imagename1.focus();
			return false;
		}
		if((g.imagename1.value=="") && (g.imagename2.value=="") && (g.imagename3.value=="") && (g.imagename4.value==""))
		{
			alert("Upload Image File");
			g.margin_price.focus();
			return false;
		}
		if((g.mkdef[0].checked==false) && (g.mkdef[1].checked==false) && (g.mkdef[2].checked==false) && (g.mkdef[3].checked==false))
		{
			alert("Sellect The Default Image");
			g.mkdef[0].focus();
			return false;
		}
	}
}
/////// Admin payment gateway Settings
function val_adminpay(form)
{
	location.href = "add_payment_gateway.php?nav=site&sub_nav=manage_pay&pay="+form.paytype.value;
}
function validate_adminpay(form)
{
	if((form.pay.value== "Authorize") || (form.pay.value== "2checkout") || (form.pay.value== "Secpay") || (form.pay.value== "ipayment") || (form.pay.value== "psigate") || (form.pay.value== "Worldpay") || (form.pay.value== "Paypal") || (form.pay.value== "echo_pay"))
	{
		if(form.login.value == "")
		{
			alert("Enter the login");
			return false;
		}
	}
	else
	{
		if(form.addinfo.value == "")
		{
			alert("Enter the additional information");
			return false;
		}
	}
	return true;
}
function validate_payedit()
{
	 var g=window.document.forms[0];
	 if(g.addinfo.value=="")
	 {
		 alert ("Please enter the additional info");
		 g.addinfo.focus();
		 return false;
	 }
	 return true;
}
function validate1_payedit()
{
	 var g=window.document.forms[0];
	 if(g.login.value=="")
	 {
		 alert ("Please enter login");
		 g.login.focus();
		 return false;
	 }
	 return true;
}
function validate_discountedit(frm)
{
	if(frm.disc.value == "")
	{
		alert("Enter the Discount")
		frm.disc.focus()
		return false
	}
	if(frm.discount_code.value == "")
	{
		alert("Enter Discount Code")
		frm.discount_code.focus()
		return false
	}
	if(!(parseFloat(frm.disc.value)))
	{
		alert("Enter the Discount in Numerics")
		frm.disc.focus()
		return false
	}
	return true
}
function validate_adddiscount(frm)
{
	if(frm.discount.value == "")
	{
		alert("Enter the Discount")
		frm.discount.focus()
		return false
	}
	if(frm.discount_code.value == "")
	{
		alert("Enter Discount Code")
		frm.discount_code.focus()
		return false
	}
	if(!(parseFloat(frm.discount.value)))
	{
		alert("Enter the Discount in Numerics")
		frm.discount.focus()
		return false
	}
	return true
}
function validate_ghanaauction(frm)
{
	if(frm.bid.value == "")
	{
		alert("Enter the Bid")
		frm.bid.focus()
		return false
	}
	if(!(parseFloat(frm.bid.value)))
	{
		alert("Bid amount should be numeric")
		frm.bid.focus()
		return false
	}
}

////////////////// for selecting the country and states

function listboxItemSelectedk(oList1,oList2){
id="";
if (oList2!=null){
clearComboOrList(oList2);
if (oList1.selectedIndex == -1){
oList2.options[oList2.options.length] = new Option('Please select a State', '');
} else {
//alert(oList1.name + '=' + oList1.options[oList1.selectedIndex].value)
fillListboxk(oList2, oList1.name + '=' + oList1.options[oList1.selectedIndex].value);
}
}
}


function listboxItemSelected_general(oList1,ovalue,oList2){
id="";
if (oList2!=null){
clearComboOrList(oList2);
//alert(oList1.name + '=' + oList1.options[oList1.selectedIndex].value)
fillListboxk(oList2, oList1 + '=' + ovalue);

}
}

function fillListboxk(oList, vValue){
var ss="aa"
if (vValue != '') {
//document.write(oList)
if (assocArray[vValue]){
var arrX = assocArray[vValue];

for (var i = 0; i < arrX.length; i = i + 2){

if (arrX[i] != 'EOF') 
{
		ss=arrX[i+1];
	oList.options[oList.options.length] = new Option(ss.replace("&#39","'"), arrX[i]);
}
}
//alert (oList.options.length)
if (oList.options.length == 1){
//oList.selectedIndex=0;
if (oList.onchange)	oList.onchange();
}
} else {
		
			oList.options[0] = new Option('No States..', '');
}
}
}

function clearComboOrList(oList){
for (var i = oList.options.length - 1; i >= 0; i--){
oList.options[i] = null;
}
oList.selectedIndex = -1;
if (oList.onchange)	oList.onchange();
}

function fillListbox(oList, vValue){
if (vValue != '') {
if (assocArray[vValue]){
var arrX = assocArray[vValue];
for (var i = 0; i < arrX.length; i = i + 2){
if (arrX[i] != 'EOF') 
{
		s1=arrX[i + 1];
	oList.options[oList.options.length] = new Option(s1.replace("&#39","'"), arrX[i]);
}
}
//alert (oList.options.length)
if (oList.options.length == 1){
//oList.selectedIndex=0;
if (oList.onchange)	oList.onchange();
}
} else {
		
			oList.options[0] = new Option('No Subcategories', '');
}
}
}

/////// Shipping address
function funval_ship()
{
	var g=form1;
	if(g)
	{
		if(g.firstname.value=="" )
		{
			alert("Enter First Name");
			g.firstname.focus();
			return false;
		}	
		if(g.lastname.value=="" )
		{
			alert("Enter Last Name");
			g.lastname.focus();
			return false;
		}
		if(g.address.value=="" )
		{
			alert("Enter Address");
			g.address.focus();
			return false;
		}
		if(g.city.value=="" )
		{
			alert("Enter City");
			g.city.focus();
			return false;
		}
		if(g.region.value == "")
		{
			alert("Select the State")
			g.region.focus();
			return false;
		}
		/*if(g.zip.value=="" )
		{
			alert("Enter Zipcode");
			g.zip.focus();
			return false;
		}
		else if(isNaN(g.zip.value))
		{
			alert("Zip Code should be Numeric");
			g.zip.value="";
			g.zip.focus();
			return false;
		}*/			
		if(g.email.value=="")
		 {
			g.email.focus();
			alert("Your Email Address is missing. ");
			return false;
		}
		else
		{
			st=g.email.value;
			if(checkEmail(st)==false)
			{
				g.email.focus();
				alert("Please Enter a Valid Email");
				return false;
			}
		}
		if(g.phone.value=="" )
		{
			alert("Enter Phone Number");
			g.phone.focus();
			return false;
		}
		else if(isNaN(g.phone.value))
		{
			alert("Phone should be Numeric");
			g.phone.value ="";
			g.phone.focus();
			return false;
		}								
		return true;
	}
	return false;
}
////////Total Estore Earnings
function scr_estore(val)
{	
	location.href = "estore_total_earning.php?days="+(val);
}
///////Total Auction Earnings
function scr(val)
{	
	location.href = "auction_total_earning.php?days="+(val);
}
////////////////////////////// all general side function ending../////////////////////////


////////////////////////// feedback validation process customer service starts here ////////////////////
function feedback(regform)
{
 	if(trim(regform.name.value)=="")
	 {
	// alert("ok")
	 	alert("Please Enter Name")
		regform.name.focus();
		return false
	 }
	 if(trim(regform.ga_id.value)=="")
	 {
	// alert("ok")
	 	alert("Please Enter GhanaAuction id ")
		regform.ga_id.focus();
		return false
	 }
	 if(trim(regform.email.value)=="")
	 {
		alert("Please Enter EmailId")
		regform.email.focus();
		return false
	 }
	 else
	 {
		st=regform.email.value;
		if(checkEmail(st)==false)
		{
			alert("Please Enter Correct Email")
			regform.email.focus();
			return false
		}
	 }
	if(trim(regform.issue.value)=="")
	 {
		alert("Please Select the Issue reporting on")
		regform.issue.focus();
		return false
	 }
	if(trim(regform.feedback_msg.value)=="")
	 {
		alert("Please Enter Feedback Message")
		regform.feedback_msg.focus();
		return false
	 }
}
////////////////////////// feedback validation process customer service ends here ////////////////////

///////////////////----------contact us validation starts here--------------//////////////////////////
function enquiry_validate(form)
{

	if(trim(form.name.value)=="")
	{
		alert ("Please Enter your Name ");
		form.name.focus();
		return false
	}
	if(trim(form.phone.value)=="")
	{
		alert ("Please Enter Your Phone Number");
		form.phone.focus();
		return false
	}
	a =parseFloat(form.phone.value);
	if(isNaN(a))
	{
		alert ("Enter Digits");
		form.phone.focus();
		return false
	}
	if(trim(form.email.value)=="")
	{
		alert ("Please Enter your Mail Id ");
		form.email.focus();
		return false
	}
	if (EmailCheck(form.email.value)==false)
	{
		alert("Invalid E-mail Address! Please re-enter.");
		form.email.focus()
		return false
	}
	if(trim(form.msg.value)=="")
	{
		alert ("Please Enter Enquiry Details");
		form.msg.focus();
		return false
	}
}

///////////////////----------contact us validation ends here--------------//////////////////////////


///member verification validation starts here/////////////
function member_ver_validate(form)
{
	if(trim(form.name.value)=="")
	{
		alert ("Please Enter Name");
		form.name.focus();
		return false
	}
	if(trim(form.address.value)=="")
	{
		alert ("Please Enter Address");
		form.address.focus();
		return false
	}
	if(trim(form.email.value)=="")
	{
	 	alert("Please Enter Email")
		form.email.focus();
		return false
    }
	 else
	{
		st=form.email.value;
		if(checkEmail(st)==false)
		{
			alert("Please Enter Correct Email")
			form.email.focus();
			return false
		}
	}
	if(trim(form.ref_name.value)=="")
	{
		alert ("Please Enter Referrer Name");
		form.ref_name.focus();
		return false
	}
	if(trim(form.ref_occupation.value)=="")
	{
		alert ("Please Enter Referrer Occupation");
		form.ref_occupation.focus();
		return false
	}
}
///member verification validation ends here/////////////