ns4=(navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? 1 : 0;
ie4=(document.all && !document.getElementById)? 1 : 0;
ie5=(document.getElementById && document.all)? 1 : 0;
ns6=(document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? 1: 0;
w3c=(document.getElementById)? 1 : 0;

var iSelectedItems = 0;
var iSelectedPhones = 0;


wid=(ie4||ie5)?window.document.body.clientWidth-20:window.innerWidth-36

//was top:-5; left:2;
if(ns4){document.write ('<layer name="lim"></layer>')}else{document.write ('<div id="lim" style="position:absolute; top:0; left:0; z-index:100"></div>')}

outd=""

if(w3c)div1=document.getElementById('lim')
if(ie4)div1=document.all['lim']
if(ns4)div1=document.layers['lim']


function move_div(x,y){
	if (isNaN(x+y))return
	//if(ns4){div1.moveTo(x,y)}else{div1.style.left=x+'px';div1.style.top=y+'px';}
}

function write_div(text){
	if(ns4){
		div1.document.open();
		div1.document.write(text);
		div1.document.close();
	}
	else {div1.innerHTML=text;}
}
 
function largeIM(n){
ondiv=n
		write_div("<table cellpadding='0' cellspacing='0' border='0'><tr><td align='left' bgcolor='#000000'><div style='margin-top : 2px; margin-left : 2px; margin-bottom : 2px; '><b class='MediumWhite'>&nbsp;Click image to close</b></div></td></tr><tr><td><a href=javascript:void(0) onmousedown='show(\"ppForm\");largeIM_hide()' onmouseover='ondiv=1'><img border=1 name=ib src="+n+"></a></td></tr></table>");
		move_div(x,y)
}

function largeIM_hide(){
	ondiv=0;
	t3=window.setTimeout('largeIM_hide2()',100)
}

function largeIM_hide2(){
if (ondiv==0){
	write_div("");
	move_div(-1000,-1000)}
}

function thumbIM(n){
ondiv=n

		write_div("<a href=javascript:void(0) onmouseout='thumbIM_hide()' onmouseover='ondiv=1'><img border=0 name=ib src="+n+" width=250 height=250></a>");
		move_div(x,y)
}

function thumbIMfurn(n){
ondiv=n

		write_div("<a href=javascript:void(0) onmouseout='thumbIM_hide()' onmouseover='ondiv=1'><img border=0 name=ib src="+n+" width=198 height=250></a>");
		move_div(x,y)
}
function thumbIM_hide(){
	ondiv=0;
	t3=window.setTimeout('thumbIM_hide2()',100)
}

function thumbIM_hide2(){
if (ondiv==0){
	write_div("");
	move_div(-1000,-1000)}
}



y=x=0


function chgMoreImg(thisSku,imgNum,imgCount){
					var imgNumPre;
					var innerHtml;
					var skuFolder = thisSku.substring(thisSku.length-3,thisSku.length);
					var tdNextPrevElement = document.getElementById("tdNextPrev");
					var ssImageElement = document.getElementById("ssImage");
					
					if(ssImageElement)
					{
						(imgNum < 10) ? imgNumPre = '00' : imgNumPre = '0';
						ssImageElement.src = 'http://ak.buy.com/db_assets/screen_shot_images/' + skuFolder + '/' + thisSku + '_' + imgNumPre + imgNum + '.jpg';	
					}
					if(tdNextPrevElement)
					{
						innerHtml = '<div align="center" style="padding-top:10px;">';
						if(imgNum > 1)
						{
							innerHtml += '<a href="#moreimg" onClick="chgMoreImg(\'' + thisSku + '\',' + (imgNum-1) + ',' + imgCount + ')"><img src="http://ak.buy.com/buy_assets/v6/img/icons/prodimg_previous.gif" border="0"></a>';
						}
						if(imgNum < imgCount)
							innerHtml += '<a href="#moreimg" onClick="chgMoreImg(\'' + thisSku + '\',' + (imgNum+1) + ',' + imgCount + ')"><img src="http://ak.buy.com/buy_assets/v6/img/icons/prodimg_next.gif" border="0"></a>';
					
						innerHtml += '</div>';
						tdNextPrevElement.innerHTML = innerHtml
					}
				}
				
function wPopUp(mURL) {
        var wirelessWindow;
        wirelessWindow = window.open(mURL,"wirelessPopUp","menubar=0,resizable=yes,location=0,scrollbars=yes,toolbar=0,width=390,height=390");
        if ((document.all) || (document.layers)) {
            wirelessWindow.focus()
        }
    }

	
	
	function openImage(page) {
       window.open(page,'_image','width=510,height=540,scrollbars=no')
   	}
   	function open_terms(page) {
	    window.open(page,'termswindow','width=600,height=500,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes');
	    return false;
	}
	function opensShots(sPage) {
	    window.open(sPage,'Menus','width=600,height=600,scrollbars=yes,resizable=yes');
	}

function chgMoreImg(folder,thisSku,imgNum,imgCount){
					var imgNumPre;
					var innerHtml;
					var skuFolder = thisSku.substring(thisSku.length-3,thisSku.length);
					var tdNextPrevElement = document.getElementById("tdNextPrev");
					var ssImageElement = document.getElementById("LargeProductImage");
					
					if(ssImageElement)
					{
						(imgNum < 10) ? imgNumPre = '00' : imgNumPre = '0';
						ssImageElement.src = 'productimages/' + folder + '/' + thisSku;	
					}
					if(tdNextPrevElement)
					{
						innerHtml = '<div align="center" style="padding-top:10px;">';
						if(imgNum > 1)
						{
							innerHtml += '<a href="#moreimg" onClick="chgMoreImg(\'' + thisSku + '\',' + (imgNum-1) + ',' + imgCount + ')"><img src="http://ak.buy.com/buy_assets/v6/img/icons/prodimg_previous.gif" border="0"></a>';
						}
						if(imgNum < imgCount)
							innerHtml += '<a href="#moreimg" onClick="chgMoreImg(\'' + thisSku + '\',' + (imgNum+1) + ',' + imgCount + ')"><img src="http://ak.buy.com/buy_assets/v6/img/icons/prodimg_next.gif" border="0"></a>';
					
						innerHtml += '</div>';
						tdNextPrevElement.innerHTML = innerHtml
					}
				}

			
//function dragIt(evt){if(ie4||ie5){x=window.event.clientX+document.body.scrollLeft; y=window.event.clientY+document.body.scrollTop}else {x=evt.pageX ; y=evt.pageY }}

//document.onmousemove = dragIt
//if(ns4){document.captureEvents( Event.MOUSEMOVE )}
