﻿//document.write('<a href="#" onclick="checkStock();">Buy</a>');

function checkStock()
{
if (document.getElementById('dropItem').options[document.getElementById('dropItem').selectedIndex].value == 'outofstock')
{
alert('This item is out of stock');
}
else if (document.getElementById('dropItem').options[document.getElementById('dropItem').selectedIndex].value == '')
{
alert('Please select an item');
}
else
{
submitPageLoadingCart();
ifrCart.location.replace('/Cart/Action.aspx?Action=Add&ItemId=' + document.getElementById('dropItem').options[document.getElementById('dropItem').selectedIndex].value + '');
}
}

document.write('<iframe id="ifrCart" name="ifrCart" style="width:0px; height:0px; visibility:hidden;"></iframe>');






ie5 = (document.all && document.getElementById);
ns6 = (!document.all && document.getElementById);





function fadeOutCart() {
if(opac2Cart > 0){
opacCart = 0;
opac2Cart-=100;
if(ie5) document.getElementById('divLoadingCart').style.filter = 'alpha(opacity='+opac2Cart+')';
if(ns6) document.getElementById('divLoadingCart').style.MozOpacity = opac2Cart/100;
setTimeout('fadeOutCart()', 0);
}
else {

//cartWin=dhtmlwindow.open('Cartwin', 'iframe', '/Cart/_CartPopUp.html', 'Item Added', 'width=400px,height=125px,left=100px,top=100px,center=0,resize=0,scrolling=0');
//window.location.replace('/Cart/_index.aspx');
//alert('Item Added' + chr(10) + chr(10) + 'To checkout, use the ' + chr(10) + 'checkout button to the left');
if (document.layers)
document.getElementById("divCartLoaded").visibility = 'show';
else
document.getElementById("divCartLoaded").style.visibility = 'visible';


if (document.layers)
document.getElementById("divLoadingCart").visibility = 'hide';
else
document.getElementById("divLoadingCart").style.visibility = 'hidden';

if(ie5) document.getElementById('divLoadingCart').style.filter = 'alpha(opacity='+100+')';
if(ns6) document.getElementById('divLoadingCart').style.MozOpacity = 1;

return true; 
}
}




var goCart=0
var cCart=0
var tCart

function resetCountCart()
{
cCart=0
}

function timedCountCart()
{
cCart=cCart+1
tCart=setTimeout("timedCountCart()",1000)
}

function stopCountCart()
{
if (goCart == 1)
{

opac2Cart = 100;
doneLoadingCart=setTimeout("stopCountCart()",1000)
if (cCart > 1)
{
clearTimeout(tCart);
clearTimeout(doneLoadingCart);
cCart=0;
goCart=0

fadeOutCart();
}
}
}
   

_loadingTimeCart = 0

function submitPageLoadingCart()
{
goCart = 1;
timedCountCart();
if (document.layers)
	document.getElementById("divLoadingCart").visibility = 'show';
else
	document.getElementById("divLoadingCart").style.visibility = 'visible';
return true; 
}


function closeAddedNote()
{
if (document.layers)
	document.getElementById("divCartLoaded").visibility = 'hide';
else
	document.getElementById("divCartLoaded").style.visibility = 'hidden';
return true; 
}