
var qnt=new Array();
var CIid=new Array();
var temp=new Array();
var updated="true";
var counter1=0;

function LTrim( value ) {
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	}
	// Removes ending whitespaces
	function RTrim( value ) {
		var re = /((\s*\S+)*)\s*/;
		return value.replace(re, "$1");
		}
	// Removes leading and ending whitespaces
	function trim( value ) {
			return LTrim(RTrim(value));
		}
		
		

function qntychange(val,cartid){

	updated="false";
	val=trim(val);
	if(val<=99 && val>=0 && val!=""){
	vv=val+"";
	if(val!=0){
	if (vv.indexOf('0')==0){
	va=vv.charAt(1);
	val=parseInt(va);
	}
	}
	
	
				
		var ii=qnt.length;
		
		qnt[ii]=val;
		CIid[ii]=cartid;
		if(counter1>0)
		counter1=counter1-1;
		
	}	
	else{
	if (document.getElementById('noqnty'))
	document.getElementById('noqnty').style.display="none";
	if (document.getElementById('nobook'))
	document.getElementById('nobook').style.display="none";
	
		document.getElementById('errors_cart').innerHTML="<font color='red'><li>Please Enter a Valid Quantity</li></font><br>";

		
		counter1=counter1+1;
	}

}

function getqntycart(){

	if(updated=="false"){

		if(counter1==0){
		if(qnt!="" && CIid!=""){
			
			document.getElementById('cart_qnty').value=qnt;
			document.getElementById('cart_item').value=CIid;
			document.test11.submit();
		
		}
		}
		else{
		if (document.getElementById('noqnty'))
	document.getElementById('noqnty').style.display="none";
	if (document.getElementById('nobook'))
	document.getElementById('nobook').style.display="none";
		document.getElementById('errors_cart').innerHTML="<font color='red'><li>Please Enter a Valid Quantity</li></font><br>";
		}
	}
	else{
	if (document.getElementById('noqnty'))
	document.getElementById('noqnty').style.display="none";
	if (document.getElementById('nobook'))
	document.getElementById('nobook').style.display="none";
	document.getElementById('errors_cart').innerHTML="<font color='red'><li>Please Change the Quantity and then Update</li></font><br>";
	}
		
	
}

		

function checkupdate(){
protocol=window.location.protocol+"//"+window.location.hostname+":"+window.location.port;
	if(updated=="true"){
	document.getElementById('cblogo').value=protocol+"/images/sug_amz.jpg";
	document.getElementById('cbUrl1').value=protocol;
	document.getElementById('merchantUrl').value=protocol;
	document.getElementById('merchant.1').value=protocol;
		document.inectform.submit();
		}
	else{
	if (document.getElementById('noqnty'))
	document.getElementById('noqnty').style.display="none";
	if (document.getElementById('nobook'))
	document.getElementById('nobook').style.display="none";
	document.getElementById('errors_cart').innerHTML="<font color='red'><li>Please Update the Quantity</li></font><br>";
	}
		
}

function removeitem(i){

	document.getElementById('rmttt'+i).submit();
}

function fnCheckNumericKeyInfo($char, $mozChar) {

	   if($mozChar != null) { // Look for a Mozilla-compatible browser
		   if(($mozChar >= 48 && $mozChar <= 57) || $mozChar == 0 || $char ==
		   8  ){
				$RetVal = true;
		   }
		   else {
			   
				$RetVal = false;
		   }
	   }
	   else { // Must be an IE-compatible Browser
		   if(($char >= 48 && $char <= 57)){
				$RetVal = true;
				
		   }
		   else {
			  
				$RetVal = false;
		   }
	   }
	   return $RetVal;
}



function send_to_amazon(url)
{
    location.href = url;
}














