﻿// JScript 

 var navigate = "";
	 if(navigator.userAgent.toLowerCase().indexOf("firefox") > 0)
	        navigate = "firefox";
	 else if(navigator.userAgent.toLowerCase().indexOf("msie") > 0)
	        navigate = "msie";
	        
	 String.prototype.Trim = function() 
     { 
       return this.replace(/(^\s*)|(\s*$)/g, ""); 
     } 
	        
	function addShoppingCart(guid, gameservercode, objLink)
	{
	   var lblPrice;
	   var name = objLink.previousSibling.previousSibling.value;
//	   if(navigate == "firefox")
//	      lblPrice = objLink.previousSibling.previousSibling.name;
	   //	   else lblPrice = objLink.parentNode.previousSibling.previousSibling.firstChild;
	   lblPrice = objLink.parentNode.parentNode.getElementsByTagName("td")[2].firstChild;
	   var objSelect = objLink.parentNode.parentNode.getElementsByTagName("td")[3].getElementsByTagName("select")[0];
	   //var objSelect = objLink.parentNode.previousSibling.firstChild;
	   var strPrice = "";
	   if(navigate == "firefox") strPrice = objLink.previousSibling.previousSibling.name;
	   else strPrice = lblPrice.nodeValue;
	   var length = strPrice.length;
	   var price = strPrice.substring(1, length);
	   if (price.indexOf('$')>0) {
	       price = price.replace("$","");
	    }
	   if(objSelect != null)
	     name += "(" + objSelect.value + ")";
	   window.parent.location.href = "order/ShopCart.aspx?"+guid+"&"+name+"&"+price+"&1&"+gameservercode+"&&6";
	 //alert("order/ShopCart.aspx?" + guid + "&" + name + "&" + price + "&1&" + gameservercode + "&&6");
	}
	function updateprice2(obj) {
	    lblPrice = obj.parentNode.parentNode.getElementsByTagName("td")[2].firstChild;
	    lblPrice.nodeValue = "$" + (11.59 + (obj.value - 1) * 3);
	 }
	function updatePrice(price, objSelect)
	{
	    var minLevel = objSelect.options[0].value;
	    var currentLevel = objSelect.value;
	    var currentPrice = (price / minLevel) * currentLevel;
	    var lblPrice;
//	    switch(navigate)
//	    {
//	        case "firefox": 
//	        lblPrice = objSelect.parentNode.previousSibling.previousSibling;
//	        break;
//	        default:
//	        lblPrice = objSelect.parentNode.previousSibling.firstChild;
//	    }
	    lblPrice = objSelect.parentNode.parentNode.getElementsByTagName("td")[2].firstChild;
	    var dotIndex = currentPrice.toString().indexOf(".");
	    var strPrice = "";
	     if(dotIndex > 0)
           strPrice =  "$" + currentPrice.toString().substring(0,dotIndex + 3);
	    else strPrice = "$" + currentPrice.toString();
	     if(navigate == "firefox"){	        
	          var oHidden = objSelect.parentNode.nextSibling.nextSibling.childNodes[1];
	          lblPrice.nodeValue = strPrice;
	          oHidden.name = strPrice;
	        }
	     else {lblPrice.nodeValue = strPrice;}
	}
/*---------------------------------------------------------------------*/  
     
     
                            var m_Arr = new Array();
                                   m_Arr[0] ="dragon";
                                         m_Arr[1] ="3rd";
                                         m_Arr[2] ="godsword";
                                         m_Arr[3] ="set";
                                         m_Arr[4] ="shield";
                                         m_Arr[5] ="plate";
                                         m_Arr[6] ="partyhat";
                                         m_Arr[7] ="pumpkin";
                                
                                 
                               


