function header(path,showViewCartFlag){
if(path==null)path="./";
if(showViewCartFlag==null) showViewCartFlag=true;
document.write('<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td width="100%" background="../images/top.jpg" height="8"></td></tr><tr><td width="100%" height="10"></td></tr><tr><td width="100%">     <div align="center"><center>');
document.write('<table border="0" cellpadding="0" cellspacing="0" width="98%"><tr><td width="18%" background="../images/main-flash-bg1.jpg" height="110" class="run"><OBJECT classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000          codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0 height=110 width=217>           <param name="_cx" value="15134"><param name="_cy" value="3836"><param name="FlashVars" value><param name="Movie" value="../top-flash.swf"><param name="Src" value="../top-flash.swf"><param name="WMode" value="Transparent"><param name="Play" value="0"><param name="Loop" value="-1"><param name="Quality" value="High"><param name="SAlign" value><param name="Menu" value="0"><param name="Base" value><param name="AllowScriptAccess" value="always"><param name="Scale" value="NoBorder">      <param name="DeviceFont" value="0"><param name="EmbedMovie" value="0"><param name="BGColor" value><param name="SWRemote" value><param name="MovieData" value><param name="SeamlessTabbing" value="1"><param name="Profile" value="0"><param name="ProfileAddress" value><param name="ProfilePort" value="0"><param name="AllowNetworking" value="all"><embed src="../top-flash.swf" menu="false" quality="best" scale="noborder" wmode="transparent" bgcolor="#FFFFFF" WIDTH="217" HEIGHT="110" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></OBJECT></td>');
document.write('<td width="82%" background="../images/main-flash-bg1.jpg" height="110" valign="top" class="run"><!--  --><OBJECT classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000   codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0 height=66 width=296>           <param name="_cx" value="15134"><param name="_cy" value="3836"><param name="FlashVars" value><param name="Movie" value="../top-flash1.swf"><param name="Src" value="../top-flash1.swf"><param name="WMode" value="Transparent"><param name="Play" value="0"><param name="Loop" value="-1"><param name="Quality" value="High"><param name="SAlign" value><param name="Menu" value="0"><param name="Base" value><param name="AllowScriptAccess" value="always"><param name="Scale" value="NoBorder">      <param name="DeviceFont" value="0"><param name="EmbedMovie" value="0"><param name="BGColor" value><param name="SWRemote" value><param name="MovieData" value><param name="SeamlessTabbing" value="1"><param name="Profile" value="0"><param name="ProfileAddress" value><param name="ProfilePort" value="0"><param name="AllowNetworking" value="all"><embed src="../top-flash1.swf" menu="false" quality="best" scale="noborder" wmode="transparent" bgcolor="#FFFFFF" WIDTH="296" HEIGHT="66" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></OBJECT>');        
document.write('<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td width="100%" bgcolor="#FFFFFF" height="32"><table border="0" cellpadding="0" cellspacing="0" width="100%" background="/images/links_strip.jpg" height="28"><tr><td width="3%" height="28" ></td><td width="13%" height="28" ><p align="center"><a href=/aboutus.php>About Academic</a></td><td width="6%" height="28" valign="middle"><p align="center"><img border="0" src="/images/line_bg.gif" width="2" height="22"></p></td><td width="13%" height="28" ><p align="center"><a href=/help.php>Support / Help</a></td><td width="5%" height="28" ><p align="center"><img border="0" src="/images/line_bg.gif" width="2" height="22"></p></td><td width="10%" height="28" ><p align="center"><a href=/cart/viewCart.php?action=show>View Cart</a></td><td width="6%" height="28" ><p align="center"><img border="0" src="/images/line_bg.gif" width="2" height="22"></p></td><td width="8%" height="28" ><p align="center"><a href=/pageNew_arrival.php>New Arrivals</a></td><td width="8%" height="28" ><p align="center"><img border="0" src="/images/line_bg.gif" width="2" height="22"></p></td><td width="8%" height="28" ><p align="center"><a href=/pagebest_sell.php>Best Selling</a></td><td width="8%" height="28" ><p align="center"><img border="0" src="/images/line_bg.gif" width="2" height="22"></p></td><td width="8%" height="28" ><a href=../wishlist.php?action=view>Wish List</a></td><td width="9%" height="28" ></td></tr></table></td></tr>');
document.write('<tr ><td width="100%" bgcolor="#3088C0"><table border="0" cellpadding="0" width="100%" bgcolor="#FFFFFF" height="12"><tr><td width="16%" bgcolor="#3088C0"><img border="0" src="../images/bulet1.gif" width="14" height="5"></td>         <td width="16%" bgcolor="#308CC0"><img border="0" src="../images/bulet1.gif" width="14" height="5"></td><td width="16%" bgcolor="#308CC0"><img border="0" src="../images/bulet1.gif" width="14" height="5"></td><td width="16%" bgcolor="#70BC30"><img border="0" src="../images/bulet1.gif" width="14" height="5"></td><td width="16%" bgcolor="#D85410"><img border="0" src="../images/bulet1.gif" width="14" height="5"></td><td width="20%" bgcolor="#787478"><img border="0" src="../images/bulet1.gif" width="14" height="5"></td></tr></table></td></tr></table></td></tr></table> </center></div></td></tr>');
document.write('<tr><td width=100%><div align="center"><center><table border="0" cellpadding="3" cellspacing="0" width="96%"><td width="15%"><table border="0" cellpadding="3" cellspacing="0" width="100%"><tr><td width="5%"><a href=../cart/viewCart.php?action=show><img border="0" src="../images/cart-bulet.jpg" width="17" height="17"></a></td><td width="6%"></td><td width="89%"><a href=../cart/viewCart.php?action=show></a></td></tr></table></td><td width="54%"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td width="3%"></td><td width="1%"></td><td width="52%"><table border="0" cellpadding="3" cellspacing="4" width="100%"><form NAME=\"frm_se\" ACTION=\"../utilities/search.php\" METHOD=POST onsubmit="return validSearch();"><tr><td><img border="0" src="../images/search.jpg" width="53" height="18"></td><td><SELECT class=currency_select name=searchtype><option value="keywords">Keywords</option><option value="description">Titles</option><option value="SKU">ISBN</option><option value="Author">Authors</option>    </SELECT></td><td><input type=text name=data size=40 class=currency_select></td><td><input type="image" src="../images/go.jpg"></td></tr> </form></table></td> <td width="15%"></td></center></center><td width="41%"><p align="right"><a href=../index.php><font color=#787478>Home</font></a><font color=#A4A4A4> | </font><a href="/contactus.php"><font color=#787478>Contact Us</font></td></tr></table></td><center><center><td width="20%"><div align="right">');
document.write('<table border="0" cellpadding="0" width="60%"><tr>');
document.write('<td width="20%"><img border="0" src="../images/color3.gif" title="Theme3" width="18" height="18" align="right" onclick="window.style.Set(\'Theam3\');return false;"></td>');
document.write('<td width="20%"><img border="0" src="../images/color4.gif" title="Theme4" width="18" height="18" align="right" onclick="window.style.Set(\'Theam4\');return false;"></td>');
document.write('<td width="20%"><img border="0" src="../images/color5.gif" title="Theme5" width="18" height="18" align="right" onclick="window.style.Set(\'Theam5\');return false;"></td>');
document.write('<td width="20%"><img border="0" src="../images/color1.gif" title="Theme1" width="18" height="18" align="right" onclick="window.style.Set(\'Theam1\');return false;"></td>');
document.write('<td width="20%"><img border="0" src="../images/color2.gif" title="Theam2" width="18" height="18" align="right" onclick="window.style.Set(\'Theam2\');return false;"></td></tr><tr><td colspan=5 align=center><font color=#787478>Change Theme</font></td></tr></table>');
document.write('</div></td></table></center></div></td></tr></table>');
}

