//<!--
//
//---------------------------------------------------------------------------------//
// Javascript Library function for chennaiplaza.com
// Dont modify the below codes at any cause. Will give errors
// Last Update	: 23rd April 2000
// Function		:
//				:	(1) getimage()	:	To open a new window with enlarged image
//						* Param		:	Full Big Image Path as string
//									:	Collection name as string
//									:	Item name as string
//---------------------------------------------------------------------------------//
//---Browser detect--------------
var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)
var IsIe
if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4)
{
document.cookie="IE-Flag=yes";
IsIe=true;
}

var flag=0
var qString="";
var delqString="";
//-- function for calling subcat page--//
function subcategoryFunction(catid,link) {
var Scatid = catid;
var Nlink = link;
parent.location.href = "subcategorys.asp?catid="+escape(Scatid)+"&listitem="+escape(qString)+"&link="+escape(Nlink) ;
}
//-- function for call advanced search page --//
function adsearch()
{
parent.location.href = "shopvizard.asp?listitem="+escape(qString) ;
}
//-- any links in subitems page should use this function to set cookies --//
function gotofile(StoFile)
{
document.forms[0].action=escape(StoFile) ;
document.forms[0].submit() ;
}
//-- Delete cookies confirmation --//
function gotofile1(Filename, Spurchase, StoFile)
{
/*confirm("Please deside whether you would like to Buy online or send gift.If you have done any Entry to the ShoppingCart previously,that may lost if you change the mode to "+Spurchase+" now.Refer FAQ for more information.. do you want to continue ? ","")   
//RetVal = confirm("You have selected the "+Spurchase+" and we are going to delete the cart.. do you want to continue ? ","")
if(RetVal)
{
parent.location.href = escape(Filename)+"?listitem="+escape(qString) ;
}
else
{
parent.location.href = escape(StoFile)+"?listitem="+escape(qString) ;
}*/
parent.location.href = sendgift.asp;
}
//-- function for continue shopping --//
function contshop()
{
parent.location.href = "subitems.asp?listitem="+escape(qString) ;
}
//---------------------------------------------------
// setting cookie for the back link in all the pages
//---------------------------------------------------
function setCookies()
{

	for (nCount=0;nCount<document.forms[0].elements.length;nCount++)
	{
		if (document.forms[0].elements[nCount].type == "checkbox" )
		{
			if(document.forms[0].elements[nCount].checked==true)
			{
			document.cookie=document.forms[0].elements[nCount].name + "=" + document.forms[0].elements[nCount-1].value
            }else
			 {
			 if (Get_Cookie(document.forms[0].elements[nCount].name) > 0)
			 {
			 document.cookie=document.forms[0].elements[nCount].name + "=" + document.forms[0].elements[nCount-1].value
			 }
			 }		
		}
	}
}
//---function to create cookie when click on department list----
function setCookiesDept(Cid,FLin)
{
document.forms[0].action="subcategorys.asp?catid="+escape(Cid)+"&link="+escape(FLin) ; 
document.forms[0].submit() ;
}
function setCookiesOpage(page)
{

for (nCount=0;nCount<document.forms[0].elements.length;nCount++)
	{
		if (document.forms[0].elements[nCount].type == "checkbox" )
		{
			if(document.forms[0].elements[nCount].checked==true)
			{
			document.cookie=document.forms[0].elements[nCount].name + "=" + document.forms[0].elements[nCount-1].value
            }else
			 {
			 if (Get_Cookie(document.forms[0].elements[nCount].name) > 0)
			 {
			 document.cookie=document.forms[0].elements[nCount].name + "=" + document.forms[0].elements[nCount-1].value
			 }
			 }		
		}
	}

document.forms[0].action=escape(page) ; 
document.forms[0].submit() ;
}


//---function to create cookie when click on WishList Button----
function AddToList(ICode)
{
//-----Add the Item to the WishList.
if(Get_Cookie("uname") == null){
alert("PLEASE LOGIN !!\n==========\n\nPlease register if you are a new user.\n\nSign in if you are already registered.");
document.forms[0].userid.focus();
}
else
{
document.forms[0].action="AddToList.asp?ItD="+ICode;
document.forms[0].submit();
}}

