function bhw() 
{
var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
   myWidth = document.body.clientWidth;
   myHeight = document.body.clientHeight;
  }
var h = window.pageYOffset ||
document.body.scrollTop ||
document.documentElement.scrollTop;

var intElemScrollHeight = document.getElementsByTagName("body")[0].scrollHeight;
var totalheight= intElemScrollHeight+20;

var imagedivheight=myHeight-93;
var bwidth= myWidth;

document.getElementById('tableheight').style.height=myHeight+'px';
document.getElementById('tableheight').style.width=bwidth+'px';
document.getElementById('divheight').style.height=h+'px';
document.getElementById('message2').style.height=totalheight+'px';
document.getElementById('divscroll').style.height="500px";
document.getElementById('divscroll').style.width="504px";
document.getElementById('blwtbl').style.height="500px";


if (myHeight <= 578)
{
document.getElementById('divscroll').style.height=imagedivheight+'px';
document.getElementById('divscroll').style.width="522px";
document.getElementById('blwtbl').style.height=imagedivheight+'px';
}
}

function blowup_show()
{
document.body.style.overflow = "hidden";
document.getElementsByTagName("html")[0].style.overflow = "hidden";
document.getElementById('message2').style.display="block";
bhw();
}


function blowup_off()
{
document.body.style.overflow = "";
document.getElementById('message2').style.display="none";
document.getElementsByTagName("html")[0].style.overflow = "";
}


var path = '';
var imgid = "0";

function imageset(id)
{


	if(id == dataref.length)
	{
		document.getElementById('next').style.display='none';
		document.getElementById('pre').style.display='block';
	}



	
	else if(id == 1)
	{
		document.getElementById('pre').style.display='none';
		document.getElementById('next').style.display='block';
	}
	else
	{
		document.getElementById('pre').style.display='block';
		document.getElementById('next').style.display='block';
	}
	
	set_big_img_path(id);
	
	imgid = id;

	var pic = document.getElementById(imgid);
	productName =pic.alt;
	productName = unescape(productName);
	if(productName.length > 40)
        {
		var c = productName.substring(0,40);
		c = c + "...";
		productName = c;
        }
	document.getElementById('imagediv').innerHTML='<img src="'+path+'" onload="loadimg()">'; 
	document.getElementById('prname').innerHTML=productName;


if(dataref.length==1)
	{
		document.getElementById('table_nxt').style.display='none';
	}


}

function nextimg()
{
	if(imgid < dataref.length)
	{
	imgid++;
	}

	if(imgid < dataref.length)
	{
		var newImg = imgid;
		document.getElementById('next').style.display='block';
		document.getElementById('pre').style.display='block';	
	}
	else
	{
		var newImg = imgid;
		document.getElementById('next').style.display='none';
		document.getElementById('pre').style.display='block';
	}
	
	set_big_img_path(newImg);
	
	bhw();
	
	if (document.getElementById(newImg))
	{
		var pic = document.getElementById(newImg);
		productName =pic.alt;
		productName = unescape(productName);
		if(productName.length > 40)
        	{
			var c = productName.substring(0,40);
			c = c + "...";
			productName = c;
        	}
		document.getElementById('imagediv').innerHTML='<img src="'+path+'" onload="loadimg()">'; 
		document.getElementById('prname').innerHTML=productName;
	}
	else
	{
		var newImg = --imgid;
	}
}

function previousimg()
{
if (imgid  > 1)
{
imgid--;
}


	if (imgid <= 1)
	{
		var newImg = imgid;
		document.getElementById('pre').style.display='none';
		document.getElementById('next').style.display='block';
	}
	else
	{
		var newImg = imgid;
		document.getElementById('pre').style.display='block';
		document.getElementById('next').style.display='block';	
	}
	
	set_big_img_path(newImg);
	
	bhw();
	
	var pic = document.getElementById(newImg);
	productName = pic.alt;
	productName = unescape(productName);
	if(productName.length > 40)
        {
		var c = productName.substring(0,40);
		c = c + "...";
		productName = c;
        }
	document.getElementById('imagediv').innerHTML='<img src="'+path+'" onload="loadimg()">';
	document.getElementById('prname').innerHTML=productName;
}