function validSearch()
{
	if(document.frm_se.data.value=='' || document.frm_se.data.value=='Enter Search Keywords')
	{
		alert("Please Enter Keywords for search");
		document.frm_se.data.focus();
		return false;
	}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
function leftpanel(path){
if(path==null)path="./";
document.write('<TABLE WIDTH=150 CELLPADDING=0 CELLSPACING=0 ><TR><TD><? include("/store/dCategories.php") ?><!-- <IFRAME WIDTH="100%" HEIGHT="100%" SRC="/store/dCategories.php" FRAMEBORDER=0></IFRAME> --></TD></TR></TABLE>');
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////
function rightpanel(path){

if(path==null)path="./";

document.write('<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td width="100%" background="images/right-strip-bg.jpg" height="23" class="second"><table border="0" cellpadding="4" cellspacing="0" width="100%" height="23"><tr><td width="10%"><p align="center"><img border="0" src="images/right-strip-bullet.jpg" width="9" height="9"></td><td width="90%" class="heading">New Arrivals</td></tr></table></td></tr><tr><td width="100%" height="4"></td></tr><tr><td width="100%" bgcolor="#FFFFFF"><table border="0" cellpadding="12" cellspacing="0" width="100%"><tr><td width="100%"><b>CREATING A&nbsp; SUSTAINABLE FEATURE</b></td></tr><tr><td width="100%"> <p align="justify"><font face="Verdana" size="1">Peter B. Kaufman, Kristofer, W Coon, J.N&nbsp; Govil, James E. Hoyt Casey R.L.u Barbara J Madsen and Sara Warber<br><br><br>ISBN : 1-930-81301-5<br>Price : US $ 103.50</font></td></tr>     </table></td></tr><tr><td width="100%" height="13"></td></tr>');
document.write('<tr><td width="100%"><table border="0" cellpadding="12" cellspacing="0" width="100%" bgcolor="#FFFFFF"> <tr><td width="100%"><b><font face="Verdana" size="1" color="#509C00">CREATING A&nbsp; SUSTAINABLE FEATURE</font></b></td></tr><tr><td width="100%"><p align="justify"><font face="Verdana" size="1">Peter B. Kaufman, Kristofer, W Coon, J.N&nbsp; Govil, James E. Hoyt Casey R.L.u Barbara J Madsen and Sara Warber<br><br><br>ISBN : 1-930-81301-5<br>Price : US $ 103.50</font></td></tr></table></td></tr><tr><td width="100%" height="10"></td></tr><tr>  <td width="100%"><img border="0" src="images/banner.jpg" width="202" height="141"></td></tr><tr><td width="100%"><table border="0" cellpadding="2" cellspacing="0" width="100%"><tr><td width="5%" height="10" align="center"></td><td width="10%" height="10" align="center"></td><td width="85%" height="10"></td></tr><tr><td width="5%" align="center"></td><td width="10%" align="center"><p align="center"><img border="0" src="images/arrow.jpg" width="8" height="8"></td>');
document.write('<td width="85%"><font face="Verdana" size="1" color="#404C50">Lower Your monthly payment</font></td></tr><tr><td width="5%" align="center"></td><td width="10%" align="center"><img border="0" src="images/arrow.jpg" width="8" height="8"></td><td width="85%"><font face="Verdana" size="1" color="#404C50">Avoid rate increases</font></td></tr><tr><td width="5%" align="center"></td><td width="10%" align="center"><img border="0" src="images/arrow.jpg" width="8" height="8"></td><td width="85%"><font face="Verdana" size="1" color="#404C50">Tape      your home equity</font></td></tr><tr><td width="5%" align="center"></td><td width="10%" align="center"><img border="0" src="images/arrow.jpg" width="8" height="8"></td><td width="85%"><font face="Verdana" size="1" color="#404C50">Build     equity faster</font></td></tr></table></td></tr></table>');
}

function rightpane2()
{
	document.write('<TABLE WIDTH=208 CELLSPACING=0 CELLPADDING=2 BGCOLOR=WHITE class=smalltable>');
	//document.write('<tr><td><A href="../help.php"><img border=0 src="../images/help.jpg"></a></td></tr>');
	document.write('<TR HEIGHT=25><TD><B>&raquo;&raquo;</B> <B>More Info</B></TD></TR>');
	document.write('<TR><TD><UL CLASS=ULLIST1 type="disc"><LI>-<A>Shipping:</A><UL  CLASS=ULLIST2 type="circle"><LI><A href="../returnPolicy.php">Return Policy</A></LI><LI><A href="../pricing_policy.php">Pricing Policy</A></LI><LI><A href="../returnform.php">Product Return Form</A></LI><LI><A href="../faq.php">FAQ</A></LI><LI><A HREF="../help.php">Help</A></LI><LI><A HREF="../term_condition.php">Terms and Conditions</A></LI></UL></LI></UL></TD></TR>');
		
	
	document.write('</TABLE>');
	//<img src="../images/verisign.jpg" width=150 height=70>
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
function footer(path){
if(path==null)path="./";
//document.write('<tr><td width="100%" colspan="3" height=15></td></tr><tr><td width="100%" colspan="3" height=1><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td width="12%" align="center"><font face="Verdana" size="2">Encyclopedia</font></td><td width="12%" align="center"><font face="Verdana" size="2">Advance Search</font></td> <td width="12%" align="center"><font face="Verdana" size="2">Text Books</font></td><td width="12%" align="center"><font face="Verdana" size="2">Catalogue</font></td><td width="12%" align="center"><font face="Verdana" size="2">Academic</font></td><td width="12%" align="center"><font face="Verdana" size="2">Wish                    List</font></td><td width="22%" align="center"><font face="Verdana" size="1" color="#807878">Designed                   by&nbsp; emavens.com</font></td></tr><tr><td width="100%" align="center" colspan="7" height="3"></td></tr><tr>          <td width="100%" align="center" colspan="7"><table border="0" cellpadding="0" width="100%"><tr><td width="12%" align="center" bgcolor="#3088B8" height="8"></td><td width="12%" align="center" bgcolor="#3088B8" height="8"></td>      <td width="12%" align="center" bgcolor="#3088B8" height="8"></td><td width="12%" align="center" bgcolor="#3088B8" height="8"></td><td width="12%" align="center" bgcolor="#3088B8" height="8"></td><td width="12%" align="center" bgcolor="#3088B8" height="8"></td><td width="22%" align="center" bgcolor="#B8B4B8" height="8"></td></tr></table>        </td></tr><tr><td width="100%" align="center" colspan="7"><br></td></tr></table></td></tr>');
document.write('<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">');
document.write('<tr><td width="100%" height="5"></td></tr>');
document.write('<tr><td width="100%">');
document.write('<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center">');
document.write('<tr><td width="14%" align="center"><a href="/aboutus.php" class="footerlink">About Academic</a></td>');
document.write('<td width="14%" align="center"><a href="/help.php" class="footerlink">Support / Help</a></td>');
document.write('<td width="14%" align="center"><a href="/cart/viewCart.php?action=show" class="footerlink">View Cart</a></td>');
document.write('<td width="14%" align="center"><a href="/pageNew_arrival.php" class="footerlink">New Arrivals</a></td>');
document.write('<td width="14%" align="center"><a href="/pagebest_sell.php" class="footerlink">Best Selling</a></td>');
document.write('<td width="14%" align="center"><a href="/wishlist.php?action=view" class="footerlink">Wish List</a></td>');
document.write('<td width="17%" align="center"><a href="/siteMap.php" class="footerlink">Site Map</a></td>');
document.write('</tr></table></td></tr>');
document.write('<tr><td width="100%" height="3"></td></tr>');
document.write('<tr><td width="100%">');
document.write('<table border="0" cellpadding="0" width="100%">');
document.write('<tr><td width="14%" height="8" bgcolor="#B07810" class="second"></td>');
document.write('<td width="14%" height="8" bgcolor="#B07810" class="second"></td>');
document.write('<td width="14%" height="8" bgcolor="#B07810" class="second"></td>');
document.write('<td width="14%" height="8" bgcolor="#B07810" class="second"></td>');
document.write('<td width="14%" height="8" bgcolor="#B07810" class="second"></td>');
document.write('<td width="14%" height="8" bgcolor="#B07810" class="second"></td>');
document.write('<td width="14%" height="8" bgcolor="#B07810" class="second"></td>');
document.write('</tr></table></td></tr><tr><td width="100%" height="5"></td></tr>');
document.write('<tr><td width="100%"><p align="center"><img border="0" src="../images/cp.jpg" width="11" height="11">Copyright Academic Book Center</td></tr></table>');

}






/////////////////////////////////////////////////////////////////////////////////////////////////////////////
function accountpanel(username,path){
if(path==null)path="./";
document.writeln('<table width=100% cellpadding=0 cellspacing=1 height=30 border=0><TR><TD BGCOLOR="#D2F9FE">&nbsp;<FONT class=heading>Welcome <FONT COLOR="red">'+username+'</FONT></FONT></TD><!-- <TD bgcolor="#A8C098" align=center width=80><A HREF="account.php" style="{color:white;}"><B>My Account</A></TD> --><TD colspan=3 bgcolor="#A8C098" align=center  width=80><A HREF="logout.php" style="{color:white;}"><B>Logout</B></A></TD></TR></table>');
}





/////////////////////////////////////////////////////////////////////////////////////////////////////
//generic function to add items to a drop down list box.
function addToList(chkObject, newText, newValue) {
var isSelected = false;
var qty=chkObject.form.quantity.value;
var inrprice=chkObject.form.inrprice.value;
var symbol=chkObject.form.currency.value;
var price=0;
var  _lastCurrencySymbol;

 //_lastCurrencySymbol= document.cookie("lastCurrency");

/*if ( (_lastCurrencySymbol.toUpperCase() != symbol.toUpperCase()) &&  _lastCurrencySymbol != ""){
	alert("Different Currency!");
}*/

for (var k=0;k<currencySymbolsAndValues.length;k++){
	//alert(currencySymbolsAndValues[k][0]+ " : " + currencySymbolsAndValues[k][1]);
	if (symbol == currencySymbolsAndValues[k][0]){
		price = roundMore(parseFloat(parseInt(inrprice/currencySymbolsAndValues[k][1]*100)/100));
	}

}


/*_lastCurrencySymbol=symbol;
document.cookie("lastCurrency")=_lastCurrencySymbol;*/


				if (chkObject.checked==true) {
					isSelected=true;
					
				}
		//alert(isSelected);

 		if (isSelected) {
		  var len = document.cart.selProductCodes.length++; 
		  document.cart.selProductCodes.options[len].value = newValue.toUpperCase();
	      document.cart.selProductCodes.options[len].text = newText.toUpperCase()+"  -  "+qty+"   - "+symbol+" "+price;
		  document.cart.selProductCodes.selectedIndex = 0; 
			document.cart.selProductCodes.size++;
		}else{
			removeFromList(chkObject, newText, newValue);
			document.cart.selProductCodes.size--;
		}
document.cart.txiTotalItems.value = document.cart.selProductCodes.length;
}


//generic function to add items to a drop down list box.
function removeFromList(chkObject, newText, newValue) {
var isSelected = false;
var len=document.cart.selProductCodes.length;
var j=0;
var optionsArray=Array();
//alert("Getting all values from cart list!");

	for (var i=0;i<len;i++){
		optionsArray[i]=new Array(document.cart.selProductCodes.options[i].value,document.cart.selProductCodes.options[i].text);
		//optionsArray[i][0]=document.cart.selProductCodes.options[i].value;
		//optionsArray[i][1]=document.cart.selProductCodes.options[i].text;
	}

//alert("Got all products from list!");

//	alert(optionsArray);
//alert("Making cart.selProducts.length = 0");
	document.cart.selProductCodes.length=0;
	
//alert("Travesing all the product codes from optionsArray");	
		//alert("looking for "+newValue);
	for (var i=0;i<optionsArray.length;i++){
		//alert("I =  " +i+ " and writing "+optionsArray[i]);

		if ( optionsArray[i][0] != newValue) {
			//alert("Increasing length of list box");
			document.cart.selProductCodes.length++;	
			//alert("Assigning new value"+optionsArray[i]);
				document.cart.selProductCodes.options[j].value = optionsArray[i][0];
			//alert("Assinging new Text "+optionsArray[i]);

			document.cart.selProductCodes.options[j].text = optionsArray[i][1];
			j++;
		}else{
		//	alert("Found "+newValue);
		}

	}
}






////////////////////////////////////////////////////////////////////////////////////////////////////////
function roundMore(num){
var floor,ceil,fraction;
floor=Math.floor(num);
ceil=Math.ceil(num);
	if (! (ceil-floor) ){
		return num;
	}else{
		fraction= num - floor;

		if ( fraction <=0 ){
			fraction=0;
		}else if (fraction <=.25 && fraction > 0){
			fraction=.25;
		
		}else if (fraction <=.5 && fraction > 0){
			fraction=.5;
		
		}else if (fraction <=.75 && fraction > 0){
			fraction=.75;
		
		}else {
			fraction=1;
		}
		num = floor + fraction;
		return num;
	}
}







////////////////////////////////////////////////////////////////////////////////////////////////////////
function showMoreProductDetails(pcode){
//alert(pcode);
var detailsWindow=window.open("/store/showMoreDetails.php?pcode="+pcode,"moreWindow","Width=400, Height=250, Scrollbars=1, Toolbars=0");
return false;
}









////////////////////////////////////////////////////////////////////////////////////////////////////////
function knowMore(){
//alert(pcode);
var knowmoreWindow=window.open("/user/knowMore.php","knowmoreWindow","Width=400, Height=400, Scrollbars=1, Toolbars=0");
return false;
}









////////////////////////////////////////////////COMMON FUNCTIONS/////////////////////////////////////////////////////////////////////
//THIS FUNTION CHECK FOR A VALID  EMAIL ADDRESS.
function isValidEmail(emailid) {
if (emailid == ""){
	return false; // because  it is not optional 
}
else{
		var eid=emailid;

		if (eid.indexOf(' ')!= -1){
			return false ; // no spaces
		} 
		if (eid.length < 6 ){
			return false ; // at least j.a@in
		}
		at=eid.indexOf('@', 0); //check from first position ---- 
		if ( at == -1 || at == 0){ //should not be at first place
			return false ;
		}else{
				var at1=eid.indexOf('@', (at + 1)); //looking for another at one place ahead
				if ( at1 == -1 ) // ie only one at is there
				{
					var dot=eid.indexOf('.',(at + 1));//looking for just next value
					if(dot == (at + 1)|| dot== -1){ //if dot is not there or in the next place
						return false ;	
						}
					else{
						 if ( (dot + 2 ) < eid.length )
							return true ;
						 else{
							return false ;
						}
					}
				}
				else // two @ are there
				{
					return false;
				}
			}	
	return false ;
	}		
}
//////////////////THIS FUNCTION CHECK ANY GIVEN PHONE NO.
function isValidPhone(phoneid){
var numstr="1234567890+-, ";
var intctr,intLen;
    intLen=phoneid.length;
        for(intCtr=0;intCtr <= intLen && numstr.indexOf(phoneid.charAt(intCtr))>=0 ;intCtr++);
        if(intCtr > intLen)
              return true;
        else
              return false;
      
}

////////THIS FUNCTION TRIMS THE TRAILING WHITE SPACES IN A GIVEN STRING.
function trim(str1){
// This function trims any given field value for blank spaces.
        var intCtr=0
        for(intCtr=0;str1.charAt(intCtr)==" ";intCtr++);
        str1=str1.substring(intCtr,str1.length);
        return str1;    
}
function checkforchar(strdate){
//This function checks for string values
var validdate = ",.abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var strlength = strdate.length;
	for(var i=0; i<=strlength; i++)
	{
		var unitstr = strdate.substr(i,1);
		if (validdate.indexOf(unitstr)==-1)
		{
			return false;
		}
	}
	return true;
}
function isAllNumeric(str1){
//This function checks for numeric values
        var numstr="1234567890 ,-";
        var intctr,intLen;
            intLen=str1.length;
        for(intCtr=0;intCtr <= intLen && numstr.indexOf(str1.charAt(intCtr))>=0 ;intCtr++);
        if(intCtr > intLen)
        {
                return 1;
        }
        else
        {
        return 0;
        }
}

function goBack() { 
history.back();   
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function doSameAs(frm){

	//if(document.frm.selSenderCountry.value=="United Kingdom"){
	if (window.document.frm.sameAs.checked){
		window.document.frm.selTitle.value	=			window.document.frm.selSenderTitle.value;
		window.document.frm.txiLastName.value	=			window.document.frm.txiSenderLastName.value;
		window.document.frm.txiName.value	=			window.document.frm.txiSenderName.value;
		window.document.frm.txiMobileNo.value	=		window.document.frm.txiSenderMobileNo.value;
		window.document.frm.txiCompany.value	=		window.document.frm.txiSenderCompany.value;
		
		window.document.frm.txaAddress.value	=		window.document.frm.txaSenderAddress.value;
		window.document.frm.txaAddress_t.value	=		window.document.frm.txaSenderAddress2.value;
		window.document.frm.selCountry.value	=		window.document.frm.selSenderCountry.value;
		window.document.frm.txiCountryCode.value	=		window.document.frm.SenderCountrycode.value;
		window.document.frm.txiState.value	=		window.document.frm.txiSenderState.value;
		window.document.frm.txiStatecode.value	=		window.document.frm.txiSenderStatecode.value;
		window.document.frm.txiCity.value	=		window.document.frm.txiSenderCity.value;
		window.document.frm.txiZipcode.value	=		window.document.frm.txiSenderZipcode.value;
		
		window.document.frm.txiPhone.value	=		window.document.frm.txiSenderPhone.value;
		window.document.frm.txiEmail.value	=		window.document.frm.txiSenderEmail.value;
		window.document.frm.txaRemarks.value	=		window.document.frm.txaSenderRemarks.value;
		stateNameCode();
	}else{
		window.document.frm.txiLastName.value	= "";
		window.document.frm.txiName.value	= "";
		window.document.frm.txiMobileNo.value	= "";
		window.document.frm.txiCompany.value	= "";
		window.document.frm.txaAddress.value	= "";
		window.document.frm.txiCity.value	= "";
		window.document.frm.txiState.value	= "";
		window.document.frm.txiZipcode.value	= "";
		window.document.frm.selCountry.value	= "";
		window.document.frm.txiPhone.value	= "";
		window.document.frm.txiEmail.value	= "";
		window.document.frm.txaRemarks.value	= "";
	}
return true;/*}
else{
	alert("To dispatch outside United Kingdom, Please choose another Currency  ");
	return false;
}*/
}

//////////////////////////////////////////////////shopping cart form validations.///////////////////////////////////////////////////
function checkShoppingCartForm(frm){

//check for name
	if ( trim(frm.txiSenderName.value).length <= 0 ){
			alert("Billing - Name is missing!");
			frm.txiSenderName.focus();
			return false;
	}
//check for address
	if ( trim(frm.txaSenderAddress.value).length <= 0 ){
			alert("Billing  - Address is missing!");
			frm.txaSenderAddress.focus();
			return false;
	}

//check for city
	if ( trim(frm.txiSenderCity.value).length <= 0 ){
			alert("Billing - City is missing!");
			frm.txiSenderCity.focus();
			return false;
	}
//check for state
	if ( trim(frm.txiSenderState.value).length <= 0 ){
			alert("Billing - State is missing!");
			frm.txiSenderState.focus();
			return false;
	}

//check for ZipCOde
	if ( trim(frm.txiSenderZipcode.value).length <= 0 ){
			alert("Billing - Zip code is missing!");
			frm.txiSenderZipcode.focus();
			return false;
	}

//check for country
	if ( trim(frm.selSenderCountry.value).toUpperCase() == "NA" ){
			alert("Billing - Country is missing!");
			frm.selSenderCountry.focus();
			return false;
	}

//check for phone
	if ( trim(frm.txiSenderPhone.value).length <= 0 ){
			alert("Billing - Phone is missing!");
			frm.txiSenderPhone.focus();
			return false;
	}
//check for phone validity.
	if ( !isValidPhone(trim(frm.txiSenderPhone.value)) ) {
			alert("Billing - Phone no is not correct!");
			frm.txiSenderPhone.focus();
			return false;
	}


//check for email
	if ( trim(frm.txiSenderEmail.value).length <= 0 ){
			alert("Billing -  Email is missing!");
			frm.txiSenderEmail.focus();
			return false;
	}

//check for email validity.
	if ( !isValidEmail(trim(frm.txiSenderEmail.value)) ) {
			alert("Billing - Email is not correct!");
			frm.txiSenderEmail.focus();
			return false;
	}


//////////////////////////////////////////////////delivery address validations.///////////////////////////////////////////////////
//check for name
	if ( trim(frm.txiName.value).length <= 0 ){
			alert("Delivery - Name is missing!  For Same delivery details please check the check box.");
			frm.txiName.focus();
			return false;
	}
//check for address
	if ( trim(frm.txaAddress.value).length <= 0 ){
			alert("Delivery  - Address is missing!");
			frm.txaAddress.focus();
			return false;
	}

//check for city
	if ( trim(frm.txiCity.value).length <= 0 ){
			alert("Delivery - City is missing!");
			frm.txiCity.focus();
			return false;
	}
//check for state
	if ( trim(frm.txiState.value).length <= 0 ){
			alert("Delivery - State is missing!");
			frm.txiState.focus();
			return false;
	}

//check for ZipCOde
	if ( trim(frm.txiZipcode.value).length <= 0 ){
			alert("Delivery - Zip code is missing!");
			frm.txiZipcode.focus();
			return false;
	}

//check for country
	if ( trim(frm.selCountry.value).toUpperCase() == "NA" ){
			alert("Delivery - Country is missing!");
			frm.selCountry.focus();
			return false;
	}

//check for phone
	if ( trim(frm.txiPhone.value).length <= 0 ){
			alert("Delivery - Phone is missing!");
			frm.txiPhone.focus();
			return false;
	}
//check for phone validity.
	if ( !isValidPhone(trim(frm.txiPhone.value)) ) {lo
			alert("Delivery - Phone no is not correct!");
			frm.txiPhone.focus();
			return false;
	}


//check for email
	if ( trim(frm.txiEmail.value).length <= 0 ){
			alert("Delivery -  Email is missing!");
			frm.txiEmail.focus();
			return false;
	}

//check for email validity.
	if ( !isValidEmail(trim(frm.txiEmail.value)) ) {
			alert("Delivery - Email is not correct!");
			frm.txiEmail.focus();
			return false;
	}





//if all fields are valid then
	return true;

}



function confirmRemove(){
if(confirm("Do you realy want to delete this recipient address details from your address book?")){
	return true;
}else{
return false;
}


}

function confirmCartRemove(pid){
	if(confirm("Do you realy want to delete "+ pid +" from your shopping cart?"))
		return true;
	else
		return false;
}


function checkForm(frm){

var q=frm.quantity.value;
var lastcurrency=frm.lastTimeCurrency.value.toUpperCase();
var currency= frm.currency.value.toUpperCase();

if ( isNaN(q) || !isAllNumericQuantity(q)){
	alert("Product quantity is incorrect.\nPlease enter correct quantity!");
	frm.quantity.focus();
	return false;
}


if ( currency != lastcurrency && lastcurrency !=""){
		if ( confirm("You have choosen a different currency "+currency+" this time. Do you want to buy in "+currency+ "?")){
		}else{
			frm.currency.value=lastcurrency;
		}
}
return true;
}

function checkFormT(frm){

var q=frm.quantity.value;
var lastcurrency=frm.lastTimeCurrency.value.toUpperCase();
var currency= frm.currency.value.toUpperCase();

/*if(q<5){
	alert("Quantity of the form is atleast 5");
	frm.quantity.focus();
	return false;
}*/
if ( isNaN(q) || !isAllNumericQuantity(q)){
	alert("Product quantity is incorrect.\nPlease enter correct quantity!");
	frm.quantity.focus();
	return false;
}


if ( currency != lastcurrency && lastcurrency !=""){
		if ( confirm("You have choosen a different currency "+currency+" this time. Do you want to buy in "+currency+ "?")){
		}else{
			frm.currency.value=lastcurrency;
		}
}
return true;
}


function isAllNumericQuantity(str1){
//This function checks for numeric values
        var numstr="1234567890";
        var intctr,intLen;
            intLen=str1.length;
        for(intCtr=0;intCtr <= intLen && numstr.indexOf(str1.charAt(intCtr))>=0 ;intCtr++);
        if(intCtr > intLen){
                return 1;
        }else{
        return 0;
        }
}


////////////////////////////////////////////////////////////////////////////////////////////////
function checkLoginForm(frm){
	if (frm.user_id.value.length<=0 || frm.user_id.value == "" ){
		alert("Please enter the user id!");
		frm.user_id.focus();
		return false;
	}

	if (frm.password.value.length<=0 || frm.password.value == "" ){
		alert("Please enter the password!");
		frm.password.focus();
		return false;
	}
return true;
}

////////////////////////////////////////////////////////////////////////////////////////////////
function checkNewLoginForm(frm){
	if (frm.user_id.value.length<=0 || frm.user_id.value == "" ){
		alert("Please enter the user id!");
		frm.user_id.focus();
		return false;
	}

	if (frm.password.value.length<=0 || frm.password.value == "" ){
		alert("Please enter the password!");
		frm.password.focus();
		return false;
	}

	if (frm.password.value.length<5){
		alert("Password should have minimum of five characters!");
		frm.password.focus();
		return false;
	}
	

	if (frm.confirm_password.value.length<=0 || frm.confirm_password.value == "" ){
		alert("Please enter the confirm password!");
		frm.confirm_password.focus();
		return false;
	}
	
	if (frm.password.value != frm.confirm_password.value){
		alert("Your password do not match!");
		frm.confirm_password.focus();
		return false;
		
	}
	
	
return true;
}

///////////////////////////////////////////////////////////////////////////////////////
function checkChangePasswordForm(frm){
	if (frm.txiUserId.value.length<=0 || frm.txiUserId.value == "" ){
		alert("Please enter the user id!");
		frm.txiUserId.focus();
		return false;
	}

	if (frm.txiPassword.value.length<=0 || frm.txiPassword.value == "" ){
		alert("Please enter the password!");
		frm.txiPassword.focus();
		return false;
	}

	if (frm.txiNewPassword.value.length<=0 || frm.txiNewPassword.value == "" ){
		alert("Please enter the new password!");
		frm.txiNewPassword.focus();
		return false;
	}
	
	if (frm.txiPassword.value == frm.txiNewPassword.value){
		alert("Your passwords match, enter new Password!");
		frm.txiNewPassword.focus();
		return false;
		
	}
	
	if (frm.txiNewPassword.value.length<5){
		alert("Password should have minimum of five characters!");
		frm.txiNewPassword.focus();
		return false;
	}
	
return true;
}

//////////////////////////////////////////////////////////////////////////////////////////////
function checkCart(frm){
	//alert('called');
	for (var i=0;i<frm.elements.length-1;i++){
		
		if ( frm.elements[i].type.toUpperCase() == "TEXT" ){
			if ( !isAllNumericQuantity(frm.elements[i].value)){
				alert("Please enter correct quantity of product for updating the cart!");
				frm.elements[i].focus();
				return false;
			}
		}
	}
return true;
}


//////////////////////////////////////////////////////////////////////////////////////////////
function checkRegistrationForm(frm){

//check for name field	
	if( trim(frm.txiName.value).length <=0 ){
		alert("Please enter your name!");
		frm.txiName.focus();
		return false;
	}


//check for address field	
	if( trim(frm.txiAddress.value).length <=0 ){
		alert("Please enter your address!");
		frm.txiAddress.focus();
		return false;
	}


//check for city field	
	if( trim(frm.txiCity.value).length <=0 ){
		alert("Please enter your address city!");
		frm.txiCity.focus();
		return false;
	}

//check for state field	
	if( trim(frm.txiState.value).length <=0 ){
		alert("Please enter your address state!");
		frm.txiState.focus();
		return false;
	}

//check for postcode field	
	if( trim(frm.txiPostCode.value).length <=0 ){
		alert("Please enter your address Zip/Pin code!");
		frm.txiPostCode.focus();
		return false;
	}


//check for postcode field	
	if( trim(frm.txiPostCode.value).length <=0 ){
		alert("Please enter your address Zip/Pin code!");
		frm.txiPostCode.focus();
		return false;
	}

//check for country field	
	if( trim(frm.selCountry.value).length <=0 || frm.selCountry.value.toUpperCase() == "NA" || frm.selCountry.value.toUpperCase() == ""){
		alert("Please select your resident country from list!");
		frm.selCountry.focus();
		return false;
	}

//check for phone field	
	if( trim(frm.txiPhone.value).length <=0 ){
		alert("Please enter your phone no.!");
		frm.txiPhone.focus();
		return false;
	}


//check for email field	
	if( trim(frm.txiEmailAddress.value).length <=0 ){
		alert("Please enter your email address.!");
		frm.txiEmailAddress.focus();
		return false;
	}

//check for email validity.
	if ( !isValidEmail(trim(frm.txiEmailAddress.value)) ) {
			alert("Please enter your email id correctly!\n");
			frm.txiEmailAddress.focus();
			return false;
	}

return true;
}

//////////////////////////////////////////////////////////////////////////////////////////////
function checkAddressBookForm(frm){

//check for name field	
	if( trim(frm.txiName.value).length <=0 ){
		alert("Please enter your name!");
		frm.txiName.focus();
		return false;
	}


//check for designation field	
	if( trim(frm.lname.value).length <=0 ){
		alert("Please enter your Designation!");
		frm.txiDesignation.focus();
		return false;
	}


//check for company field	
	if( trim(frm.txiCompany.value).length <=0 ){
		alert("Please enter your Company!");
		frm.txiCompany.focus();
		return false;
	}

//check for address field	
	if( trim(frm.txiAddress.value).length <=0 ){
		alert("Please enter your address!");
		frm.txiAddress.focus();
		return false;
	}


//check for city field	
	/*if( trim(frm.txiCity.value).length <=0 ){
		alert("Please enter your address city!");
		frm.txiCity.focus();
		return false;
	}*/


//check for state field	
	if( trim(frm.txiState.value).length <=0 ){
		alert("Please enter your address state!");
		frm.txiState.focus();
		return false;
	}

//check for postcode field	
	if( trim(frm.txiPostCode.value).length <=0 ){
		alert("Please enter your address Zip/Pin code!");
		frm.txiPostCode.focus();
		return false;
	}


//check for postcode field	
	if( trim(frm.txiPostCode.value).length <=0 ){
		alert("Please enter your address Zip/Pin code!");
		frm.txiPostCode.focus();
		return false;
	}

//check for country field	
	if( trim(frm.selCountry.value).length <=0 || frm.selCountry.value.toUpperCase() == "NA" || frm.selCountry.value.toUpperCase() == ""){
		alert("Please select your resident country from list!");
		frm.selCountry.focus();
		return false;
	}

//check for phone field	
	if( trim(frm.txiPhone.value).length <=0 ){
		alert("Please enter your phone no.!");
		frm.txiPhone.focus();
		return false;
	}


//check for email field	
	if( trim(frm.txiEmailAddress.value).length <=0 ){
		alert("Please enter your email address.!");
		frm.txiEmailAddress.focus();
		return false;
	}

//check for email validity.
	if ( !isValidEmail(trim(frm.txiEmailAddress.value)) ) {
			alert("Please enter your email id correctly!\n");
			frm.txiEmailAddress.focus();
			return false;
	}

return true;
}



