function array(total) {
	this.length = total;
	for (var count = 1; count <= total; count++) {
		this[count] = new Image();
	}
	return this;
}

function swap(img,gfx) {
	document.images[img].src = preload[gfx].src;
}

function popupImage(imageURL) {
	window.open("/larger-image.html?"+imageURL,"","resizable=1,height=750,width=496");
} 

function popupWindow(url,width,height) {
	window.open(url,"","resizable=1,height="+height+",width="+width);
}

function upDate() {
qty="0"; sub="0.00";
querystring=parent.document.URL.substring(document.URL.indexOf('?')+1);
if (querystring.charAt(0)!="q"){querystring="";}
if (querystring){
today=new Date();
millisecs_in_half_hour=1800000;
expireDate = new Date(today.getTime() + millisecs_in_half_hour);
document.cookie=querystring+"&exp="+expireDate+";path=/;expires="+expireDate.toGMTString();
}else{
if (document.cookie !=""){
thisCookie=document.cookie.split("; ");
for (i=0; i<thisCookie.length; i++) {
if (thisCookie[i].split("=")[0]=="qty"){
querystring=thisCookie[i];
expireDate=thisCookie[i].split("exp=")[1];
}}}}
if (querystring){
querystring=querystring.split("&");
qty=querystring[0].split("=")[1]; if (qty==""){qty="0";}qty=parseInt(qty);
sub=querystring[1].split("=")[1]; if (sub==""){sub="0.00";}
}
update=document.write("Items in cart: "+qty+"&nbsp;&nbsp;&nbsp;&nbsp;Subtotal: "+sub+"");
return update;
}

// AddThis.com Variables //
addthis_offset_top = -164;
addthis_offset_left = -114;
addthis_pub = 'sexylingerieuk';
addthis_brand = 'Amandas Lingerie';
addthis_logo = 'http://www.sexy-lingerie.uk.com/images/popupheader.jpg';
addthis_options = 'favorites, digg, delicious, google, myspace, facebook, stumbleupon, reddit, live, more';


var el="wrapper";
var bgimg=new Array("/images/header-background1.jpg", "/images/header-background2.jpg");
var random=Math.round((bgimg.length-1)*Math.random());
var cssStr="#"+el+" { background: url("+bgimg[random]+") no-repeat top left } ";
var style=document.createElement("style");
style.setAttribute("type","text/css");
if(style.styleSheet){style.styleSheet.cssText=cssStr;
} else {var cssText=document.createTextNode(cssStr);
style.appendChild(cssText);
}
document.getElementsByTagName("head")[0].appendChild(style);