function AddToCart(ICode){
//-----Add the Item to the shopping cart.
if(Get_Cookie("uname") == null){
alert("PLEASE LOGIN !!\n==========\n\nPlease register if you are a new user.\n\nSign in if you are already registered.");
document.forms[0].userid.focus();
}
else
{
document.forms[0].action="AddToCart.asp?ItD="+ICode;
document.forms[0].submit();
}}
//-------------------------------------------------
function ShipCountrySelect(){
var CountryName;
CountryName=document.forms[0].lstCountryName.value ;
//------Country Name should not Empty and It should not be same.
if (CountryName != "Empty" && CountryName != Get_Cookie("shipCountryCookie")){


//-----------------------------
document.forms[0].action="ShipSelectSubmitBack.asp?CountryName="+CountryName;
document.forms[0].submit();
//-----------------------------
}
}
//-------------------------------------------------
function delitem()
{
for (i=0;i<document.f1.elements.length;i++)
{
if (document.f1.elements[i].checked)
{
delqString = delqString + escape(document.f1.elements[i].name) + "."
//delqString = delqString + escape(document.f1.elements[i].name)
}
}
document.f1.h1.value = escape(delqString)

document.forms[0].submit()
}

//---------to call the result.asp file and set cookies ------------------------------------------------------------------------//
function cal()
{
if(document.forms[0].search.value != "")
{
document.forms[0].searchh1.value = qString;
document.forms[0].action = "result.asp" ;
document.forms[0].submit();
}
else {
alert("Enter a string to search");
document.forms[0].search.focus();
}
}


//-----validate the text box in subitems----------------------------------------------------------------------------//
function check(cObj,nMode)
{
if (nMode==0)
{
var nElement=FindTextElement(cObj)+1
if(document.forms[0].elements[nElement].checked==false){
	if (!document.all)
	{
		document.forms[0].elements[nElement].focus()
	}
	alert("Please check the add to cart")
	document.forms[0].elements[nElement].focus()
}
}
else
{

var nElement=FindCheckElement(cObj)
if(document.forms[0].elements[nElement].checked==true){
   document.forms[0].elements[nElement-1].value=1
   flag = 1
 }
if(document.forms[0].elements[nElement].checked==false){
	document.forms[0].elements[nElement-1].value=0
	flag = 0
}
   qString = qString + document.forms[0].elements[nElement-1].name + "," + document.forms[0].elements[nElement-1].value + "." ;
}

}

//---------------------------------------------------------------------------------//
function FindTextElement(cObj)
{
var nElements = document.forms[0].elements.length
var nRetVal = 0
	for (nCount=0;nCount<=nElements ;nCount++ )
	{
		if (document.forms[0].elements[nCount].type=="text")
		{
			if (document.forms[0].elements[nCount].name==cObj.name)
			{
				nRetVal=nCount
				break;
			}
		}
	}
return nRetVal
}

//---------------------------------------------------------------------------------//

function cal()
{
if(document.forms[0].search.value != "")
{
document.forms[0].searchh1.value = qString;
document.forms[0].action = "result.asp" ;
document.forms[0].submit();
}
else {
alert("Enter a string to search");
document.forms[0].search.focus();
}
}
//------------------------------------------------------------------
//-------checking qty when modified---------------------------------
function qtycheck(Svalue,Mvalue)
{
if (parseInt(Svalue.value) > parseInt(Mvalue) || isNaN(parseInt(Svalue.value)) || parseInt(Svalue.value) == 0)
{

alert("Please keep your order quantity between 1 to "+Mvalue+" for this product");
Svalue.focus();
Svalue.select();
}else{
//document.cookie=Svalue.name+"="+Svalue.value ;
}
}

//---------- checking with the max and min qty of the text box -----------------------------------------------------------------------//

function recheck(textObj,NmaxValue) {


var nElement=FindTextElement(textObj)+2
if(document.forms[0].elements[nElement].checked==true){
flag = 1; }
if (flag == 1)
{
//alert(isNaN(parseInt(textObj.value)))
if (isNaN(textObj.value) || isNaN(parseInt(textObj.value)) || textObj.value == "" || textObj.value == " " || textObj.value == "  " || parseInt(textObj.value) <= 0 || parseFloat(textObj.value) < 0 || textObj.value > NmaxValue)
{
alert("            Please keep your order size between 1 to " + NmaxValue + "\n For more quantity please E-Mail your requirement to sales@chennaiplaza.com");
textObj.value = 1
textObj.focus();
}
else 
{
qString = qString + textObj.name + "," + textObj.value + "." ;
}
}
}

//---------------------------------------------------------------------------------//

