// JavaScript Document
divX = 0
divY = 0
function findShimmyPosition(){   
    var c = getAnchorPosition('shimmy');
	divX = c.x;
    divY = c.y;
}

function hidethis(){
    Obj = getElmByIdq("divtrans")
    Obj.style.visibility="hidden"
    Obj.style.width="100%"
	for(xy=1;xy<=(arrIDS.length-1); xy = xy + 1){
		document.getElementById('sl'+arrIDS[xy]).style.visibility='visible';
	}
}

function getElmByIdq(aID)    { 
        var element = null; 
        element = document.getElementById(aID) 
		//alert("aID");
        return element; 
    }    
    
function moreproductinfo(ct,id){
	for(xy=1;xy<=(arrIDS.length-1); xy = xy + 1){
		document.getElementById('sl'+arrIDS[xy]).style.visibility='hidden';
	}
 
	document.getElementById('thebody').style.overflow='hidden'; 
    //findShimmyPosition()
    Obj = getElmByIdq("divtrans")
	//alert(Obj.style.visibility);
    Obj.style.left = divX;
    Obj.style.top = divY;
    Obj.style.visibility="visible"
    obj1 = getElmByIdq("spanTypeName")
    obj2 = getElmByIdq("spanPic")
    obj3 = getElmByIdq("spanPricing")
    obj4 = getElmByIdq("spanTypeDesc")
    obj5 = getElmByIdq("spanBuyLink")
    obj6 = getElmByIdq("spanQty")
	obj7 = getElmByIdq("spancopperwarning")
    
    obj1.innerHTML = arrHeaders[ct];
    obj2.innerHTML = "<img src='" + arrPic[ct] + "'  />";
	//obj3.innerHTML = arMPrice[ct][1] ;
	arrPriceStr = arMPrice[ct][1];
	//bug: come back and fix!!!
    arrPriceStr = arrPriceStr.replace(/\;/g,"<br>");
	/*
    arrPriceStr = arrPriceStr.replace("£0.00","£ unavailable");
    arrPriceStr = arrPriceStr.replace("$0.00","$ unavailable");
    arrPriceStr = arrPriceStr.replace("€0.00","€ unavailable");
    arrPriceStr = arrPriceStr.replace("&euro;","€ unavailable");
    arrPriceStr = arrPriceStr.replace("&pound;","£ unavailable");
	*/
    obj3.innerHTML = arrPriceStr;
	//arrQtyStr = arQty[ct];
   // obj3.innerHTML = arrQtyStr.replace(/\;/g,"<br>");
	//alert(arrPriceStr);
    //obj3.innerHTML = arPrice[id];
    obj4.innerHTML = arrContent[ct];
   // obj6.innerHTML = arQty[ct];
   	var arrQtyStr = arQty[ct];
	arrQty = arrQtyStr.split(";");
	if((arrQty.length-1) == 0){		
		obj6.innerHTML = "<select class='slqty' onchange='doreloadprices(\""+ct+"\",\""+id+"\")' id='sl"+id+"-2' name='sl"+id+"-2'><option value='0'> - Qty - </option><option value='1' selected>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option></select>";
	}else{
		for(xx=0;xx<=(arrQty.length-1); xx = xx + 1){	
			if(xx == 0){
				arrQtyStr = arrQtyStr + "<option value='" + arrQty[xx] + "' selected>" + arrQty[xx] + "</option>";
			}else{
				arrQtyStr = arrQtyStr + "<option value='" + arrQty[xx] + "'>" + arrQty[xx] + "</option>";
			}
		}
		//arrQtyStr = arrQty.length;
		//obj6.innerHTML = "<select class='slqty'><option value='0'>"+arrQtyStr+"</option></select>";
		obj6.innerHTML = "<select class='slqty' onchange='doreloadprices(\""+ct+"\",\""+id+"\")'  id='sl"+id+"-2' name='sl"+id+"-2'><option value='0'> - Qty - </option>"+arrQtyStr+"</select>";
	}
	//alert(arPrice[ct]);
    //obj5.innerHTML = "<a HREF='buynow.php' onclick='AddToCart(\""+id+"\",\""+arPrice[ct]+"\",\"large\",\""+arrHeaders[ct]+"\");'>add to cart</a>";
    obj5.innerHTML = "<table width='53' border=0 height='23' cellspacing=0 cellpadding=0><tr><td align=center width=53 ><a  HREF='buynow.php' onclick='AddToCart(\""+ct+"\",\""+id+"\",\""+arMPrice[ct][1]+"\",\"large\",\""+arrHeaders[ct]+"\",\"-2\");'><strong>BUY</strong></a></td></tr></table>";
	
	if(arrHeaders[ct] == "MyCopper"){
		obj7.innerHTML = "Only available in South Africa.";		
		}else{
		obj7.innerHTML = "";	
		}
	
	
	//"'"+ct+"',\""+id+"\",\""+arPrice[ct]+"\",\"large\",\""+arrHeaders[ct]+"\");'<table width='53' border=0 height='23' cellspacing=0 cellpadding=0><tr><td align=center width=53 style='background-position:center;background-repeat:repeat-x;background-image:url(../images/addbuy.jpg);'><a  HREF='buynow.php' onclick='AddToCart(\""+ct+"\",\""+id+"\",\""+arMPrice[ct][1]+"\",\"large\",\""+arrHeaders[ct]+"\");'><strong>BUY</strong></a></td></tr></table>";
    //obj5.innerHTML = "<table width='53' border=1 cellspacing=0 cellpadding=0><tr><td align=center width=53 style='background-position:center;background-repeat:repeat-x;background-image:url(../images/addbuy.jpg);'><a  HREF='buynow.php' onclick='AddToCart(\"1\",\"fdsfds\","large",\"GOLD\");'><strong>BUY</strong></a></td></tr></table>";
    //obj5.innerHTML = "<a HREF='' onclick='AddToCart();'>buy</a>";
    /*
	*/
}


function moreinfo(picname){
	document.getElementById('thebody').style.overflow='hidden'; 
    //findShimmyPosition()
    Obj = getElmByIdq("divtrans")
	//alert(Obj.style.visibility);
    Obj.style.left = divX;
    Obj.style.top = divY;
    Obj.style.visibility="visible"
    obj2 = getElmByIdq("spanPic")    
    obj2.innerHTML = "<img src='../UploadsImages/" + picname + "' style='border:1px solid #000000' />";
}
function moreinfobackend(picname){
	document.getElementById('thebody').style.overflow='hidden'; 
    //findShimmyPosition()
    Obj = getElmByIdq("divtrans")
	//alert(Obj.style.visibility);
    Obj.style.left = divX;
    Obj.style.top = divY;
    Obj.style.visibility="visible"
    obj2 = getElmByIdq("spanPic")    
    obj2.innerHTML = "<img src='../" + picname + "' style='border:1px solid #000000' />";
}
function moreflashinfo(linkname){
	document.getElementById('thebody').style.overflow='hidden'; 
    //findShimmyPosition()
    Obj = getElmByIdq("divtrans")
	//alert(Obj.style.visibility);
    Obj.style.left = divX;
    Obj.style.top = divY;
    Obj.style.visibility="visible"
    obj2 = getElmByIdq("spanPic")    
	obj2.innerHTML = "<object width=\"425\" height=\"344\"><param name=\"movie\" value=\"" + linkname + "\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"" + linkname + "\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"425\" height=\"344\"></embed></object>"
    //obj2.innerHTML = "<img src='../" + linkname + "' style='border:1px solid #000000' />";
}