var a = new Array();function init_store(drop_set_id, drop_set_container_class, drop_set_interior_class) {
if($('nav1')) {
var expand_set = $('nav1').childNodes[0];
for(var x in expand_set.childNodes) {
if(expand_set.childNodes[x].className == 'nav_listing nav1') {
expand_set.childNodes[x].onmouseover = function() {
for(var x in this.childNodes) {
if(this.childNodes[x].className=='d_1_container') {
this.childNodes[x].style.display = 'block';
this.childNodes[x].style.position = 'absolute';
this.childNodes[x].style.top = Top(this)+parseInt(this.offsetHeight)+'px';
this.childNodes[x].style.left = Left(this);
}
}
}
expand_set.childNodes[x].onmouseout = function() {
for(var x in this.childNodes) {
if(this.childNodes[x].className=='d_1_container') this.childNodes[x].style.display = 'none';
}
}
}
}
}
}
landing_action = 'cart.add';
click_action = 'details';
function Cart() {
this.Cart=Cart;
this.add=add;
this.remove=remove;
this.initialize_lz=initialize_lz;
var remote = false;
var num_items = 0;
var num_pieces = 0;
var subtotal = 0;
if(!$('cart_content')) {
$('cart').innerHTML = '

';
}
var html = $('cart_contents');
var summary = $('cart_summary');
var inCart = Array();
function Cart() { // setup landing zone and landing_action
if(!remote) {
remote = new rsi();
}
for(var x in a) {
var item = a[x];
add(false,item,x,item['Params_UI']);
}
initialize_lz();
}Cart();
function initialize_lz() {
lz_top = parseInt(Top($('cart')));
lz_bottom = lz_top + parseInt($('cart').offsetHeight);
lz_left = parseInt(Left($('cart')));
lz_right = lz_left + parseInt($('cart').offsetWidth);
}
function add(id,ary,key, goto_cart) {
if(id) {
var item = items[id];
var qty = $(id+'|qty') ? parseFloat($(id+'|qty').value) : parseFloat($('qty').value);
if(goto_cart) {
var https = "";
document.location=https+'?cart=1&act=add&id='+id+'&q='+qty+'&1='+($(id+'|Sizes') ? $(id+'|Sizes').value:'')+'&sid=2623775a933bd58dda2e54ec9b76fb31';
return;
}
var price = parseFloat(item['$']);
var name = item['n'];
var img = item['i'][1] ? item['i'][1] : item['i'][2];
remote.send('components/cart.php', {act:'add',id:id,q:qty,1:($(id+'|Sizes') ? $(id+'|Sizes').value : '')});
var addl = $(id+'|Sizes') ? $(id+'|Sizes').options[$(id+'|Sizes').selectedIndex].text+'
' : ''
} else {
var item = ary;
id = item['Item_ID'];
var qty = parseFloat(item['Qty']);
var price = parseFloat(item['Price']);
var name = item['Name'];
var img = item['i'];
var addl = '';
for(var x in item['Params_UI']) {
addl +=item['Params_UI'][x]+'
';
}
}
subtotal = parseFloat(subtotal) + price.toFixed(2)*qty;
num_pieces += qty;
var e = document.createElement('div');
e.className = "";
e.id = "|"+num_items;
var node = ''
+''
+''
+' '
+' | '
+''+name
+' '+addl
+'Price: $'+price+' Qty: '+qty
+' | '
+'
';//+html.innerHTML;
e.innerHTML = node;
if(html.childNodes[0])
html.insertBefore(e, html.childNodes[0]);
else html.appendChild(e);
summary.innerHTML = (num_pieces)
+' items.
Subtotal: $'+subtotal+'
'
+'';
inCart[num_items] = Array();
inCart[num_items]['id'] = id;
inCart[num_items]['price'] = price;
inCart[num_items]['qty'] = qty;
num_items++;
initialize_lz(); // re-initialize landing zone
}
function remove(num) {
remote.send('components/cart.php', {act:'remove',key:num});
$('cart|'+num).style.height = '0px';
$('cart|'+num).style.borderColor = 'transparent';
$('cart|'+num).style.borderWidth = '0px';
$('cart|'+num).style.display = 'none';
$('cart|'+num).id = 'trash';
$('|'+num).id = 'trash';
//html.removeChild($('|'+num));
subtotal -= inCart[num]['price']*inCart[num]['qty'];
num_pieces -= inCart[num]['qty'];
summary.innerHTML = (num_pieces)
+' items.
Subtotal: $'+subtotal+'
'
+'';
num++;
var tmp;
while(tmp = $('cart|'+num)) {
tmp.id = 'cart|'+(num-1);
num++;
}
num_items--;
}
}
function view(item, override_vc) {
var vc = $(((override_vc!=undefined) && override_vc) ? override_vc : 'viewer_container');
if(item && (item != undefined)) {
if(!vc) {
var tmp_div = document.createElement('div');
tmp_div.setAttribute('id','viewer_container');
vc = document.body.appendChild(tmp_div);
}
vc.innerHTML = "";
vc.style.display='block';
vc.style.width='100%';
vc.style.height=$('main_container').offsetHeight+180+'px';
/*
vc.style.backgroundColor='#000';
vc.style.opacity='.8';
*/
$('viewer').style.marginTop=110 + getScrollY()+'px';
$('viewer_close').style.marginTop=115 + getScrollY()+'px';
$('viewer').innerHTML=''
+''+items[item]['s']+'
'+'price: $'+items[item]['$']+'
'
+' '+getImages(item)+'
';
+'';
} else {
vc.style.display='none';
vc.style.width='0px';
vc.style.height='0px';
$('viewer').innerHTML='';
}
}
function details(id) {
var url_parts = document.URL.split('?',2);
var params = url_parts[1].split('&');
var new_params = '';
for(var z in params) if(params[z].substring(0,params[z].indexOf('='))!='iid') new_params += params[z]+'&';
url_parts[0] = window['SSL_LOCATION'] ? window['SSL_LOCATION'] : url_parts[0];
window.location.href=url_parts[0]+'?'+'iid='+id+'&'+new_params;
}
function getImages(item) {
var out = '';
var k = 1;
for(var x in items[item]['i']) {
if(items[item]['i'][x] != '')
out += ""+(k)+"";
else break;
k++;
}
return out;
}
function showImage(src) {
$("image_viewer").src='';
$("image_viewer").src=src.replace('.t.jpg','.f.jpg');
}
function checkout() {
//window.location='/goto/store/Checkout.php';
window.location='?checkout=1&sid=2623775a933bd58dda2e54ec9b76fb31';
}
function Ship_Calc(id) {
if(id == undefined) id = '';
if(!$('Address_Zip').value) {
alert('Please enter more information before calculating the shipping costs.');
return;
}
var params = ''//'Address_Country_Code='+$('Address_Country_Code').value+'&'
+'Address_Zip='+$('Address_Zip').value+'&Address_State='+$('Address_State').value+'&'
+'Address_City='+$('Address_City').value+'&'
+'Address_Line_1='+$('Address_Line_1').value+'&'
+'Address_Line_2='+$('Address_Line_2').value;
openWin('components/tools/Shipping_Rates.php?meth='+id+'&'+params, 300, 350);
}
function loadAddress(id) {
remote = new rsi();
remote.send('/components/tools/load.php?t=Address&id='+id);
}