function nextLink(i,itemid) {

parent.location.href = "subitems.asp?npage="+escape(i)+"&itemid="+escape(itemid);
}

//---------------------------------------------------------------------------------//
function prevLink(i,itemid) {
parent.location.href = "subitems.asp?ppage="+escape(i)+"&itemid="+escape(itemid);
} 
//---------------------------------------------------------------------------------//
function viewLink() {
//alert("qString is"+qString)
parent.location.href = "checkout.asp" ;
}

//---------------------------------------------------------------------------------//
function endLink() {
parent.location.href = "checkout.asp";
} 
//---------------------------------------------------------------------------------//
function endLink1() {
parent.location.href = "checkout.asp?to=yes" ;
} 
//---------------------------------------------------------------------------------//

function itemid(itemid) {
parent.location.href = "items.asp?itemid="+escape(itemid)+"&listitem="+escape(qString) ;
}
//---------------------------------------------------------------------------------//

function tosubcat(itemid) {
parent.location.href = "subcategorys.asp?catid="+itemid+"&listitem="+escape(qString) ;
}

//---------------------------------------------------------------------------------//

function collid(itemid) {
parent.location.href = "collection.asp?collid="+itemid ;
}
//---------------------------------------------------------------------------------//

function subcatid(itemid) {
parent.location.href = "subcategorys.asp?catid="+itemid ;
}

//---------------------------------------------------------------------------------//

function defa() {
parent.location.href = "default.asp?listitem="+escape(qString) ;
}

//---------------------------------------------------------------------------------//

function getimage(cImage,sCollection,sItem) {
flg = "yes" ;
var hImage="showimage.asp?image="+cImage+"&collname="+sCollection+"&itemname="+sItem + "&flag="+flg

	window.open(hImage,"ChennaiPlaza",'toolbar= 0,location=0,directories= 0,status= 0,menubar= 0,scrollbars= 1,resizable= 1,copyhistory= 0,width=500,height=400,left=280 top=100')

}

function dispBigPreview(Itemcode)
{


window.open("showimage.asp?Itemcode="+Itemcode,"ChennaiPlaza",'toolbar= 0,location=1,directories= 0,status= 0,menubar= 0,scrollbars= 1,resizable= 1,copyhistory= 0,width=800,height=600,left=0 top=0')


}

//---------------------------------------------------------------------------------//


//---------------------------------------------------------------------------------//
function FindCheckElement(cObj)
{
var nElements = document.forms[0].elements.length
var nRetVal = 0
	for (nCount=0;nCount<=nElements ;nCount++ )
	{
		if (document.forms[0].elements[nCount].type=="checkbox")
		{
			if (document.forms[0].elements[nCount].name==cObj.name)
			{
					nRetVal=nCount
				break;
			}
		}
	}
return nRetVal
}

//---------------------------------------------------------------------------------//
function logofffunc() 
{
		document.forms[0].Qstringh1.value = qString;
		document.forms[0].action = "logoff.asp"
		document.forms[0].submit();
}
//---------------------------------------------------------------------------------//
function logofffunc1() 
{
parent.location.href = "logoff.asp?listitem="+qString
}
//---------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------//

function advsearch() {
		document.forms[0].action = "advresult.asp"
		document.forms[0].submit();
}

//-----------------------------------------------------------------------

function Sublogfunction() {
	if (document.forms[0].userid.value != "" && document.forms[0].password.value != "")
	{
		//---------------------------------------------
		for (nCount=0;nCount<document.forms[0].elements.length;nCount++)
	{
		if (document.forms[0].elements[nCount].type == "checkbox")
		{
			if(document.forms[0].elements[nCount].checked==true)
			{
			document.cookie=document.forms[0].elements[nCount].name + "=" + document.forms[0].elements[nCount-1].value
		    }else
			 {
			 if (Get_Cookie(document.forms[0].elements[nCount].name) > 0)
			 {
			 document.cookie=document.forms[0].elements[nCount].name + "=" + document.forms[0].elements[nCount-1].value
			 }
			 }
		}
	}
		//---------------------------------------------
		
		document.forms[0].Qstringh1.value = qString;
		document.forms[0].action = "logcheck.asp"
		document.forms[0].submit();
	}
	else {
	alert("            Invalid UserID or Password \n\n Please re-enter valid UserID and Password");
		if (document.forms[0].userid.value == "")
		{
		document.forms[0].userid.focus();
		}
		if (document.forms[0].userid.value != "" && document.forms[0].password.value == "")
		{
		document.forms[0].password.focus();
		}
	}
}

