onerror=handleErr

function handleErr(msg,url,l)
{
return true
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return ""
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date()
var user = exdate.getTime()

exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

function checkCookie()
{
var exdate=new Date()
var userID = exdate.getTime()
username=getCookie('userID')
if (username!=null && username!="")
  {userID=username}
else 
  {
    setCookie('userID',userID,30)
  }
}


function linktocart(product,ItemIn,Lang)
{
// used to take customer to order page on Volusion
username=getCookie('userID');
if (sequence==null)
  {sequence='standard'}
if (product==null)
  {product=''}
if (ItemIn==null)
  {ItemIn=''}
if (Lang==null)
  {Lang='EN'}

linkURL='http://www.amoils-store.com/orderpage.asp?ItemIn='+product+'&sequence='+sequence;
// next line added for Google analytics
__utmLinker(linkURL);

//location.href='http://www.amoils-store.com/orderpage.asp?userID='+username+'&product='+product+'&ItemIn='+ItemIn;
}

function buynow(product,popup,sequence)
{
if (popup=='no')
 {
 location.href='http://www.amoils-store.com/orderpage.asp?ItemIn='+product+'&sequence='+sequence; 
 }
else
 {	
 opener.location='http://www.amoils-store.com/orderpage.asp?ItemIn='+product+'&sequence='+sequence;
 self.close();
 }
}


function setSource()
{
// runs show cart on Volusion to get files into cartheights folder
//username=getCookie('userID');
//framesrc = document.getElementByID("cartupdate");
//framesrc.src = 'http://www.amoils-store.com/showcartsm1.asp?userID='+username;
//pause(50);
}


function getHeight()
{
// loads in javascript that sets up iframe to show cart in right column
//parmsrc='http://www.amoils-store.com/cartheights/' + getCookie('userID') + '.js'
//scriptNode = document.createElement('script');
//scriptNode.src = parmsrc;
//scriptNode.type = 'text/javascript';
//document.getElementsByTagName('head')[0].appendChild(scriptNode);
//pause(1000);
}


function pause(numberMillis) 
{
// routine that pauses so iframe of getHeight can load
/* Commented out to stop popup
 var dialogScript = 
     'window.setTimeout(' +
     ' function () { window.close(); }, ' + numberMillis + ');';
     var result = 
*/
// For IE5.
/* Commented out to stop popup
      window.showModalDialog(
      'javascript:document.writeln(' +
      '"<script>' + dialogScript + '<' + '/script>")');

// For NN6, but it requires a trusted script.
/* Commented out to stop popup
      openDialog(
      'javascript:document.writeln(' +
      '"<script>' + dialogScript + '<' + '/script>"',
      'pauseDialog', 'modal=1,width=10,height=10');
*/
}

// Support to show cart in right column
function moveframe(URL)
{
//frames['cartframe'].location.href=URL+"#bottom";
}
function moveup(URL)
{
//frames['cartframe'].location.href=URL;
}
//username=getCookie('userID');
//frameURL="http://www.amoils-store.com/cartheights/"+username+".htm";
