//store utilities
rnd.today=new Date();
rnd.seed=rnd.today.getTime();

function rnd() {
        rnd.seed = (rnd.seed*9301+49297) % 233280;
        return rnd.seed/(233280.0);
         }

function rand(number) {
        return Math.ceil(rnd()*number);
        }


function getOrderId()
   {
     var myDate= new Date();  
 
     	
     var id=ono+rand(99)+":"+myDate.getUTCDate()+"/"+eval(myDate.getUTCMonth()+1)+"/"+myDate.getUTCFullYear()+":"+
		 myDate.getUTCHours()+":"+myDate.getUTCMinutes()+":"+myDate.getUTCSeconds()+
		 (myDate.getTimezoneOffset()/60)
		 ;

    //alert(id);
    return id;
     
   }

//ono="01-";
//alert(getOrderId());

function chkmin(obj,min)
{
 var k=0;
 k=parseFloat(obj.value);
 
 if ( k > min )  return true;
 
 alert(obj.name + " should be greater than " + min);
 return false;
 
}

function doSubmit(oo,obj,minqty,truefalse)
{
 var isTrue= true;
 ono=oo;

 if (truefalse) isTrue=chkmin(obj.qty,minqty);
          else  isTrue=chkmin(obj.Amount,minqty);    
 if (isTrue)
   {
    var thisa=obj;
    var thata=document.common;
    if (truefalse) 
        thisa.Amount.value=eval(obj.qty.value)*SSP_RATE;
    else 
        thisa.Amount.value=eval(obj.Amount.value); 
    thisa.Order_Id.value=getOrderId();
  /*
    thisa.billing_cust_name.value=
             thata.billing_cust_name.value;
    thisa.billing_cust_address.value=
             thata.billing_cust_address.value;
    thisa.billing_cust_country.value=
             thata.billing_cust_country.value;
    thisa.billing_cust_tel.value=
             thata.billing_cust_tel.value;
    thisa.billing_cust_email.value=
             thata.billing_cust_email.value;
    thisa.billing_cust_notes.value=
             thata.billing_cust_notes.value;
    thisa.delivery_cust_name.value=
            thata.delivery_cust_name.value;
    thisa.delivery_cust_address.value=
            thata.delivery_cust_address.value;
    thisa.delivery_cust_tel.value=
            thata.delivery_cust_tel.value;
   */
    thisa.submit();
   }
  else return false; 

}

function copyOver()
{
var theform=document.common;
theform.delivery_cust_name.value = 
theform.billing_cust_name.value;
theform.delivery_cust_address.value = theform.billing_cust_address.value +"\n"+theform.billing_cust_country.value;
theform.delivery_cust_tel.value = theform.billing_cust_tel.value;
}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=500');");
}

function cvrt(val)
{
popUp("http://www.ccavenue.com/curConvert_ccav.jsp?mpassAmt="+val );

}