//-----------------------------------------------------------------------
function logfunction() {
	
	if (!isNaN(document.forms[0].userid.value.substring(0,1)) || document.forms[0].userid.value.match(/[a-zA-Z]/)==null || isSpecialChr(document.forms[0].userid)==true)
{
		alert("Please Enter a valid User Name");
		document.forms[0].userid.focus();
		document.forms[0].userid.select();
		return;
		}
		
		else if (!isNaN(document.forms[0].password.value.substring(0,1)) || document.forms[0].password.value.match(/[a-zA-Z]/)==null || isSpecialChr(document.forms[0].password)==true)
{
		alert("Please Enter valid password");
		document.forms[0].password.focus();
		document.forms[0].password.select();
		return;
		}
	
	else if (document.forms[0].userid.value != "" && document.forms[0].password.value != "" )
	{
		
		
		document.forms[0].Qstringh1.value = qString;
		document.forms[0].action = "logcheck.asp"
		document.forms[0].submit();
	}
	else {
	alert("            Invalid UserID or Password \n\n Please re-enter valid UserID and Password");
		if (document.forms[0].userid.value == "")
		{
		document.forms[0].userid.focus();
		}
		if (document.forms[0].userid.value != "" && document.forms[0].password.value == "")
		{
		document.forms[0].password.focus();
		}
	}
}

//-----------------------------------------------------------------------------------------//
function checkall() {
//alert(GetFileName(document.images[9].src))
var flagz = "" ;
for (i=0;i<document.images.length;i++ )
{
	if (GetFileName(document.images[i].src) == "select.gif")
	{
	flagz = "select" ;
	pos = i;
	}
	if (GetFileName(document.images[i].src) == "deselect.gif")
	{
	flagz = "deselect" ;
	pos = i;
	}

}
if (flagz == "select")
{
	document.images[pos].src="/images/deselect.gif"
	document.images[pos].alt="Select All"
	flag = false;
}
if (flagz == "deselect")
{
	document.images[pos].src="/images/select.gif"
	document.images[pos].alt="Deselect All" 
	flag = true
}

for(i=0;i<document.forms[0].elements.length;i++)
{
if (document.forms[0].elements[i].type=="checkbox" && flag )
{
document.forms[0].elements[i].checked = true;

}
else
{
document.forms[0].elements[i].checked = false ;
}
}
}
//-----------------------------------------------------------------------------------------//
// trimming function
//-----------------------------------------------------------------------------------------//

function trim(trimtext) {
//	var retstr = "" ;
//	retstr = trimtext;
//	if (retstr != "")
//	{
//	while (retstr.subString(0,1) == " ")
//	{
//		retstr = retstr.substring(1,retstr.length)
//	}
//	}
	return trimtext;
}
//-----------------------------------------------------------------------------------------//
function GetFileName(cFile){
var RetVal= ""
//RetVal=cFile.substring(cFile.lastIndexOf("\\")+1,cFile.length).toLowerCase()
RetVal=cFile.substring(cFile.lastIndexOf("\/")+1,cFile.length)
return RetVal
}

//-----------------------------------------------------------------------------------------//
function backto1()
{
parent.location.href = "personal.asp"
}
function backto2()
{
parent.location.href = "persinfo.asp"
}


function sendgift1(mode) {
if (mode=="Buy Online")
{
	parent.location.href="default.asp?purchasemode="+"gift"+"&to="+"yes"
}
}

