String.prototype.trim=function(){
return this.replace(/^\s+|\s+$/g,"");
}
Array.prototype.indexOf=function(objFind){
var intIndex;
for(intIndex=0;intIndex<this.length;intIndex++){
if(this[intIndex]==objFind)return intIndex;
}
return -1;
}
function ArrayList(){
this.Count=0;this.Arr=new Array(10);this.ArrIndex=-1;
}
ArrayList.prototype.Add=function(objAdd){
this.ArrIndex++;this.Count++;
if(this.ArrIndex>=this.Arr.length)this.Arr=Array.concat(this.Arr,new Array(10));
this.Arr[this.ArrIndex]=objAdd;return this.ArrIndex;
}
ArrayList.prototype.RemoveAt=function(intIndex){
if(intIndex<0||intIndex>this.ArrIndex)throw "Index out of bounds.";
else{
for(var intInd=intIndex;intInd<this.ArrIndex;intInd++)
this.Arr[intInd]=this.Arr[intInd+1];this.ArrIndex--;this.Count--;
}}
ArrayList.prototype.ToArray=function(){
this.Arr.length=this.Count;return this.Arr;
}
ArrayList.prototype.Item=function(intIndex){
if(intIndex<0||intIndex>this.ArrIndex)throw "Index out of bounds.";
else return this.Arr[intIndex];
}
var sta=new __sta();
function __sta(){
this.namespace="sta";
}
__sta.prototype.createHttpObject=function(){
var objRequest=false;
try{objRequest=new ActiveXObject("Msxml2.XMLHTTP");}
catch(objErr1){
try{objRequest=new ActiveXObject("Microsoft.XMLHTTP");}
catch(objErr2){
try{objRequest=new XMLHttpRequest();}
catch(objErr3){objRequest = false;}
}}
return objRequest;
}
__sta.prototype.createObject=function(objXmlNode){
var objRetVal=new Object(),objQuoteRegEx=new RegExp("\"","g"),objLineBreakRegEx=new RegExp("(\\r|\\n|\\r\\n)","g");
for(var intIndex=0;intIndex<objXmlNode.childNodes.length;intIndex++){
if(objXmlNode.childNodes[intIndex].nodeName!="#text"){
if(objXmlNode.childNodes[intIndex].childNodes.length>0){
if(objXmlNode.childNodes[intIndex].childNodes[0].nodeValue==null){eval("objRetVal."+objXmlNode.childNodes[intIndex].nodeName+"=\"\"");}
else {eval("objRetVal." +  objXmlNode.childNodes[intIndex].nodeName + " = \"" + objXmlNode.childNodes[intIndex].childNodes[0].nodeValue.replace(objQuoteRegEx, "\\\"").replace(objLineBreakRegEx, "") + "\"");}
}else{eval("objRetVal."+objXmlNode.childNodes[intIndex].nodeName+"=null");}
}}
return objRetVal;
}
__sta.prototype.fillCollection=function(objXmlNode){
var objRetVal,intIndex,intArrayIndex,intLength;intLength=0;
for(intIndex=0;intIndex<objXmlNode.childNodes.length;intIndex++)
if(objXmlNode.childNodes[intIndex].nodeName!="#text")intLength++;
objRetVal=new Array(intLength);intArrayIndex=0;
for(intIndex=0;intIndex<objXmlNode.childNodes.length;intIndex++)
if(objXmlNode.childNodes[intIndex].nodeName!="#text")objRetVal[intArrayIndex++]=sta.createObject(objXmlNode.childNodes[intIndex]);
return objRetVal;
}
__sta.prototype.loadXML=function(strMethod,strUrl,strVars,objFunction,objParams){
var objHttpRequest=sta.createHttpObject(),strQueryString,strForm;
objHttpRequest.onreadystatechange=function(){
if(objHttpRequest.readyState==4){
if(objHttpRequest.status==200)objFunction(objHttpRequest.responseXML,objParams);
else objFunction(null,objParams);
}};
if(strMethod!="GET"&&strMethod!="POST")strMethod="GET";
if(strMethod=="GET"){
strForm=null;
if(strVars==null||strVars=="")strQueryString="";
else strQueryString="?"+strVars;
}else{
strQueryString="";
if(strVars==null||strVars=="")strForm=null;
else strForm=strVars;
}
objHttpRequest.open(strMethod,strUrl+strQueryString,true);
if(strMethod=="POST")objHttpRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");
objHttpRequest.send(strForm);
}
__sta.prototype.setVisibility=function(objControl,bolVisible){
if(bolVisible)objControl.style.visibility="visible";
else objControl.style.visibility="hidden";
}
__sta.prototype.setPanelVisibility=function(objPanel,bolVisible){
if(bolVisible){objPanel.style.visibility="visible";objPanel.style.display="inline";}
else{objPanel.style.visibiltiy="hidden";objPanel.style.display="none";}
}
__sta.prototype.formatCurrency=function(dblValue){
var strBefore,strAfter,strSplit,strValue,intIndex,intCount;strValue=new String(new Number(dblValue));
if(strValue.indexOf(".")==-1){strAfter="00";strBefore=strValue;}
else{strSplit=strValue.split(".");strBefore=strSplit[0];strAfter=strSplit[1];}
if(strAfter.length==1)strAfter+="0";
else if(strAfter.length>2)while(strAfter.length>2)strAfter=strAfter.substr(0,strAfter.length-2)+new String(new Number(strAfter.substr(strAfter.length-1,1))>=5&&new Number(strAfter.substr(strAfter.length-2,1))!=9?(new Number(strAfter.substr(strAfter.length-2,1))+1):new Number(strAfter.substr(strAfter.length-2,1)));
if(strBefore.length>3){
strValue="";intCount=-1;
for(intIndex=strBefore.length-1;intIndex>=0;intIndex--){
if(intCount+1>=3)strValue=","+strValue;
strValue=strBefore.substr(intIndex,1)+strValue;
if(++intCount>=3)intCount=0;
}
strBefore=strValue;
}
return "$"+strBefore+"."+strAfter;
}
function getProductName(objProduct){
var strRetVal="";
if(objProduct.BrandName!=null&&objProduct.BrandName!="")strRetVal+=objProduct.BrandName+" ";
if(objProduct.WebName!=null&&objProduct.WebName!="")strRetVal+=objProduct.WebName;
else if(objProduct.StyleName!=null&&objProduct.StyleName!="")strRetVal+=objProduct.StyleName;
else strRetVal+=objProduct.ItemName;
return strRetVal;
}
function getCartProductTotal(objCart){
var dblTotal=0.0;
for(var intIndex=0;intIndex<objCart.length;intIndex++){dblTotal+=getProductUserPrice(objCart[intIndex])*objCart[intIndex].Quantity;}
return dblTotal;
}
function getProductUserPrice(objProduct){
if(new Number(objProduct.BogoPrice)>0)return new Number(objProduct.BogoPrice);
else if(new Number(objProduct.MultipricingPrice)>0)return new Number(objProduct.MultipricingPrice);
else if(new Number(objProduct.SourceCodePrice)>0)return new Number(objProduct.SourceCodePrice);
else return new Number(objProduct.Price);
}
