try{
String.prototype.Contains=function(str){return this.indexOf(str)!=-1;}
String.prototype.ToCSSSafeName=function(){return this.replace(/[^_a-zA-Z0-9-]/g,'-');}
String.prototype.StartsWith=function(str){return this.match('^'+str)==str;}
String.prototype.EndsWith=function(str){return this.match(str+'$')==str;}
String.prototype.LTrim=function(chrs){chrs=chrs||' ';return this.replace(new RegExp('^['+chrs+']+','g'),'');}
String.prototype.RTrim=function(chrs){chrs=chrs||' ';return this.replace(new RegExp('['+chrs+']+$','g'),'');}
String.prototype.Trim=function(chrs){chrs=chrs||' ';return this.LTrim(chrs).RTrim(chrs);}
String.prototype.IsNumeric=function(){return this==parseInt(this);}
String.prototype.Repeat=function(num){return new Array(num+1).join(this);}
String.prototype.Pad=function(chr,length){var newStr=this;if(newStr.length<length){newStr=chr.Repeat(length-newStr.length)+newStr;}
return newStr;}
String.prototype.StripComments=function(Open,Close){var str=this;if(Open===undefined)Open='/*';if(Close===undefined)Close='/*';var commentStartPos=str.indexOf(Open);while(commentStartPos>=0){var commentEndPos=str.indexOf(Close,commentStartPos+2)+2;str=str.substr(0,commentStartPos)+str.substr(commentEndPos);if(commentStartPos+2<str.length)commentStartPos=str.indexOf(Open,commentStartPos+2);else commentStartPos=-1;}
return str;}
String.prototype.SubStrCount=function(needle,offset,length){var haystack=this;var pos=0;var count=0;haystack+='';needle+='';if(isNaN(offset)){offset=0;}
if(isNaN(length)){length=0;}
offset--;while((offset=haystack.indexOf(needle,offset+1))!=-1){if(length>0&&(offset+needle.length)>length)return false;else count++;}
return count;}
String.prototype.URLEncodeCharacter=function(){return'%'+this.charCodeAt(0).toString(16);}
String.prototype.URLDecodeCharacter=function(){return String.fromCharCode(parseInt(this,16));}
String.prototype.URLEncode=function(){return encodeURIComponent(this).replace(/\%20/g,'+').replace(/[!'()*~]/g,URLEncodeCharacter);}
String.prototype.URLDecode=function(){return decodeURIComponent(this.replace(/\+/g,'%20')).replace(/\%([0-9a-f]{2})/g,URLDecodeCharacter);}}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}try{
var hideShadeTimeout;function makeShade(shadeID){var shade=document.createElement('div');shade.setAttribute('id',shadeID+'Shd');shade.setAttribute('class','Shade');document.body.appendChild(shade);}
function showShade(shadeID,zIndex){if(typeof zIndex=='undefined')zIndex=false;if(!document.getElementById(shadeID+'Shd'))makeShade(shadeID);if(document.getElementById(shadeID+'Shd')){clearTimeout(hideShadeTimeout);if(zIndex)document.getElementById(shadeID+'Shd').style.zIndex=zIndex;document.getElementById(shadeID+'Shd').style.visibility='visible';document.getElementById(shadeID+'Shd').style.opacity='.35';}}
function hideShade(shadeID){if(!document.getElementById(shadeID+'Shd'))makeShade(shadeID);if(document.getElementById(shadeID+'Shd')){document.getElementById(shadeID+'Shd').style.opacity='0';clearTimeout(hideShadeTimeout);hideShadeTimeout=setTimeout(function(){document.getElementById(shadeID+'Shd').style.visibility='hidden';},400);}}
function sendDialogResponse(dialogWinName,responseMethodName,cancel){var responseArrayString='';var dialogWin=document.getElementById(dialogWinName);dialogWin.style.visibility='hidden';if(!cancel){for(var i=0;i<dialogWin.children.length;i++){var kid=dialogWin.children[i];if(kid.nodeName.toUpperCase()=='INPUT'||kid.nodeName.toUpperCase()=='TEXTAREA'){var id=kid.id;var value=kid.value;responseArrayString+=id+':"'+value+'",';}}}
dialogWin.style.opacity='0';var transformProperty=GetTransformProperty(dialogWin);if(cancel){if(transformProperty)dialogWin.style[transformProperty]='rotate(-15deg) scale(.2)';dialogWin.style.marginLeft='-450px';}
else{if(transformProperty)dialogWin.style[transformProperty]='rotate(16deg) scale(.2)';dialogWin.style.marginLeft='65px';}
setTimeout(function(){dialogWin.parentNode.removeChild(dialogWin);},700);if(typeof CurrentAppID!='undefined'){try{hideShade(CurrentAppID);}
catch(x){}}
if(!cancel){if(responseArrayString)responseArrayString='{'+responseArrayString.substring(0,responseArrayString.length-1)+'}';else responseArrayString=true;try{eval('try{'+responseMethodName+'('+responseArrayString+');}catch(x){}');}
catch(x){}}
else{try{eval('try{'+responseMethodName+'(false);}catch(x){}');}
catch(x){}}}
function ForceCloseDialog(ID,Animate,HideShade){if(typeof Animate=='undefined')Animate=true;if(typeof HideShade=='undefined')HideShade=true;var dialogWin=document.getElementById(ID);if(Animate){dialogWin.style.opacity='0';var transformProperty=GetTransformProperty(dialogWin);if(transformProperty)dialogWin.style[transformProperty]='rotate(-15deg) scale(.2)';dialogWin.style.marginLeft='-450px';dialogWin.style.mozBoxShadow='2px 0 5px Black';dialogWin.style.webkitBoxShadow='2px 0 5px Black';dialogWin.style.boxShadow='2px 0 5px Black';setTimeout(function(){dialogWin.parentNode.removeChild(dialogWin);},700);}
else dialogWin.parentNode.removeChild(dialogWin);if(HideShade)hideShade(CurrentAppID);}
function ShowDialog(HTML,ResponseMethodName,Width,Height,OK,ParentIDName,FocusID,Modal,OKDisabled,Top,Animate){var focusID=typeof FocusID!='undefined'?FocusID:'';if(typeof CurrentAppID=='undefined')CurrentAppID='';if(typeof UniqueResID=='undefined'){ShowDialog.UniqueResID=0;var dialogID='u'+ShowDialog.UniqueResID;}
else{UniqueResID++;var dialogID='u'+UniqueResID;}
if(typeof Top=='undefined')Top=110;if(typeof Animate=='undefined')Animate=true;try{if(Modal!=false)showShade(CurrentAppID);}
catch(x){CurrentAppID=null;ParentIDName=null;Modal=false;}
if(OKDisabled===true)OKDisabled='disabled=disabled';else OKDisabled='';if(OK===true)OK='OK';var buttonsHTML='<div id="btns">';var cancelText='Cancel';if(OK!=false)buttonsHTML+='<input id=\''+dialogID+'-k\' class="Button" type="button" value="'+OK+'" '+OKDisabled+' onclick="sendDialogResponse(\''+dialogID+'\', \''+ResponseMethodName+'\');">';else cancelText='Close';buttonsHTML+='<input id=\''+dialogID+'-c\' class="Button" type="button" value="'+cancelText+'" onclick="sendDialogResponse(\''+dialogID+'\', \''+ResponseMethodName+'\', true);"></div>';var idealLeft=Math.ceil(Width/2)-4;var dlg=document.createElement('div');dlg.setAttribute('id',dialogID);dlg.setAttribute('class','Dialog');dlg.setAttribute('style','width:'+(Width-20)+'px;height:'+(Height-20)+'px;left:50%;top:'+Top+'px;margin-left:-'+(idealLeft+140)+'px;');dlg.innerHTML=HTML+buttonsHTML;if(ParentIDName)document.getElementById(ParentIDName).appendChild(dlg);else{if(document.getElementById('p-'+CurrentAppID))document.getElementById('p-'+CurrentAppID).appendChild(dlg);else document.body.appendChild(dlg);}
if(Animate){setTimeout(function(){dlg.style.opacity='1';var transformProperty=GetTransformProperty(dlg);if(transformProperty)dlg.style[transformProperty]='rotate(0) scale(1)';dlg.style.marginLeft='-'+idealLeft+'px';},10);setTimeout(function(){dlg.style.mozBoxShadow='2px 6px 40px Black';dlg.style.webkitBoxShadow='2px 6px 40px Black';dlg.style.boxShadow='2px 6px 40px Black';},80);}
else{var transitionProperty=GetTransitionProperty(dlg);if(transitionProperty)dlg.style[transitionProperty]='none';dlg.style.opacity='1';var transformProperty=GetTransformProperty(dlg);if(transformProperty)dlg.style[transformProperty]='rotate(0) scale(1)';dlg.style.marginLeft='-'+idealLeft+'px';dlg.style.mozBoxShadow='2px 6px 40px Black';dlg.style.webkitBoxShadow='2px 6px 40px Black';dlg.style.boxShadow='2px 6px 40px Black';if(transitionProperty)dlg.style[transitionProperty]='all .2s ease-out';}
if(ParentIDName){var keyListener=function(e){var keyPressed=(e&&e.which)?e.which:event.keyCode;var ESC_KEY=27;var ENTER_KEY=13;if(keyPressed==ESC_KEY){document.getElementById(ParentIDName).RemoveEvent('onkeydown',keyListener,false);if(ResponseMethodName)sendDialogResponse(dialogID,ResponseMethodName,true);else ForceCloseDialog(dialogID);return false;}
else if(keyPressed==ENTER_KEY){document.getElementById(ParentIDName).RemoveEvent('onkeydown',keyListener,false);if(ResponseMethodName)sendDialogResponse(dialogID,ResponseMethodName);return false;}}
document.getElementById(ParentIDName).AddEvent('onkeydown',keyListener);}
if(focusID)setTimeout("document.getElementById('"+focusID+"').focus();",1);else{if(OK!=false)setTimeout("document.getElementById('"+dialogID+"-k').focus();",1);else setTimeout("document.getElementById('"+dialogID+"-c').focus();",1);}
return dialogID;}
var loaderDialogID=null;function SendWinHashChange(){if(window.location.hash=='#c'){setTimeout(function(){if(document.getElementById('GavaIFrame'))document.getElementById('GavaIFrame').parentNode.removeChild(document.getElementById('GavaIFrame'));},440);window.location.hash='';hideShade('');}}
function showContactIFrame(){document.getElementById('GavaIFrame').style.display='block';ForceCloseDialog(loaderDialogID,false,false);document.getElementById('GavaIFrame').focus();}
function Contact(){var width=680;var height=500;var idealLeft=Math.ceil(width/2);loaderDialogID=ShowDialog('<b style="color:#3E3E3E;font-family:\'lucida grande\',tahoma,verdana,arial,sans-serif;font-size:15px">Send Message</b><br><center style="cursor:wait;"><img src="https://gavamedia.com/w.gif" style="position:absolute;left:184px;top:130px;"><img src="https://gavamedia.com/gavalogin.jpg" style="opacity:.4;margin:15px 0 0;"></center>','',400,310,'Send',null,'',false,true,143);showShade('',1001);var loginSrc='https://gavamedia.com';if(window.location.hostname=='192.168.0.169')loginSrc='http://192.168.0.169';var dlg=document.createElement('iframe');dlg.setAttribute('id','GavaIFrame');dlg.setAttribute('style','text-align:left;display:none;border:none;width:'+width+'px;height:'+height+'px;left:50%;margin-left:-'+idealLeft+'px;position:fixed;top:110px;z-index:9000; ');dlg.onload=showContactIFrame;dlg.src=loginSrc+'/_a?r=sm&u='+encodeURI(document.URL);document.body.appendChild(dlg);if('onhashchange'in window)window.onhashchange=SendWinHashChange;else{window.onload=function(){setInterval(function(){if(CurentPageHash!=window.location.hash.substring(1))SendWinHashChange();},400);}}}}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}try{
if(XMLHttpRequest===undefined){XMLHttpRequest=function(){try{return new ActiveXObject('Msxml2.XMLHTTP.6.0');}catch(e){}
try{return new ActiveXObject('Msxml2.XMLHTTP.3.0');}catch(e){}
try{return new ActiveXObject('Msxml2.XMLHTTP');}catch(e){}
try{return new ActiveXObject('Microsoft.XMLHTTP');}catch(e){}
window.location='http://www.getfirefox.com/';};}
function loginRequiredResponseBackup(){location.reload(true);}
function Call(FunctionID,Parameters,ReturnFunction){var ajx=new XMLHttpRequest();var params='r='+FunctionID;if(Parameters)params+='&'+Parameters;params+='&u='+Math.random();ajx.open('POST','/_a',true);ajx.setRequestHeader('Content-type','application/x-www-form-urlencoded');ajx.setRequestHeader('Content-length',params.length);ajx.setRequestHeader('Connection','close');ajx.onreadystatechange=function(){if(ajx.readyState==4){if(ajx.status==401){if(typeof window.LoginRequired=='function')LoginRequired();else{ShowDialog('<h2>Login Required</h2><br>Please login to continue.','loginRequiredResponseBackup',330,145,false);}}
else if(ajx.status==403){ShowDialog('<h2>Access Denied</h2><br>You do not have permission to perform this action.',null,330,145,false);setTimeout(function(){ReturnFunction(ajx);},400);}
else ReturnFunction(ajx);}}
ajx.send(params);}}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}try{
var DocumentWidth=Math.max(document.body.offsetWidth,document.documentElement.clientWidth,document.documentElement.offsetWidth);var DocumentHeight=Math.max(document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.offsetHeight);window.onresize=function(e){setTimeout(function(){DocumentWidth=Math.max(document.body.offsetWidth,document.documentElement.clientWidth,document.documentElement.offsetWidth);DocumentHeight=Math.max(document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.offsetHeight);},10);}
function GetTransformProperty(element){var properties=['transform','WebkitTransform','MozTransform','msTransform','OTransform'];var p;while(p=properties.shift()){if(typeof element.style[p]!='undefined')return p;}
return false;}
function GetTransitionProperty(element){var properties=['transition','MozTransition','WebkitTransition','OTransition'];var p;while(p=properties.shift()){if(typeof element.style[p]!='undefined')return p;}
return false;}}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}try{
String.prototype.SecureFromXXS=function(){var securedString=this;for(var i=0;i<arguments.length;i++)securedString=securedString.replace(new RegExp(arguments[i],'g'),arguments[i].replace(/"/g,'~'));securedString=securedString.replace(/"(\\.|[^"\\])*"/g,'');securedString=securedString.replace(/~/g,'"');return securedString;}
var Base64={_keyStr:"AB"+"CDEFGHIJKLMNOP"+"QRSTUVWXYZabcdefghijkl"+"mnopqrstuvwxyz0123456789+/=",Encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=Base64._utf8_encode(input);while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
output=output+
this._keyStr.charAt(enc1)+this._keyStr.charAt(enc2)+
this._keyStr.charAt(enc3)+this._keyStr.charAt(enc4);}
return output;},Decode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<input.length){enc1=this._keyStr.indexOf(input.charAt(i++));enc2=this._keyStr.indexOf(input.charAt(i++));enc3=this._keyStr.indexOf(input.charAt(i++));enc4=this._keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}
if(enc4!=64){output=output+String.fromCharCode(chr3);}}
output=Base64._utf8_decode(output);return output;},_utf8_encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}
else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}
else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
return utftext;},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}
else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}
else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;}}}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}try{
var KEY_ENTER=13;var KEY_ESC=27;var KEY_DELETE=46;var KEY_SPACE=32;var KEY_UP=38;var KEY_DOWN=40;var KEY_LEFT=37;var KEY_RIGHT=39;function AllowNumOnly(keyCode){if((keyCode>=48&&keyCode<=57)||(keyCode>=37&&keyCode<=40)||(keyCode==8||keyCode==9||keyCode==46))return true;else return false;}}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}try{
function SetCookie(CookieName,CookieValue,nDays){var expire=new Date();expire.setTime(expire.getTime()+3600000*24*nDays);document.cookie=CookieName+'='+escape(CookieValue)+';expires='+expire.toGMTString()+';path=/;domain=.metalmud.com';}
function GetCookie(CookieName){var a_all_cookies=document.cookie.split(';');var a_temp_cookie='';var cookie_name='';var cookie_value='';var b_cookie_found=false;for(i=0;i<a_all_cookies.length;i++){a_temp_cookie=a_all_cookies[i].split('=');cookie_name=a_temp_cookie[0].replace(/^\s+|\s+$/g,'');if(cookie_name==CookieName){b_cookie_found=true;if(a_temp_cookie.length>1){cookie_value=unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g,''));}
return cookie_value;break;}
a_temp_cookie=null;cookie_name='';}
if(!b_cookie_found)return null;}
function DeleteCookie(CookieName){SetCookie(CookieName,'',-3600);}}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}try{
var getShippingFeePause=null;var shipFeeBoxAppearancePause=null;function ShippingFeeResponse(e){var costBox=document.getElementById('sc');var subtotal=0;var shipping=0;if(e.responseText.indexOf('|')!=-1){subtotal=e.responseText.substring(0,e.responseText.indexOf('|'));shipping=e.responseText.substring(e.responseText.indexOf('|')+1);}
if(shipping!=0){if(shipping!=-1){document.getElementById('amount').value=subtotal;document.getElementById('shipping').value=shipping;costBox.innerHTML='Shipping cost: $'+shipping;costBox.style.color='#222273';costBox.style.textShadow='1px 0 12px #81A1D3';costBox.style.background='#F5F5FA';costBox.style.borderBottom='1px dashed #DADAE0';costBox.style.borderTop='1px dashed #DADAE0';}
else{document.getElementById('s').disabled='disabled';document.getElementById('Address').disabled='disabled';costBox.innerHTML='<b>YOU HAVE TOO MANY ITEMS IN YOUR CART TO SHIP.</b> Please remove some items from your cart.';}
clearTimeout(shipFeeBoxAppearancePause);shipFeeBoxAppearancePause=setTimeout("document.getElementById('sc').style.textShadow = 'none';document.getElementById('sc').style.color = 'black';",400);}
else{document.getElementById('amount').value=0;document.getElementById('shipping').value=0;costBox.innerHTML='<i>Shipping calculated when you enter your address</i>';costBox.style.color='#6F6F71';costBox.style.background='#F7F7FB';costBox.style.borderBottom='1px dashed #E9E9EC';costBox.style.borderTop='1px dashed #E9E9EC';}}
function GetShippingFee(){var province=document.Address.Province.value;var country=document.Address.Country.value;clearTimeout(getShippingFeePause);getShippingFeePause=setTimeout("Call('sf', 'p="+encodeURIComponent(province)+"&cn="+encodeURIComponent(country)+"', ShippingFeeResponse)",250);}
function ShippingAddressResponse(e){if(e.responseText=='k'&&document.getElementById('shipping').value!=0){document.getElementById('s').style.cursor='wait';document.body.style.cursor='wait';document.getElementById('s').disabled='disabled';document.getElementById('ppaddress1').value=document.getElementById('AddressLine1').value;document.getElementById('ppaddress2').value=document.getElementById('AddressLine2').value;document.getElementById('ppcity').value=document.getElementById('City').value;document.getElementById('ppstate').value=document.getElementById('Province').value;document.getElementById('ppzip').value=document.getElementById('PostalCode').value;document.getElementById('ppphone').value=document.getElementById('PhoneNumber').value;document.forms['pp'].submit();}
else if(e.responseText=='000'){alert('Nothing in cart.');window.location='/store/cart/';}
else alert('Problem with address.');}
var validShippingAddress=false;function invalidShippingAddress(errorNum){validShippingAddress=false;document.getElementById('e').innerHTML='Please fill in all fields';switch(errorNum){case 0:document.Address.FullName.style.backgroundColor='#FFB0B0';document.Address.FullName.focus();document.Address.FullName.select();break;case 1:document.Address.AddressLine1.style.backgroundColor='#FFB0B0';document.Address.AddressLine1.focus();document.Address.AddressLine1.select();break;case 2:document.Address.City.style.backgroundColor='#FFB0B0';document.Address.City.focus();document.Address.City.select();break;case 3:document.Address.Province.style.backgroundColor='#FFB0B0';document.Address.Country.style.backgroundColor='#FFB0B0';document.Address.Province.focus();document.getElementById('e').innerHTML='Check your province/state/region';break;case 4:document.Address.PostalCode.style.backgroundColor='#FFB0B0';document.Address.PostalCode.focus();document.Address.PostalCode.select();document.getElementById('e').innerHTML='Check your postal/zip code';break;case 5:document.Address.PhoneNumber.style.backgroundColor='#FFB0B0';document.Address.PhoneNumber.focus();document.Address.PhoneNumber.select();break;}
setTimeout("document.Address.FullName.style.backgroundColor='white';document.Address.AddressLine1.style.backgroundColor='white';document.Address.City.style.backgroundColor='white';document.Address.Province.style.backgroundColor='white';document.Address.Country.style.backgroundColor='white';document.Address.PostalCode.style.backgroundColor='white';document.Address.PhoneNumber.style.backgroundColor='white';document.Address.s.disabled = false;",1600);setTimeout('document.getElementById("e").innerHTML="";',4500);}
function isValidPhoneNumber(number){isValid=false;number=number.replace(/#/g,'');number=number.replace(/[0-9]/g,'#');if(number.SubStrCount('#')>=10)isValid=true;return isValid;}
function isValidPostalCode(checkCode,checkCountry){var isValid=false;if(checkCountry.toUpperCase()!='CANADA'){var zipCodePattern=/^\d{5}$|^\d{5}-\d{4}$/;if(zipCodePattern.test(checkCode))isValid=true;}
else{var postalCodePattern=/[a-zA-Z][0-9][a-zA-Z](-| |)[0-9][a-zA-Z][0-9]/;if(postalCodePattern.test(checkCode)&&checkCode.replace(/ /g,'').replace(/-/,'').length==6)isValid=true;}
return isValid;}
function isValidProvince(checkProvince,checkCountry){var isValid=false;if(checkCountry.toUpperCase()=='CANADA'){if(checkProvince=='ON'||checkProvince=='QC'||checkProvince=='NS'||checkProvince=='NB'||checkProvince=='MB'||checkProvince=='BC'||checkProvince=='PE'||checkProvince=='SK'||checkProvince=='AB'||checkProvince=='NL'||checkProvince=='NT'||checkProvince=='YT'||checkProvince=='NU')isValid=true;}
else{if(checkProvince=='AK'||checkProvince=='AL'||checkProvince=='AR'||checkProvince=='AZ'||checkProvince=='CA'||checkProvince=='CO'||checkProvince=='CT'||checkProvince=='DE'||checkProvince=='FL'||checkProvince=='GA'||checkProvince=='HI'||checkProvince=='IA'||checkProvince=='ID'||checkProvince=='IL'||checkProvince=='IN'||checkProvince=='KS'||checkProvince=='KY'||checkProvince=='LA'||checkProvince=='MA'||checkProvince=='MD'||checkProvince=='ME'||checkProvince=='MI'||checkProvince=='MN'||checkProvince=='MO'||checkProvince=='MS'||checkProvince=='MT'||checkProvince=='NC'||checkProvince=='ND'||checkProvince=='NE'||checkProvince=='NH'||checkProvince=='NJ'||checkProvince=='NM'||checkProvince=='NV'||checkProvince=='NY'||checkProvince=='OH'||checkProvince=='OK'||checkProvince=='OR'||checkProvince=='PA'||checkProvince=='RI'||checkProvince=='SC'||checkProvince=='SD'||checkProvince=='TN'||checkProvince=='TX'||checkProvince=='UT'||checkProvince=='VA'||checkProvince=='VT'||checkProvince=='WA'||checkProvince=='WI'||checkProvince=='WV'||checkProvince=='WY'||checkProvince=='DC'||checkProvince=='PR'||checkProvince=='AS')isValid=true;}
return isValid;}
function SubmitShippingAddress(){var fullName=document.Address.FullName.value;var addressLine1=document.Address.AddressLine1.value;var addressLine2=document.Address.AddressLine2.value;var city=document.Address.City.value;var province=document.Address.Province.value;var postalCode=document.Address.PostalCode.value;var country=document.Address.Country.value;var phoneNumber=document.Address.PhoneNumber.value;validShippingAddress=true;if(!isValidPhoneNumber(phoneNumber))invalidShippingAddress(5);if(!isValidPostalCode(postalCode,country))invalidShippingAddress(4);if(!isValidProvince(province,country))invalidShippingAddress(3);if(city.length<3)invalidShippingAddress(2);if(addressLine1.length<7)invalidShippingAddress(1);if(fullName.length<5||fullName.Trim().indexOf(' ')==-1)invalidShippingAddress(0);if(validShippingAddress){Call('sa','n='+encodeURIComponent(fullName)+'&a1='+encodeURIComponent(addressLine1)+'&a2='+encodeURIComponent(addressLine2)+'&c='+encodeURIComponent(city)+'&p='+encodeURIComponent(province)+'&pc='+encodeURIComponent(postalCode)+'&cn='+encodeURIComponent(country)+'&pn='+encodeURIComponent(phoneNumber),ShippingAddressResponse);}}
function AddToCart(id,qty){var cartItems=GetCookie('c');var newCart=id+'x'+qty;if(cartItems){cartItems=cartItems.split(';');for(var i=0;i<cartItems.length;i++){if(!cartItems[i].StartsWith(id+'x'))newCart+=';'+cartItems[i];}}
SetCookie('c',newCart,30);window.location='/store/cart/';}
function UpdateSubtotal(){var subtotal=0;var cart=GetCookie('c');if(cart&&document.getElementById('subtotal')){cart=cart.split(';');for(var i in cart){if(cart[i].indexOf('x')>0){var itemID=cart[i].split('x');itemID=itemID[0];var itemPic=document.getElementById('pic'+itemID);var nameBox=document.getElementById('n'+itemID);var priceBox=document.getElementById('p'+itemID);var qtyBox=document.getElementById('q'+itemID);var cadCurrency=true;var price=0;if(cadCurrency)price=parseFloat(priceBox.attributes.getNamedItem('cad').nodeValue);else price=parseFloat(priceBox.attributes.getNamedItem('usd').nodeValue);var qty=parseInt(qtyBox.value);var lacksDiscipline=false;if(isNaN(qty)){qty=0;if(qtyBox.value!=''){qtyBox.value=0;lacksDiscipline=true;}}
if(qty==0){nameBox.style.textDecoration='line-through';priceBox.style.textDecoration='line-through';itemPic.style.opacity='.4';nameBox.style.opacity='.5';priceBox.style.opacity='.5';itemPic.style.filter='alpha(opacity=40)';}
else{nameBox.style.textDecoration='none';priceBox.style.textDecoration='none';itemPic.style.opacity='1';nameBox.style.opacity='1';priceBox.style.opacity='1';itemPic.style.filter='alpha(opacity=100)';}
subtotal+=price*qty;if(lacksDiscipline)alert('Arnold says: "STAAWP IT! You lack discipline!"');}}
document.getElementById('subtotal').innerHTML=subtotal.toFixed(2);}}
function RemoveItem(id){var cart=GetCookie('c');if(cart){var newItemCount=0;var newCart='';cart=cart.split(';');for(var i in cart){if(cart[i].indexOf('x')>0){var itemArray=cart[i].split('x');var itemID=itemArray[0];var quantity=parseInt(document.getElementById('q'+itemID).value);if(itemID!=id&&quantity>0){newItemCount+=quantity;newCart+=itemID+'x'+quantity+';';}}}
newCart=newCart.substr(0,newCart.length-1);SetCookie('c',newCart,30);if(id){var item=document.getElementById(id);item.innerHTML='';item.style.height='55px';item.style.backgroundColor='transparent';item.style.backgroundImage='url(aniadd.gif)';setTimeout('document.getElementById('+id+').style.height = "45px";',100);setTimeout('document.getElementById('+id+').style.height = "35px";',150);setTimeout('document.getElementById('+id+').style.height = "25px";',200);setTimeout('document.getElementById('+id+').style.height = "15px";',250);setTimeout('document.getElementById('+id+').parentNode.removeChild(document.getElementById('+id+'));',350);}
if(newItemCount==0){var checkoutButton=document.getElementById('chk');if(checkoutButton)checkoutButton.parentNode.removeChild(checkoutButton);}}
UpdateSubtotal();}
function SaveCart(){if(document.getElementById('csub')){var cart=GetCookie('c');if(cart){cart=cart.split(';');for(var i in cart){if(cart[i].indexOf('x')>0){var itemID=cart[i].split('x');itemID=itemID[0];if(document.getElementById('q'+itemID).value<1)RemoveItem(itemID);}}
RemoveItem();}}}
if(window.addEventListener)window.addEventListener('beforeunload',SaveCart,false);else if(window.attachEvent)window.attachEvent('onbeforeunload',SaveCart);}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}try{
var isInvalidLogin=false;function LogOut(){DeleteCookie('Key');DeleteCookie('SessID');DeleteCookie('p');window.location.reload(true);}
function loginRequiredResponse(){location.reload(true);}
function LoginRequired(){isInvalidLogin=true;document.getElementById('s').style.opacity=.4;document.getElementById('maEditor').innerHTML='';ShowDialog('<h2>Login Required</h2><br>Please login to continue.','loginRequiredResponse',330,145,false);}
function invalidLogin(){document.lf.ls.disabled=false;document.lf.gp.value='';document.lf.gl.focus();document.lf.gl.select();document.lf.gp.style.backgroundColor='#FFB0B0';document.lf.gl.style.backgroundColor='#FFB0B0';setTimeout('document.lf.gp.style.backgroundColor="";document.lf.gl.style.backgroundColor="";',700);}
function LoginResponse(e){if(e.responseText=='k'){window.location.reload(true);}
else{document.body.style.cursor='default';invalidLogin();}}
function Login(){var login='';var password='';var persist=false;if(document.lf){document.lf.ls.disabled=true;login=document.lf.gl.value;password=document.lf.gp.value;if(document.lf.per)persist=document.lf.per.checked;}
else if(document.lfm){document.lfm.ls.disabled=true;login=document.lfm.gl.value;password=document.lfm.gp.value;if(document.lfm.per)persist=document.lfm.per.checked;}
if(login.length<3||password.length<3){invalidLogin();return;}
document.body.style.cursor='wait';var base64Credentials=Base64.Encode(login+':'+password);Call('_a','r=l&c='+encodeURIComponent(base64Credentials)+'&per='+persist,LoginResponse);}
function SignUpResponse(response){if(response.responseText=='k'){setTimeout("document.body.style.cursor = 'wait';",1);document.sf.style.backgroundImage="url('aniadd.gif')";document.sf.style.opacity='0.6';if(document.sf.EmailCheck)setTimeout('window.location.reload(true);',600);else setTimeout('window.location = "_a?r=sm";',600);document.getElementById('e').style.color='#366C98';document.getElementById('e').innerHTML='Welcome!';}
else invalidSignUp(parseInt(response.responseText));}
var validSignUp=true;function invalidSignUp(errorNum){validSignUp=false;document.getElementById('e').innerHTML='Please fill in all fields';switch(errorNum){case 0:document.sf.FirstName.style.backgroundColor='#FFB0B0';document.sf.FirstName.focus();document.sf.FirstName.select();break;case 1:document.sf.LastName.style.backgroundColor='#FFB0B0';document.sf.LastName.focus();document.sf.LastName.select();break;case 2:document.sf.Email.style.backgroundColor='#FFB0B0';if(document.sf.EmailCheck)document.sf.EmailCheck.style.backgroundColor='#FFB0B0';document.sf.Email.focus();document.sf.Email.select();document.getElementById('e').innerHTML='Check your e-mail address';break;case 3:document.sf.Password.style.backgroundColor='#FFB0B0';document.sf.Password.focus();document.sf.Password.select();document.getElementById('e').innerHTML='Password must be at least 6 characters';break;case 4:document.sf.Gender.style.backgroundColor='#FFB0B0';document.sf.Gender.focus();break;case 5:document.sf.M.style.backgroundColor='#FFB0B0';document.sf.M.focus();break;case 6:document.sf.D.style.backgroundColor='#FFB0B0';document.sf.D.focus();break;case 7:document.sf.Y.style.backgroundColor='#FFB0B0';document.sf.Y.focus();break;case 8:document.sf.M.style.backgroundColor='#FFB0B0';document.sf.D.style.backgroundColor='#FFB0B0';document.sf.Y.style.backgroundColor='#FFB0B0';document.sf.M.focus();document.getElementById('e').innerHTML='Check your birthday';break;case 9:document.sf.M.style.backgroundColor='#FFB0B0';document.sf.D.style.backgroundColor='#FFB0B0';document.sf.Y.style.backgroundColor='#FFB0B0';document.sf.M.focus();document.getElementById('e').innerHTML='Must be at least 13';break;}
setTimeout('document.sf.FirstName.style.backgroundColor="white";document.sf.LastName.style.backgroundColor="white";document.sf.Email.style.backgroundColor="white";if(document.sf.EmailCheck)document.sf.EmailCheck.style.backgroundColor="white";document.sf.Password.style.backgroundColor="white";document.sf.Gender.style.backgroundColor="white";document.sf.M.style.backgroundColor="white";document.sf.D.style.backgroundColor="white";document.sf.Y.style.backgroundColor="white";document.sf.ss.disabled = false;',1600);setTimeout('document.getElementById("e").innerHTML="";',4500);}
function SignUp(){document.sf.ss.disabled=true;var firstName='';var lastName='';var email='';var emailCheck='';var password='';var gender='';var bdMonth='';var bdDay='';var bdYear='';if(document.sf){firstName=document.sf.FirstName.value;lastName=document.sf.LastName.value;email=document.sf.Email.value;if(document.sf.EmailCheck)emailCheck=document.sf.EmailCheck.value;password=document.sf.Password.value;gender=document.sf.Gender.value;bdMonth=document.sf.M.value;bdDay=document.sf.D.value;bdYear=document.sf.Y.value;}
validSignUp=true;var reg=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;if((bdMonth==2&&bdDay>28)||(bdMonth==4&&bdDay>30)||(bdMonth==6&&bdDay>30)||(bdMonth==9&&bdDay>30)||(bdMonth==11&&bdDay>30))invalidSignUp(8);if(bdYear.length>4)invalidSignUp(7);if(bdDay.length>2)invalidSignUp(6);if(bdMonth.length>2)invalidSignUp(5);if(gender.length>2)invalidSignUp(4);if(password.length<6)invalidSignUp(3);if(email.length<5||!reg.test(email))invalidSignUp(2);if(document.sf.EmailCheck)if(email!=emailCheck)invalidSignUp(2);if(lastName.length<2)invalidSignUp(1);if(firstName.length<2)invalidSignUp(0);if(validSignUp){var noEmailCheckParam='';if(!document.sf.EmailCheck)noEmailCheckParam='&skip=t';Call('ac','fn='+encodeURIComponent(firstName)+'&ln='+encodeURIComponent(lastName)+'&e='+encodeURIComponent(email)+'&ec='+encodeURIComponent(emailCheck)+'&p='+encodeURIComponent(password)+'&g='+encodeURIComponent(gender)+'&bm='+encodeURIComponent(bdMonth)+'&bd='+encodeURIComponent(bdDay)+'&by='+encodeURIComponent(bdYear)+noEmailCheckParam,SignUpResponse);}}}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}try{
function removeZoomPic(e){var button=1;if(e.which)button=e.which;else button=event.button;if(button==1){var picBox=(e.srcElement)?e.srcElement:this;if(document.body.addEventListener)document.body.removeChild(document.getElementById('shadow'));document.body.removeChild(picBox);}}
function zoom(picURL){if(document.body.addEventListener){var shadow=document.createElement('div');shadow.id='shadow';document.body.appendChild(shadow);}
var newPic=document.createElement('img');newPic.id='pic';newPic.src=picURL;newPic.className='zoom';document.body.appendChild(newPic);setTimeout("document.getElementById('pic').style.zIndex = 999;",90);if(newPic.addEventListener)newPic.addEventListener('mousedown',removeZoomPic,false);else if(newPic.attachEvent)newPic.attachEvent('onmousedown',removeZoomPic);}
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('8 q(j){Y j.o(0,j.X-4)+"W.V"}8 U(f,i){6.7(i).c.T="S(\'"+q(f).R("Q://P.","O://p.N.M/p/")+"\')";6.7(\'L\'+i).3=f.o(f.K("/")+1)}8 J(5,n){b(!n){I()}6.H.c.G=\'F\'}8 E(5){6.7("l"+5).c.e="m";b(6.7("d"+5).3=="")6.7("d"+5).3="a 9";6.7("d"+5).c.e="m"}8 D(5){6.7("l"+5).c.e="k";C h=6.7("d"+5).3;b(h==""||h=="a 9")6.7("d"+5).c.e="k"}8 B(2){2.g="A";b(2.3==""||2.3=="a 9"){2.3="a 9"}}8 z(2){b(2.3==""||2.3=="a 9")2.g="y";x 2.g="w"}8 v(2){u{b(2.3=="a 9")2.3="";2.t()}s(r){}}',61,61,'||textArea|value||PhotoNum|document|getElementById|function|Caption|Add|if|style|Text|visibility|FileURL|className|caption|SubmitID|fileName|hidden|iframe|visible|Failed|substr|secure|getThumbName|ex|catch|focus|try|ClickTextArea|EditableTextArea|else|BlankTextArea|MouseOutTextArea|HoveredTextArea|MouseOverTextArea|var|MouseOutPhoto|MouseOverPhoto|default|cursor|body|CloseDialog|RestoreUI|lastIndexOf|PhotoSrc|com|gavamedia|https|www|http|replace|url|backgroundImage|UploadComplete|jpg|_thumb|length|return'.split('|'),0,{}));var _gaq=_gaq||[];_gaq.push(['_setAccount','UA-4801766-3']);_gaq.push(['_trackPageview']);(function(){var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;ga.src=('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);})();}catch(ex){if (typeof arguments != 'undefined') alert(arguments.callee.toString() + ': ' + ex.description);}