function buyonline1(mode) {
if (mode == "Send Gifts")
{
	parent.location.href="default.asp?purchasemode="+"buy"+"&to="+"yes"
}
}
//------------------------ to come back from persnalized information
function persback(backto)
{
parent.location.href = "personal.asp?file="+backto;
}
//-----------------------------------------------------------------------------------------//
function nextrec() {
document.forms[0].h4.value = "1"
document.forms[0].action = "listpers.asp"
document.forms[0].submit()
}
function prevrec() {
document.forms[0].h5.value = "1"
document.forms[0].action = "listpers.asp"
document.forms[0].submit()
}
function FeedBackValid()
{
if (document.f1.text1.value=="")
{
alert("Please Enter Your Name")
document.f1.text1.select();
return;
}
if (!isNaN(document.f1.text1.value.substring(0,1)) || document.f1.text1.value.match(/[a-zA-Z0-9]/)==null || isSpecialChr(document.f1.text1)==true)
{
		alert("Enter valid characters in Name");
		document.f1.text1.focus();
		document.f1.text1.select();
		return;
		}
		
if (document.f1.text2.value=="")
{
alert("Please Enter Your E-Mail");
document.f1.text2.select();
return;	
}

if(document.f1.text2.value.indexOf("@") <3 )
{
alert("Please Enter Correct E-Mail");
document.f1.text2.select();
return;
}

 if (document.f1.text2.value.indexOf(".") == -1)
{
alert("Please Enter Correct Email");
document.f1.text2.select();
return;
}

if(document.f1.text2.value.match(/[\~\!\#\$\%\^\*\<\>]/) != null)
		{
		alert("Please enter Valid characters");
		document.f1.text2.focus() ;
		document.f1.text2.select() ;
		return ;
}
if (document.f1.area1.value=="")
{
alert("Please Enter Your Feedback");
document.f1.area1.select();
return;	
}
if (isSpecialChr(document.f1.area1)==true)
{
alert("Please Enter valid characters");
document.f1.area1.select();
document.f1.area1.focus();
return;	
}
document.f1.action="customise1.asp";
document.f1.submit();
}

//**************************************************************************
//********************************Helpdisk function*************************
function helpdesk(n)
{
window.open("helpdesk.asp?value="+n,"ChennaiPlaza",'toolbar= 0,location=0,directories= 0,status= 0,menubar= 0,scrollbars= 1,resize=0,copyhistory= 0,width=500,height=500,left=280 top=100')
}

//----------------------------------------------------------
function AddBook()
{
window.open("AddMenu.asp","ChennaiPlaza",'toolbar= 0,location=0,directories= 0,status= 0,menubar= 0,scrollbars= 1,resize=0,copyhistory= 0,width=315,height=343,left=200 top=100');
}
//----------------------------------------------------------
//-- function to check the image for select and deselect items --//
function checkimage()
{
flagxx = false;
for (i=0;i<document.forms[0].elements.length;i++ )
{
	if (document.forms[0].elements[i].type == "checkbox" && !document.forms[0].elements[i].checked)
	{
	flagxx = true; 
	}
}
if (!flagxx)
{
	document.images[8].src = "/images/select.gif"
}
else
{
	document.images[8].src = "/images/deselect.gif"
}
}

//-- to change marital status - checkbox value --//
function changemarital(status)
{
if (status.checked )
{
status.value = "Married"
}
if (status.checked == false)
{
status.value = "UnMarried"
}
}


function validate()
{
flag = true;
if (document.forms[0].toaddr.value == "" && flag)
{
flag = false;
alert("To address is empty")
document.forms[0].toaddr.focus();
}
if (isSpecialChr(document.forms[0].toaddr) == true && flag)
{
flag = false;
alert("Enter valid characters");
document.forms[0].toaddr.focus();
document.forms[0].toaddr.select();
}

if (document.forms[0].cont.value == "" && flag )
{
flag = false;
alert("Content is empty")
document.forms[0].cont.focus();
}
if (isSpecialChr(document.forms[0].cont) == true && flag )
{
flag = false;
alert("Enter valid characters");
document.forms[0].cont.select();
document.forms[0].cont.focus();
}

if (flag )
{
document.forms[0].action = "sendit.asp"
document.forms[0].submit();
}
}
function setcook()
{
document.forms[0].action = "sendit.asp"
document.forms[0].submit();
}

function datecheck(y2k)
{
year = y2k ;
if (document.f1.yyyy.value > year)
{
return true;
}
}

function valCheckout() {
checkflag = true;
formname = document.forms[0];

// here checking the billing address

	if (formname.fname.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Billing First name");
		formname.fname.value = "" ;
		formname.fname.focus();
	}
	if (isSpecialChr(formname.fname) == true && checkflag )
	{
		checkflag = false;
		alert("Enter valid characters.");
		formname.fname.select() ;
		formname.fname.focus();
	}
	if (isSpecialChr(formname.lname) == true && checkflag )
	{
		checkflag = false;
		alert("Enter valid characters.");
		formname.lname.select() ;
		formname.lname.focus();
	}

	if (formname.nstreet.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Billing Address");
		formname.nstreet.value = "" ;
		formname.nstreet.focus();
	}
	if (isSpecialChr(formname.nstreet) == true && checkflag )
	{
		checkflag = false;
		alert("Enter valid characters.");
		formname.nstreet.select();
		formname.nstreet.focus();
	}

if (isSpecialChr(formname.nstreet1) == true && checkflag )
	{
		checkflag = false;
		alert("Enter valid characters.");
		formname.nstreet1.select();
		formname.nstreet1.focus();
	}	
	

	/*if (formname.nstreet1.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Billing Address");
		formname.nstreet1.value = "" ;
		formname.nstreet1.focus();
	}*/
	if (formname.city.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Billing City");
		formname.city.value = "" ;
		formname.city.focus();
	}
	if (isSpecialChr(formname.city)== true && checkflag )
	{
		checkflag = false;
		alert("Enter Valid Characters");
		formname.city.focus();
		formname.city.focus();
	}

	if (formname.state.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Billing State");
		formname.state.value = "" ;
		formname.state.focus();
	}
	
	if (isSpecialChr(formname.state) == true && checkflag )
	{
		checkflag = false;
		alert("Enter Valid Characters");
		formname.state.select();
		formname.state.focus();
	}
	
	if (formname.zip.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Billing Zip");
		formname.zip.value = "" ;
		formname.zip.focus();
	}
	if (isSpecialChr(formname.zip) == true && checkflag )
	{
		checkflag = false;
		alert("Enter Valid Characters");
		formname.zip.select();
		formname.zip.focus();
	}
/*	if (formname.country.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Billing Country");
		formname.country.value = "" ;
		formname.country.focus();
	}*/
	if ((formname.phone.value.length <= 0 || formname.phone.value.length > 24) && checkflag )
	{
		checkflag = false;
		alert("Enter valid billing phone number");
		formname.phone.select();
		formname.phone.focus();
	}
	
	if (isSpecialChr(formname.phone)== true && checkflag )
	{
		checkflag = false;
		alert("Enter Valid Characters");
		formname.phone.select();
		formname.phone.focus();
	}

	if (formname.email.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Billing E-mail address");
		formname.email.value = "" ;
		formname.email.focus();
	}

	if(formname.email.value.indexOf("@") <3 && checkflag )
	{
		checkflag = false;
		alert("Enter correct Billing E-mail address");
		formname.email.value = "" ;
		formname.email.focus();
	}

	if (formname.email.value.indexOf(".") == -1 && checkflag )
	{
		checkflag = false;
		alert("Enter correct Billing E-mail address");
		formname.email.value = "" ;
		formname.email.focus();
	}
	if (formname.email.value.match(/[\~\!\#\$\%\^\*\<\>]/) != null && checkflag)
	{
		checkflag = false;
		alert("Enter valid characters.");
		formname.email.select();
		formname.email.focus();
	}

//here validates to shippping address


	if (formname.fname1.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Shipping First name");
		formname.fname1.value = "" ;
		formname.fname1.focus();
	}
	
	if (isSpecialChr(formname.fname1) == true && checkflag )
	{
		checkflag = false;
		alert("Enter valid characters");
		formname.fname1.select() ;
		formname.fname1.focus();
	}
	if (isSpecialChr(formname.lname1) == true && checkflag )
	{
		checkflag = false;
		alert("Enter valid characters");
		formname.lname1.select() ;
		formname.lname1.focus();
	}
	
	

	if (formname.nstreet2.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Shipping Address");
		formname.nstreet2.value = "" ;
		formname.nstreet2.focus();
	}
	if (isSpecialChr(formname.nstreet2) == true && checkflag )
	{
		checkflag = false;
		alert("Enter valid characters");
		formname.nstreet2.select();
		formname.nstreet2.focus();
	}
	if (isSpecialChr(formname.nstreet21) == true && checkflag )
	{
		checkflag = false;
		alert("Enter valid characters");
		formname.nstreet21.select();
		formname.nstreet21.focus();
	}
	

	/*if (formname.nstreet21.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Shipping Address");
		formname.nstreet21.value = "" ;
		formname.nstreet21.focus();
	}*/
	/*if (formname.city1.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Shipping City");
		formname.city1.value = "" ;
		formname.city1.focus();
	}

	if (formname.state1.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Shipping State");
		formname.state1.value = "" ;
		formname.state1.focus();
	}*/
	if (formname.zip1.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Shipping Zip");
		formname.zip1.value = "" ;
		formname.zip1.focus();
	}
	if (isSpecialChr(formname.zip1) == true && checkflag )
	{
		checkflag = false;
		alert("Enter valid characters");
		formname.zip1.select();
		formname.zip1.focus();
	} 
	/*if (document.f1.country1.options[document.f1.country1.options.selectedIndex].value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Shipping Country");
		formname.country1.value = "" ;
		formname.country1.focus();
	}*/
	
	if ((formname.phone1.value.length <= 0 || formname.phone1.value.length > 24 ) && checkflag )
	{
		checkflag = false;
		alert("Enter valid Shipping phone number");
		formname.phone1.select() ;
		formname.phone1.focus();
	}
	if (isSpecialChr(formname.phone1) == true && checkflag )
	{
		checkflag = false;
		alert("Enter valid characters");
		formname.phone1.select() ;
		formname.phone1.focus();
	}

	/*if (formname.email1.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter your Shipping E-mail address");
		formname.email1.value = "" ;
		formname.email1.focus();
	}*/

    if (formname.email1.value.length != 0)
    {
    
	if(formname.email1.value.indexOf("@") <3 && checkflag )
	{
		checkflag = false;
		alert("Enter correct Shipping E-mail address");
		formname.email1.value = "" ;
		formname.email1.focus();
	}

	if (formname.email1.value.indexOf(".") == -1 && checkflag )
	{
		checkflag = false;
		alert("Enter correct Shipping E-mail address");
		formname.email1.value = "" ;
		formname.email1.focus();
	}
	
	if (formname.email1.value.match(/[\~\!\#\$\%\^\*\<\>]/) != null && checkflag)
	{
		checkflag = false;
		alert("Enter valid characters.");
		formname.email1.select();
		formname.email1.focus();
	}
	
	}
	
//---------------------Sheduled date validation starts---------------------------
/*
mm = formname.mm.value;
dd = formname.dd.value;
yy = formname.yyyy.value;

if (formname.yyyy.value !="" && checkflag)
{
if (formname.yyyy.value < year && checkflag )
	{
	checkflag = false
		
		alert(" Please give minimum one week for delivery");
		formname.yyyy.focus();
		formname.yyyy.select();
		return;
	}
	}
 
 if (yy == year && checkflag)
 {
	if (mm < month && mm!=null &&checkflag)
		 {
		 alert("Please give minimum  Three days for delivery.");
		 formname.mm.focus();
		 formname.mm.select();
		 }
                      
	 if ((mm == month) && (dd-day)<3 && checkflag)
		 {
		 alert("Please give minimum Three days for delivery.");
		 formname.dd.focus();
		 formname.dd.select();
		 }
 }
 if ((formname.yyyy.value - year)>1 && checkflag)
 {
 alert("Please Enter an early delivery date");
 formname.yyyy.focus();
 formname.yyyy.select();
 return;
 }
 if ((formname.yyyy.value - year) == 1 && month == 12 && day > 28 && mm == 1 && dd < 2 && checkflag)
 {
 alert("please give more time for delivery of these product(s)");
 formname.yyyy.focus();
 formname.yyyy.select();
 return;
 }
 */
 //---------------------Sheduled date validation Ends---------------------------
 // no =new date()
 // no1 = no.datedif(01/02/99,01/01/99)
/*mm = formname.mm.value;
dd = formname.dd.value;
yy = formname.yyyy.value;

var Cur = new Date()
var CurrDate=Cur.setDate(month/date/year);
var EnDate=Cur.setDate(mm/dd/yy)

alert("Date Diff is"+CurrDate-EnDate)*/


//alert("date is"+mm+dd+yy);

//------------------------------------------------------
//value checked and form getting submitted here
	//if (IsIe==true){
	
	
	
	if (isSpecialChr(formname.comm) == true && checkflag )
	{
		checkflag = false;
		alert("Enter valid characters");
		formname.comm.select() ;
		formname.comm.focus();
	}
	if (isSpecialChr(formname.comm1) == true && checkflag )
	{
		checkflag = false;
		alert("Enter valid characters");
		formname.comm1.select() ;
		formname.comm1.focus();
	}
	
	
	if (isSpecialChr(formname.landmark) == true && checkflag )
	{
		checkflag = false;
		alert("Enter valid characters");
		formname.landmark.select() ;
		formname.landmark.focus();
	}
	
	if (formname.text1.value.length <= 0 && checkflag )
	{
		checkflag = false;
		alert("Enter Delivery Date");
		
		formname.text1.focus();
	}
	
	
	
	
	//}

	if (checkflag )
	{
	formname.action = "checkitem.asp"
	formname.submit();
	}


}

//-----------------------------------------------------------------------------------------//
function checkyear(year) {
flagx = true;
toYear = year;
if(document.forms[0].year.value <= 1900 && flagx ) {
flagx = false;
alert("Year Should be > 1900")
document.forms[0].year.value = ""
document.forms[0].year.focus()
}
if (document.forms[0].year.value > toYear && flagx )
{
flagx = false;
alert("Year should be <=" + toYear)
document.forms[0].year.value = ""
document.forms[0].year.focus()
}
if (isNaN(document.forms[0].year.value) && flagx )
{
flagx = false;
alert("Year should be a number")
document.forms[0].year.value = ""
document.forms[0].year.focus()
}
if (document.forms[0].year.value == "" && flagx )
{
flagx = false;
alert("Year shouldnt be empty")
document.forms[0].year.value = ""
document.forms[0].year.focus()
}
if (document.forms[0].remtext.value == "" && flagx )
{
flagx = false;
alert("Enter the rememberance text")
document.forms[0].remtext.value = ""
document.forms[0].remtext.focus()
}
if (flagx )
{
document.forms[0].action = "insdata.asp"
document.forms[0].submit()
}
}
//-------------- for forgot password link -----------------//
function forgot()
{
parent.location.href = "forgot.asp?qfrom=subitems.asp" ;
}

//--- forgot password functions starts here prgrm 1 -- //
function forgotasp1()
{
if(isSpecialChr(document.forms[0].useridf) == true)
{
alert("Enter valid Characters");
document.forms[0].useridf.select();
document.forms[0].useridf.focus();
return true;
}

document.forms[0].action="forgot1.asp"
document.forms[0].submit()
}
function forgotasp2()
{
document.forms[0].action="forgot2.asp"
document.forms[0].submit()
}
//------ get cookie value -----//
function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}
//----- create cookies - shoppingcart page -----//
function SideBannCookieCr()
{
for (nCount=0;nCount<document.forms[0].elements.length;nCount++)
	{
		if (document.forms[0].elements[nCount].type == "checkbox" )
		{
		  if(document.forms[0].elements[nCount].checked==true)
			 {
			  document.cookie=document.forms[0].elements[nCount].name + "=" + document.forms[0].elements[nCount-1].value ;
			  if (document.forms[0].elements[nCount+1].type == "select-one")
			  {
document.cookie=document.forms[0].elements[nCount+1].name+"="+document.forms[0].elements[nCount+1].options[document.forms[0].elements[nCount+1].options.selectedIndex].value ;}

			 }else
			 {
			 if (Get_Cookie(document.forms[0].elements[nCount].name) > 0)
			 {
			 document.cookie=document.forms[0].elements[nCount].name + "=" + document.forms[0].elements[nCount-1].value ;
             if (document.forms[0].elements[nCount+1].type == "select-one")
			 {
             document.cookie=document.forms[0].elements[nCount+1].name+"=0"
             }
			 
			 }
			 }		
		}
	}
//alert(document.cookie);
}
//--------------------------------------------------
function CheckMeasurements(){
for (nCount=0;nCount<document.forms[0].elements.length;nCount++)
{
if (document.forms[0].elements[nCount].type == "text"){

//-------------------------------------
if (document.forms[0].elements[nCount].value > 99){
flagb=false;
alert("Please Enter Correct measurement");
document.forms[0].elements[nCount].focus();
document.forms[0].elements[nCount].select();
break;
}
else if (isNaN(document.forms[0].elements[nCount].value)){
flagb=false;
alert("Please Enter Correct measurement");
document.forms[0].elements[nCount].focus();
document.forms[0].elements[nCount].select();
break;
}
else if (document.forms[0].elements[nCount].value == ""){
flagb=false;
alert("Please Enter Correct measurement");
document.forms[0].elements[nCount].focus();
document.forms[0].elements[nCount].select();
break;
}
//---------------------------------------
}
}
//------------------------------------
}
function Sresult()
{
document.forms[0].action="CP_searchresults.asp"
document.forms[0].submit();
}
//----------------------------------------------
//Disable select-text script (IE4+, NS6+)- By Andy Scott
//Exclusive permission granted to Dynamic Drive to feature script
//Visit http://www.dynamicdrive.com for this script

/*function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")

//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}*/
//----------------------------------------------
<!--

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="          UNAUTHORISED REPRODUCTION \nOF COPYRIGHT MATERIAL IS PUNISHABLE OFFENCE !!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// -->
