var myWidth = 0, myHeight = 0;


function bhw() 
{

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 browserName=navigator.appName; 

var imagedivheight=myHeight-93;
var test = myWidth*24/100;
var divwidth = myWidth-test;
var widthformizilla = myWidth-538;
var mozillawidth = widthformizilla-divwidth;
var iewidth = myWidth-516;

var mozillawidth1 = mozillawidth/2;
var iewidth1 = iewidth/2;

var mtop = h+7;
var aboveheight = myHeight-584;
var aboveheight1 = aboveheight/2+h;



document.getElementById('divscroll').style.height="500px";
document.getElementById('divscroll').style.width="504px";
document.getElementById('blwtbl').style.height="478px";
document.getElementById('message2').style.top=aboveheight1+'px';
document.getElementById('message2').style.left=iewidth1+'px';
document.getElementById('divscroll').name="miniwin";



if (myHeight <= 586)
{
document.getElementById('divscroll').style.height=imagedivheight+'px';
document.getElementById('divscroll').style.width="522px";
document.getElementById('blwtbl').style.height=imagedivheight+'px';
document.getElementById('message2').style.top=mtop+'px';

}

}


function max()
{
var imagedivheightnew=myHeight-93;
var imagedivwidthnew=myWidth-212;
var imagedivheightnew1=myHeight-94;


var h = window.pageYOffset ||
document.body.scrollTop ||
document.documentElement.scrollTop;
var browserName=navigator.appName; 
var mtop = h+7;



if (document.getElementById('divscroll').name=="miniwin")
{

document.getElementById('message2').style.left="100px";

document.getElementById('message2').style.top=mtop+'px';
document.getElementById('divscroll').style.width=imagedivwidthnew+'px';
document.getElementById('divscroll').style.height=imagedivheightnew+'px';
document.getElementById('blwtbl').style.height=imagedivheightnew1+'px';
document.getElementById('divscroll').name="maxwin";
document.getElementById('mx').className="doff";
document.getElementById('mx1').className="don";
}

else
	{
document.getElementById('mx').className="don";
document.getElementById('mx1').className="doff";
bhw() 
	}


}


function blowup_show()
{
document.body.style.overflow = "hidden";
document.getElementsByTagName("html")[0].style.overflow = "hidden";

document.getElementById('message2').className="don";
bhw();

}


function blowup_off()
{
document.getElementById('message2').className="doff";
document.body.style.overflow = "";
document.getElementsByTagName("html")[0].style.overflow = "";
}


var path = '';
var imgid = "0";
var queryrfq = '';
function imageset(id)
{
	set_big_img_path(id);
//alert(queryrfq);	
	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;
        }
		var alt='';
	if(productName != '' )
	{
		alt='alt="'+productName+'"';
	}
	document.getElementById('imagediv').innerHTML='<img src="'+path+'" onload="loadimg()" id="bigimg" ' + alt +'>'; 
	document.getElementById('prname').innerHTML=productName;

}

function set_big_img_path(imgid)
{
	document.getElementById('loadimg').className="don";
	document.getElementById('imagediv').className="doff";

	var k = dataref.length-1;
	if(k >= 0)
	{
		var i = imgid-1;
		path = eval("dataref["+i+"].img_path");

		queryrfq = eval("dataref["+i+"].queryrfq");
	}
}


function keyDown(e)
{var n = (window.Event) ? e.which : e.keyCode;

	


 if(n==9 && document.getElementById('message2').className=="don")
	{
return false;
	}


else if(n==32 && document.getElementById('message2').className=="don")
	{
return false;
	}


else if(n==27 && document.getElementById('message2').className=="don")
	{
blowup_off();
	}


}


function loadimg()
{
document.getElementById('loadimg').className="doff";
document.getElementById('imagediv').className="don";
	if(document.getElementById('bigimg').height > 500 && document.getElementById('bigimg').width > 500)
	{
		max();
	}

}


document.write('<div id="message2" STYLE="position: absolute; top: 0px; left: 0px; z-index: 2000"; align="center" class="doff"><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 id="titleBar"  STYLE="cursor:move"><ILAYER width="100%" ONSELECTSTART="return false"> </ILAYER><LAYER width="100%" onmouseover="isHot=true;if (isN4) ddN4(message2)" onmouseout="isHot=false"><div id="prname" class="pr-txt"></div></LAYER></td><td align="right" STYLE="padding-right:0px;" width="100"><table BORDER="0" CELLPADDING="0" CELLSPACING="0"><tr><td><img src="ts/max1.gif" id="mx" width="21" height="21" STYLE="cursor:pointer" onclick="max()" HSPACE="3"></td><td><img src="ts/max.gif" id="mx1" width="21" height="21" STYLE="cursor:pointer;" class="doff" onclick="max()" HSPACE="3"></td><td><img src="ts/cl.gif" width="21" height="21" onclick="blowup_off()" STYLE="cursor:pointer"></td></tr></table></td></tr></table><div STYLE="height: 500px; width: 504px;" class="image_div" id="divscroll" align="center"><table id="blwtbl" align="center" BGCOLOR="#ffffff" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><tr><td align="center"><div id="loadimg" STYLE="font-family: arial; font-size: 15px;" class="doon"><img src="ts/indicator-new.gif"><br><br>Loading...</div><div id="imagediv" class="doff"></div></td></tr></table></div></td></tr></table></td></tr></table></div>');









isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.message2 : document.getElementById("message2");  
  hotDog=isIE ? event.srcElement : e.target;  
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }  
  if (hotDog.id=="titleBar"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichDog.style.left);
    nowY=parseInt(whichDog.style.top);
    ddEnabled=true;
    document.onmousemove=dd;
  }
}

function dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx+'px'; 
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety+'px';
  return false;  
}

function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function hideMe(){
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.message2.visibility="hide";
}

function showMe(){
  if (isIE||isNN) whichDog.style.visibility="visible";
  else if (isN4) document.message2.visibility="show";
}

document.body.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");


