// JavaScript Document var cal_start_level; var cal_end_level; var cal_min_price; var cal_price_time; var cal_discount; var cal_dec; cal_start_level=1; cal_end_level=85; cal_min_price=11.99; cal_price_time=new Array(); cal_discount=new Array(); cal_dec=new Array(); for(var i=cal_start_level;i<=cal_end_level;i++){ cal_price_time[i]=new Array(); cal_price_time[i][0]=0; cal_price_time[i][1]=0; } cal_price_time[1][0]=1; cal_price_time[2][0]=0.1; cal_price_time[3][0]=0.1; cal_price_time[4][0]=0.15; cal_price_time[5][0]=0.2; cal_price_time[6][0]=0.3; cal_price_time[7][0]=0.3; cal_price_time[8][0]=0.3; cal_price_time[9][0]=0.3; cal_price_time[10][0]=0.3; cal_price_time[11][0]=0.3; cal_price_time[12][0]=0.4; cal_price_time[13][0]=0.4; cal_price_time[14][0]=0.4; cal_price_time[15][0]=0.4; cal_price_time[16][0]=0.4; cal_price_time[17][0]=0.4; cal_price_time[18][0]=0.4; cal_price_time[19][0]=0.4; cal_price_time[20][0]=0.5; cal_price_time[21][0]=0.5; cal_price_time[22][0]=0.5; cal_price_time[23][0]=0.5; cal_price_time[24][0]=0.5; cal_price_time[25][0]=0.5; cal_price_time[26][0]=0.5; cal_price_time[27][0]=0.5; cal_price_time[28][0]=0.5; cal_price_time[29][0]=1.5; cal_price_time[30][0]=1.5; cal_price_time[31][0]=1.5; cal_price_time[32][0]=1.5; cal_price_time[33][0]=1.5; cal_price_time[34][0]=1.5; cal_price_time[35][0]=1.5; cal_price_time[36][0]=1.5; cal_price_time[37][0]=1.8; cal_price_time[38][0]=1.8; cal_price_time[39][0]=1.8; cal_price_time[40][0]=1.8; cal_price_time[41][0]=1.8; cal_price_time[42][0]=1.8; cal_price_time[43][0]=1.8; cal_price_time[44][0]=1.8; cal_price_time[45][0]=3; cal_price_time[46][0]=3; cal_price_time[47][0]=3; cal_price_time[48][0]=3; cal_price_time[49][0]=5; cal_price_time[50][0]=5; cal_price_time[51][0]=5; cal_price_time[52][0]=4.5; cal_price_time[53][0]=4.5; cal_price_time[54][0]=4.5; cal_price_time[55][0]=4.5; cal_price_time[56][0]=4.5; cal_price_time[57][0]=4.5; cal_price_time[58][0]=4.5; cal_price_time[59][0]=4.5; cal_price_time[60][0]=4.5; cal_price_time[61][0]=4.5; cal_price_time[62][0]=5.5; cal_price_time[63][0]=5.5; cal_price_time[64][0]=5.5; cal_price_time[65][0]=5.5; cal_price_time[66][0]=5.5; cal_price_time[67][0]=5.5; cal_price_time[68][0]=5.5; cal_price_time[69][0]=5.5; cal_price_time[70][0]=5.5; cal_price_time[71][0]=5.5; cal_price_time[72][0]=8.85; cal_price_time[73][0]=8.85; cal_price_time[74][0]=8.85; cal_price_time[75][0]=8.85; cal_price_time[76][0]=8.85; cal_price_time[77][0]=8.85; cal_price_time[78][0]=8.85; cal_price_time[79][0]=8.85; cal_price_time[80][0]=8.85; cal_price_time[81][0]=15; cal_price_time[82][0]=15; cal_price_time[83][0]=15; cal_price_time[84][0]=15; cal_price_time[85][0]=15; cal_price_time[1][1]=5; cal_price_time[2][1]=0.1; cal_price_time[3][1]=0.2; cal_price_time[4][1]=0.2; cal_price_time[5][1]=0.3; cal_price_time[6][1]=0.3; cal_price_time[7][1]=0.3; cal_price_time[8][1]=0.3; cal_price_time[9][1]=0.3; cal_price_time[10][1]=0.3; cal_price_time[11][1]=0.5; cal_price_time[12][1]=0.5; cal_price_time[13][1]=0.5; cal_price_time[14][1]=0.5; cal_price_time[15][1]=0.5; cal_price_time[16][1]=0.5; cal_price_time[17][1]=0.5; cal_price_time[18][1]=0.5; cal_price_time[19][1]=0.58; cal_price_time[20][1]=0.58; cal_price_time[21][1]=0.58; cal_price_time[22][1]=0.58; cal_price_time[23][1]=0.58; cal_price_time[24][1]=0.58; cal_price_time[25][1]=0.58; cal_price_time[26][1]=0.58; cal_price_time[27][1]=0.58; cal_price_time[28][1]=0.58; cal_price_time[29][1]=0.58; cal_price_time[30][1]=0.58; cal_price_time[31][1]=0.58; cal_price_time[32][1]=0.58; cal_price_time[33][1]=0.65; cal_price_time[34][1]=0.65; cal_price_time[35][1]=0.65; cal_price_time[36][1]=0.65; cal_price_time[37][1]=0.65; cal_price_time[38][1]=0.65; cal_price_time[39][1]=0.65; cal_price_time[40][1]=3; cal_price_time[41][1]=3; cal_price_time[42][1]=3; cal_price_time[43][1]=3; cal_price_time[44][1]=3; cal_price_time[45][1]=3; cal_price_time[46][1]=3; cal_price_time[47][1]=3; cal_price_time[48][1]=3.5; cal_price_time[49][1]=3.5; cal_price_time[50][1]=3.5; cal_price_time[51][1]=3.5; cal_price_time[52][1]=3.5; cal_price_time[53][1]=3.5; cal_price_time[54][1]=3.5; cal_price_time[55][1]=6.55; cal_price_time[56][1]=6.55; cal_price_time[57][1]=6.55; cal_price_time[58][1]=6.55; cal_price_time[59][1]=6.55; cal_price_time[60][1]=6.55; cal_price_time[61][1]=6.55; cal_price_time[62][1]=6.55; cal_price_time[63][1]=6.55; cal_price_time[64][1]=6.55; cal_price_time[65][1]=6.55; cal_price_time[66][1]=6.55; cal_price_time[67][1]=6.55; cal_price_time[68][1]=5; cal_price_time[69][1]=5; cal_price_time[70][1]=5; cal_price_time[71][1]=3.5; cal_price_time[72][1]=3.5; cal_price_time[73][1]=3.4; cal_price_time[74][1]=3.4; cal_price_time[75][1]=3.4; cal_price_time[76][1]=3.4; cal_price_time[77][1]=5; cal_price_time[78][1]=5; cal_price_time[79][1]=5; cal_price_time[80][1]=5; cal_price_time[81][1]=9; cal_price_time[82][1]=9; cal_price_time[83][1]=9; cal_price_time[84][1]=9; cal_price_time[85][1]=10; cal_discount[0]=new Array(); cal_discount[0][0]=0; cal_discount[0][1]=0.24; cal_discount[1]=new Array(); cal_discount[1][0]=20; cal_discount[1][1]=2.5; cal_discount[2]=new Array(); cal_discount[2][0]=30; cal_discount[2][1]=1.2; cal_discount[3]=new Array(); cal_discount[3][0]=40; cal_discount[3][1]=1.5; cal_discount[4]=new Array(); cal_discount[4][0]=50; cal_discount[4][1]=1; cal_discount[5]=new Array(); cal_discount[5][0]=60; cal_discount[5][1]=1.1; cal_discount[6]=new Array(); cal_discount[6][0]=70; cal_discount[6][1]=0.9; cal_discount[7]=new Array(); cal_discount[7][0]=75; cal_discount[7][1]=1; cal_discount[8]=new Array(); cal_discount[8][0]=80; cal_discount[8][1]=1.2; cal_discount[9]=new Array(); cal_discount[9][0]=85; cal_discount[9][1]=2; cal_dec[0]=new Array(); cal_dec[0][0]=0; cal_dec[0][1]=1; cal_dec[1]=new Array(); cal_dec[1][0]=50; cal_dec[1][1]=99; cal_dec[2]=new Array(); cal_dec[2][0]=70; cal_dec[2][1]=99; cal_dec[3]=new Array(); cal_dec[3][0]=80; cal_dec[3][1]=99; cal_dec[4]=new Array(); cal_dec[4][0]=85; cal_dec[4][1]=99; function cal_get_dec(lvl){ var dec; dec=0; if(cal_dec.length>0){ if(cal_dec[0][1]>0){ for(var i=0;i < cal_dec.length;i++) if(lvl - cal_dec[i][0]<=0){ if(cal_dec[i][0]>0) dec=cal_dec[i][1]; else dec=0; break; } } } return dec; } function cal_level_discount(lvl){ var j; j=1; for(var i=0;i < cal_discount.length;i++) if(lvl - cal_discount[i][0]<=0){ j=cal_discount[i][1]; break; } return j; } function cal_total_discount(){ var td; td=0; if(cal_discount.length>0) td=cal_discount[0][1]; if(td==0) td=1; return td; } function cal_level_price(sl,el){ var price; var dec; if((sl - cal_start_level<0)||(el-cal_end_level>0)){ alert('Your Current Level and Desired Level must be between '+cal_start_level+ ' and ' +cal_end_level + ' .'); return 0; } if(sl-el>=0){ alert('Your Desired Level must be higher than Current Level .'); return 0; } price=0; for(var i=sl*1+1;i - el<=0;i++) price=price+cal_price_time[i][0]*cal_level_discount(i); price=price*cal_total_discount(); if(price - cal_min_price<0) price=cal_min_price; dec=cal_get_dec(el); if(dec > 0) price=Math.floor(price)+dec/100; else price=price.toFixed(2); return price; } function cal_level_time(sl,el){ var timestr; if((sl - cal_start_level<0)||(el-cal_end_level>0)){ alert('Your Current Level and Desired Level must be between '+cal_start_level+ ' and ' +cal_end_level + ' .'); return 0; } if(sl-el>=0){ alert('Your Desired Level must be higher than Current Level .'); return 0; } timestr=0; for(var i=sl*1+1;i <= el;i++) timestr=timestr+cal_price_time[i][1]; timestr=Math.floor(timestr/24); if(timestr==0) timestr=1; return timestr + '-' + (timestr+1) + ' days'; } function cal_level_gold(sl,el){ var g; var t; t=0 g=0; for(var i=sl*1+1;i - el<=0;i++) { if(i-50>0)t=20; if(i-60>0)t=110; if(i-70>0)t=420; g=g+t; } return g+' Gold'; } //--------------------------------------------------------- // user page action //--------------------------------------------------------- document.pl_cal_form.start_level.length=0; document.pl_cal_form.end_level.length=0; for(var i=1;i < cal_end_level;i++) { document.pl_cal_form.start_level.options[document.pl_cal_form.start_level.options.length]=new Option(i,i); } for(var i=cal_end_level;i > cal_start_level;i--) { document.pl_cal_form.end_level.options[document.pl_cal_form.end_level.options.length]=new Option(i,i); } document.pl_cal_form.start_level.options[0].selected=true; document.pl_cal_form.end_level.options[0].selected=true; document.pl_cal_form.price.value='$'+cal_level_price(cal_start_level,cal_end_level).toFixed(2); document.pl_cal_form.total_time.value=cal_level_time(cal_start_level,cal_end_level); document.pl_cal_form.give_gold.value=cal_level_gold(cal_start_level,cal_end_level); function cal_change(){ var sl; var el; sl=document.pl_cal_form.start_level.options[document.pl_cal_form.start_level.selectedIndex].value; el=document.pl_cal_form.end_level.options[document.pl_cal_form.end_level.selectedIndex].value; if((sl - cal_start_level<0)||(el-cal_end_level>0)){ alert('Your Current Level and Desired Level must be between '+cal_start_level+ ' and ' +cal_end_level + ' .'); return false; } if(sl-el>=0){ alert('Your Desired Level must be higher than Current Level .'); return false; } document.pl_cal_form.price.value='$'+cal_level_price(sl,el).toFixed(2); document.pl_cal_form.total_time.value=cal_level_time(sl,el); document.pl_cal_form.give_gold.value=cal_level_gold(sl,el); return true; } var addplsign=0; function show_cp(){ addplsign=1; } function hide_cp(){ addplsign=0; } function show_hide_cp(){ if(addplsign==1){ $('choosepackage').style.display='block'; } else{ $('choosepackage').style.display='none'; } } setInterval('show_hide_cp()',500); function onlynumber(str) { var i,j,s,k,n; s=""; i=str.length; for (j=0;j<=i;j++){ k=str.charCodeAt(j); if ((k==46) || (k>=48 && k<=57)){ s=s+String.fromCharCode(k); } } return s; } function c_package_reset(){ cal_change(); document.pl_cal_form.package.value=''; var cpackage=document.getElementsByName("cpackage"); for(var i=0;i<=cpackage.length-1;i++){ cpackage[i].checked=false; } } c_package_reset(); function c_package(){ var orderno=0; cal_change(); document.pl_cal_form.package.value='' temprice=onlynumber(document.pl_cal_form.price.value)*1; var c=document.getElementsByName("cpackage"); for(var i=0;i<=c.length-1;i++){ if(c[i].checked){ orderno++; document.pl_cal_form.package.value+='('+orderno+')'+' '+c[i].nextSibling.innerHTML+'
'; temprice+=c[i].value*1; document.pl_cal_form.price.value='$'+(temprice*1).toFixed(2); } } var sl; var el; sl=document.pl_cal_form.start_level.options[document.pl_cal_form.start_level.selectedIndex].value; el=document.pl_cal_form.end_level.options[document.pl_cal_form.end_level.selectedIndex].value; if((sl - cal_start_level<0)||(el-cal_end_level>0)){ return false; } if(sl-el>=0){ return false; } }