closetime = 5; // Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds


function Start99(URL, WIDTH, HEIGHT) {
	windowprops = "left=150,top=150,width=" + WIDTH + ",height=" + HEIGHT;
	preview = window.open(URL, "preview", windowprops);
	if (closetime) setTimeout("preview.close();", closetime*1000);
}


function doPopup99() {
	url = "tshirt.html";
	width = 200;  // width of window in pixels
	height = 300; // height of window in pixels
	delay = 0;    // time in seconds before popup opens
	timer = setTimeout("Start99(url, width, height)", delay*1000);
}


function DropDownMenu(entered) {
	document.forms[0].submit();
}


function getCookie ()  {
	cookie = document.cookie;
	tag = "perm_cookie_id=";       // Cookie identifier
	tlen = tag.length;    // Length of cookie identifier
	index = 0;            // Begin loop at 0
	foundCookie = false;  // Processing Flag
	while (index < cookie.length)  {  // Loop through cookie to find tag
	       if (cookie.substring(index, index+tlen) == tag)  {
	              foundCookie = true;
	              index = index + tlen;
	              cookie = cookie.substring(index,cookie.length);
	              return true;
	              break;
	       }
	       index = index+1
	}
	if (foundCookie == false)  {
		return false;
	}
} // end getCookie


function setCookie ()
{
var cookieName = "perm_cookie_id";  // Set PD cookie identifier
var expDate = new Date();  // Date variable for expiration date
var cookieValue = ((expDate.getTime()))+"."+(parseInt(Math.random() * 100000000)); // Set cookie value - numeric
expDate.setTime (expDate.getTime() + 946080000000);  // Set cookie expiration date for 30 years

document.cookie = cookieName + "=" + escape (cookieValue) + "; expires=" + expDate.toGMTString() + "; domain=.performancedepot.com" + "; path=/"   // Set the actual cookie

}// end setCookie

evalCookie = getCookie();  // Check to see if stated cookie exists - return true or false

if (evalCookie == false)  {  // Only set cookie of cookie does not currently exist
	setCookie();
}

ver = 2
if(navigator.userAgent.indexOf("a/3",6) != -1) {
ver = 3
top1 = new Image(91,44); top1.src = "ART/btn_brands2.gif";
top1b = new Image(91,44); top1b.src = "ART/bth_brands2.gif";
top2 = new Image(91,44); top2.src = "ART/btn_powerkits2.gif";
top2b = new Image(91,44); top2b.src = "ART/bth_powerkits2.gif";
top3 = new Image(91,44); top3.src = "ART/btn_categories.gif";
top3b = new Image(91,44); top3b.src = "ART/bth_categories.gif";
top4 = new Image(91,44); top4.src = "ART/btn_home2.gif";
top4b = new Image(91,44); top4b.src = "ART/bth_home2.gif";

} else if ( navigator.userAgent.indexOf( "a/4", 6 ) != -1 ) {
ver = 4
top1 = new Image(91,44); top1.src = "ART/btn_brands2.gif";
top1b = new Image(91,44); top1b.src = "ART/bth_brands2.gif";
top2 = new Image(91,44); top2.src = "ART/btn_powerkits2.gif";
top2b = new Image(91,44); top2b.src = "ART/bth_powerkits2.gif";
top3 = new Image(91,44); top3.src = "ART/btn_categories.gif";
top3b = new Image(91,44); top3b.src = "ART/bth_categories.gif";
top4 = new Image(91,44); top4.src = "ART/btn_home2.gif";
top4b = new Image(91,44); top4b.src = "ART/bth_home2.gif";

} else if ( navigator.userAgent.indexOf( "a/5", 6 ) != -1 ) {
ver = 5 }

function ImgFunc(imgDocID,imgObjName) {
if(ver >= 3) {
document.images[imgDocID].src = eval(imgObjName + ".src");}
}


