function atf(){if (document.all){window.external.addFavorite('http://www.cheaplastchaos.com/','cheaplastchaos.com - Provide with cheapest last chaos gold');}
else if (window.sidebar){window.sidebar.addPanel('cheaplastchaos.com - Provide with cheapest last chaos gold and power leveling services', 'http://www.cheaplastchaos.com', "");}}
function chklogin(){with (document.getElementById('loginform')){
if (email.value == '' || !email.value.match(/^[\w\.\-]+@([\w\-]+\.)+[a-z]{2,4}$/ig)){
alert('Please input your email !');email.focus();return false;}
if (password.value == ''){alert('Please input your password !');password.focus();return false;}}}
function buy(id){var cur_id=document.getElementById("selcurrency").value;var oform = document.getElementById("listform");oform.cid.value = cur_id;oform.pid.value=id;oform.submit();}
function roundAmount(n){var s=""+Math.round(n*100)/100;var i=s.indexOf('.');if (i<0){return s+".00"}var t=s.substring(0,i+1)+s.substring(i+1,i+3);if(i+2==s.length) {t+= "0"}return t;}
function setcurrency(selobj){
var p=document.getElementById("tbl_product");
var exr,rc=p.rows.length;
var cid = selobj.value;
if (cid==1){ccode='USD';exr=1;}if (cid==2){ccode='EUR';exr=rateEur;}if (cid==3){ccode='GBP';exr=rateGbp;}
for(var i=1;i<rc;i++){var prc=arrPrice[i-1];prc=prc*exr;prc=roundAmount(prc);p.rows[i].cells[1].innerHTML=prc+'  '+ccode;}}
var arrPrice = new Array();
function direct (selobj){var dirpage = selobj.value;window.location=dirpage;}
function addLoadEvent(func){var oldonload = window.onload;if (typeof window.onload != 'function'){window.onload = func} else {window.onload = function(){oldonload();func();}}}
function prepdt(){
var p = document.getElementById("tbl_product");
if (p==null){return}
var rc = p.rows.length;
for(i=1;i<rc;i++){var priceUSD = parseFloat(p.rows[i].cells[1].innerHTML);priceUSD=roundAmount(priceUSD);arrPrice.push(priceUSD);}
setcurrency(document.getElementById("selcurrency"));}
function $(id) {return document.getElementById(id)}
function appendToSelect(select, value, content) {var opt=document.createElement('option');opt.value=value;opt.text=content;select.options.add(opt);}
addLoadEvent(prepdt);