function set_big_img_path(imgid)
{
	document.getElementById('loadimg').style.display="block";
	document.getElementById('imagediv').style.display="none";

	var k = dataref.length-1;
	if(k >= 0)
	{
		var i = imgid-1;
		path = eval("dataref["+i+"].img_path");
	}
}



if(window.Event)
function keyDown(e)
{

	var n = (window.Event) ? e.which : e.keyCode;

	if(n==38 && document.getElementById('message2').style.display=="block")
	{
	return false;
	}


else if(n==40 && document.getElementById('message2').style.display=="block")
	{
return false;
	}


	
else if(n==9 && document.getElementById('message2').style.display=="block")
	{
return false;
	}


else if(n==32 && document.getElementById('message2').style.display=="block")
	{
return false;
	}

else if(n==27 && document.getElementById('message2').style.display=="block")
	{
blowup_off();
	}

if(n==37 && document.getElementById('message2').style.display=="block")
	{
//alert(imgid);
if (imgid == 1)
{
return false;
}
previousimg();
}
else if(n==39 && document.getElementById('message2').style.display=="block")
	{
if (imgid == dataref.length)
{
return false;
}
nextimg();
	}
}

function loadimg()
{
document.getElementById('loadimg').style.display="none";
document.getElementById('imagediv').style.display="block";
}


document.write('<DIV ID="message2" CLASS="sec-open"STYLE="position: absolute; display: none; top: 0px; left: 0px; z-index: 2000; ALIGN="center"><DIV STYLE="height: 112px;" ID="divheight"><IMG SRC="ts/zero.gif" BORDER="0" WIDTH="1" HEIGHT="1"></DIV><TABLE ID="tableheight" ALIGN="center" BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR><TD ALIGN="center"><TABLE CLASS="bgclor" BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR><TD ALIGN="center"><TABLE CLASS="main" ALIGN="center" BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%" HEIGHT="35"><TR><TD WIDTH="100%"><DIV ID="prname" CLASS="pr-txt"></DIV></TD><TD ALIGN="right"><DIV CLASS="closelink"><P ONCLICK="blowup_off()">Close</P></DIV></TD></TR></TABLE><TABLE CLASS="button" BORDER="0" id="table_nxt" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR><TD HEIGHT="28"><IMG SRC="ts/zero.gif" WIDTH="70" HEIGHT="1"><BR><IMG STYLE="display: none;" SRC="ts/back01.gif" ID="pre" ONCLICK="previousimg()" CLASS="hand" BORDER="0" WIDTH="70" HEIGHT="10"></TD><TD WIDTH="100%"><DIV CLASS="ucan" ALIGN="center">Use &lt;- &amp; -&gt; arrow keys on the keyboard to view previous &amp; next image</DIV></TD><TD ALIGN="right"><IMG SRC="ts/zero.gif" WIDTH="40" HEIGHT="1"><BR><IMG STYLE="display: block;" SRC="ts/next01.gif" ID="next" CLASS="hand" ONCLICK="nextimg()" BORDER="0" WIDTH="40" HEIGHT="10"></TD></TR></TABLE><DIV STYLE="height: 500px; width: 504px;" CLASS="image_div" ID="divscroll" ALIGN="center"><TABLE STYLE="height: 500px;" ID="blwtbl" ALIGN="center" BGCOLOR="#ffffff" BORDER="0" CELLPADDING="0" CELLSPACING="0" HEIGHT="500"><TR><TD ALIGN="center"><DIV ID="loadimg" STYLE="font-family: arial; font-size: 15px; display: none;"><IMG SRC="ts/indicator-new.gif"><BR><BR>Loading...</DIV><DIV ID="imagediv" STYLE="display: block;"></DIV></TD></TR></TABLE></DIV></TD></TR></TABLE></TD></TR></TABLE></DIV>'); 