<!-- Begin
function deleteitem(str)
{
	//alert(str)
	if (!confirm("Do you want to delete this item froum your cart?"))
	{
		return false
		//window.close()
	}
	else
	{
	document.frm.action = "deleteitem.asp?ItemNo="+str;
	document.frm.submit();
	}
}

function disableSubmit()
{
	if (document.frm.SubmitTC.checked==true ) 
	{	 
		document.getElementById("SubmitDiv").style.display = "block";
		document.frm.SubmitTC.checked = true
	}	
	if (document.frm.SubmitTC.checked== false)
	{	
		document.getElementById("SubmitDiv").style.display = "none";
		document.frm.SubmitTC.checked = false
	}
}

function Form1_Validator(theForm)
{
	if ((theForm.OnlineRetailers.checked==false) && (theForm.BrickMortarRetailers.checked==false))
	{ 
		alert("Please Select Any One Of  \"Online Retailers / Brick & Mortar Retailers\" "); 
		return false;
	}
	if(theForm.name.value=="")
	{
		alert("Name can't be blank.");
		theForm.name.focus();
		return(false);
	}	
	if (theForm.BrickMortarRetailers.checked==true)
	{
		if(theForm.address.value=="")
		{
			alert("Address can't be blank.");
			theForm.address.focus();
			return(false);
		}
		if(theForm.phone.value=="")
		{
			alert("Phone can't be blank.");
			theForm.phone.focus();
			return(false);
		}
	}	
	if (theForm.OnlineRetailers.checked==true)
	{
		if(theForm.website.value=="")
		{
			alert("Website Address can't be blank.");
			theForm.website.focus();
			return(false);
		}		
	}
	if(theForm.login.value=="")
	{
		alert("Login name can't be blank.");
		theForm.login.focus();
		return(false);
	}
	if(theForm.password.value=="")
	{
		alert("Password can't be blank.");
		theForm.password.focus();
		return(false);
	}
	if(theForm.email.value=="")
	{
		alert("Email can't be blank.");
		theForm.email.focus();
		return(false);
	}	
	if (theForm.email.value.length > 0)
	{
		i=theForm.email.value.indexOf("@")
		j=theForm.email.value.indexOf(".",i)
		k=theForm.email.value.indexOf(",")
		kk=theForm.email.value.indexOf(" ")
		jj=theForm.email.value.lastIndexOf(".")+1
		len=theForm.email.value.length
		if ((i>0) && (j>(1+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=3))
		{
		}
		else
		{
		alert("Please enter an exact email address.\n" +
		theForm.email.value + " is invalid.");
		theForm.email.value=""
		theForm.email.focus();
		return false;
		}	   	
	}
	return(true);
}	

function validateMe(obj)
{
	if(obj.email.value=="")
	{
	alert("Email can't be blank.");
	obj.email.focus();
	return(false);
	}	
	if (obj.email.value.length > 0)
	{
		i=obj.email.value.indexOf("@")
		j=obj.email.value.indexOf(".",i)
		k=obj.email.value.indexOf(",")
		kk=obj.email.value.indexOf(" ")
		jj=obj.email.value.lastIndexOf(".")+1
		len=obj.email.value.length
		if ((i>0) && (j>(1+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=3))
		{
		}
		else
		{
		alert("Please enter an exact email address.\n" +
		obj.email.value + " is invalid.");
		obj.email.value=""
		obj.email.focus();
		return false;
		}	   	
	}
	if (obj.comment.value.length<=0)
	{
		alert('Please enter your comments . . .');
		return false;
	}
	return (true);
}
 function validateMyupdate(obj)
{
	for (var i=0;i<obj.length;i++)
	{		        
		if (obj[i].name=="Name" || obj[i].name=="Address" || obj[i].name=="City" || obj[i].name=="State" || obj[i].name=="Country" || obj[i].name=="pincode" || obj[i].name=="UserName" || obj[i].name=="Compname" )
		{
			if (obj[i].value.replace(" ","").length<=0)
			{
				if (obj[i].name=="pincode")
					alert('Please enter Zip . . .');
				else if (obj[i].name=="UserName")
					alert('Please enter User Name . . .');
				else if (obj[i].name=="Compname")
					alert('Please enter Company . . .');
				else
					alert('Please enter ' + obj[i].name + ' . . .');

				obj[i].focus();
				return (false);
			}
		}
		else if(obj[i].name=="Email")
		{
			if (!testEmail(obj[i]))
				return false;
		}
		else if(obj[i].name=="UPassword" || obj[i].name=="ReUPassword")
		{
			if (obj[i].value.length>0)
				if (obj["UPassword"].value!=obj["ReUPassword"].value)
				{
					alert('Password does not match with Re-Password');
					return (false);
				}
					
		}
	}
	return (true);
}

function SearchForm()
{
	document.write("<form method='get' action='productpage.asp' name='searchfrm'>");
	document.write("<span class='p'><input class='inputbox' type='text' value='SKU# or Keyword' id='SKU' name='SKU' size='30' onblur=\"if (this.value == '') {this.value='SKU# or Keyword'}\" onfocus=\"if (this.value =='SKU# or Keyword') {this.value = ''}\">&nbsp;&nbsp;&nbsp;<input type='submit' value='Search' class='btn' style=\"width:70px;\" onClick=\"return SearchInput()\"></span>");
	document.write("</form>");
}

function SearchInput()
{
	if(searchfrm.SKU.value=="SKU# or Keyword")
	{
		alert("Please enter \"SKU / Keyword\" to Search!")
		return false
	}
	return true
}


function testEmail(Obj)
{

if(Obj.value=="")
	{
	alert("Email address can't be blank.");
	Obj.focus();
	return(false);
	}

	else
	{
		mail=Obj.value
		at_pos=mail.indexOf("@")
		dot_pos=mail.indexOf(".")
		if(at_pos<1 || dot_pos<1)
		{
			alert("Please check position of '@' and '.' in email address.")
			Obj.focus()
			return(false);
		}
		else
		{
			mail=Obj.value
			condition="yes"
			var at_count=0
			var dot_count=0
			var temp=0
			for(var i=0;i<mail.length;i++)
			{
				if((mail.charCodeAt(i)>0 && mail.charCodeAt(i)<48)||(mail.charCodeAt(i)>57 && mail.charCodeAt(i)<65)||(mail.charCodeAt(i)>91 && mail.charCodeAt(i)<95 && mail.charCodeAt(i)!=96)||mail.charCodeAt(i)>122)
				{				    
					if(mail.charAt(i)=="@"||mail.charAt(i)==".")
					{
							if(mail.charAt(i)=="@"){at_count++}else{dot_count++} // counts the no. of times @ and . appears in email
							if(dot_count>=1)
							{
								dot_pos=i
								if((dot_pos>at_pos) && temp==0)
								{
									pos=dot_pos-at_pos
									temp++
								}								
							}
					}
					else
					{
						condition="no"
						i=mail.length
					}
				}
			}
			if(condition=="no")
			{
				alert("Your email contains a blank space or special character.")
				Obj.focus()
				return(false);
			}
			else
			{
				if(at_count>1)
				{
					alert("E-mail contains extra @ ")
					Obj.focus()
					return(false);
				}
				else
				{
					if(dot_pos-at_pos<2)
					{
						alert("Missing domain name between '@' and '.'")
						Obj.focus()
						return(false);
						i=mail.length
					}
					else
					{	
						count=dot_pos+1
						domain=""
						for(count;count<mail.length;count++)
						{
							domain=domain+mail.charAt(count)		
						}
						dom=new Array("au","com","net","org","edu","in","mil","gov","arpa","biz","aero","name","coop","info","pro","museum")
						error="yes"
						for(var k=0;k<dom.length;k++)
						{
							if(domain==dom[k])
							{
								k=dom.length
								error="no"
							}
						}
						if((error=="yes" && (domain.length>2)) || (domain.length<2))
						{
							alert("Domain name must end with well known domains \n or 2-lettered country name. eg com,edu,in etc.")
							Obj.focus()
							return(false);
						}								
					}
				}
			}
		}
	}
    return(true);
}

function fuSupplierLogin(SKU)
{
	document.getElementById('ShowMainImage').innerHTML="<br><br><br><br><img src='images/loading.gif'>"	
	if (window.XMLHttpRequest)
    {
	    xmlhttp=new XMLHttpRequest()
		xmlhttp.open("GET","GetImage.asp?SKU="+SKU,true);
		xmlhttp.send(null)
		xmlhttp.onreadystatechange = GetImageRequestComplete;
    }	// code for IE
	else if (window.ActiveXObject)
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		if (xmlhttp)
		{
			xmlhttp.onreadystatechange = GetImageRequestComplete;
		    xmlhttp.open("GET","GetImage.asp?SKU="+SKU,true);
			xmlhttp.send();
		}
	}
	return;
}

function GetImageRequestComplete()
{
	if (xmlhttp.readyState==4)
	{
		if (xmlhttp.status==200)
			document.getElementById('ShowMainImage').innerHTML=xmlhttp.responseText;
		else
			document.getElementById('ShowMainImage').innerHTML="<font size='2' color='red'>Error occured while downloading the image.</font><br><br><a href='javascript:FnShowOrderList()'>Close</a>";
	}
}

//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

// End -->