//kbkdo = document.getElementById;//Modified 10/07/2007 - kbk : Since this doesnt work in ff, ns, opera..
function kbkdo(element){return document.getElementById(element);}
function kbkCreateVirtualWin(divId,ifId, ifSrc){
	var kbkDvCD;
		//kbkDvCD  = "<div id='dvCopyData' style='border:1px solid #b6b683;  width:100%; display:none; position:absolute; top:10px; left:10px;'>";
	kbkDvCD  = "<div id='"+divId+"' style='border:1px solid #b6b683;  width:100%; display:none; position:absolute; top:10px; left:10px;'>";
	//kbkDvCD += "<table border'2'><tr><td rowspan='2' style=\"width:5px; background-image:url('/images/kbkLtShadow.jpg')\"></td><td>"
	kbkDvCD += "<div style=\"background-image:url('/images/kbkTitle.jpg');\"><span style='width:97%; font: bold; text-align:center'>Copy Data</span><span style='cursor:hand' onclick=\"kbkCopyData('close')\">[X]</span></div>";
		//kbkDvCD += "<iframe id='ifCopyData' src='product_overview_edit_copyData.asp?prodCode=<%=Session("ProdClassID")%>' style='width:100%; height:300;' frameborder='0' vspace='0' hspace='0' scrolling='yes' marginwidth='0px' marginheight='0px'></iframe>";
	kbkDvCD += "<iframe id='"+ifId+"' src='"+ifSrc+"' style='width:100%; height:300;' frameborder='0' vspace='0' hspace='0' scrolling='yes' marginwidth='0px' marginheight='0px'></iframe>";
	//kbkDvCD += "</td><td rowspan='2' style=\"width:5px; background-image:url('/images/kbkRtShadow.jpg')\"></td></tr>"
	//kbkDvCD += "<tr><td style=\"height:5px; background-image:url('/images/kbkBtShadow.jpg')\"></td></tr></table>"
	kbkDvCD += "</div>";
	document.write(kbkDvCD)
	//alert(kbkDvCD)
}
var kbkTimer;
function kbkSetImageDimension(imgObjId, maxWidth, maxHeight){
	imgElement=document.getElementById(imgObjId);
	if(!imgElement.complete || imgElement.width==0 ){
		kbkTimer = setTimeout("kbkSetImageDimension('"+imgObjId+"', "+maxWidth+", "+maxHeight+")",100);
		return;
	}
	//*
	imgW = imgElement.width;
	imgH = imgElement.height;
	if(imgW>=imgH){
		if(imgW > maxWidth){
			imgElement.width = maxWidth;
			/** Below lines are setting the height in proportion to the width. IE is handling the proportion.
			//* Enable this if any browser is not handling the proportion properly.
			wPerDiff = kbkPerDiff(imgElement.width,imgW);
			imgElement.height = kbkPerVal(imgH,wPerDiff)
			//*/
		}
	}
	else{
		if(imgH > maxHeight){
			imgElement.height = maxHeight;
			/** Below lines are setting the width in proportion to the width. IE is handling the proportion.
			//* Enable this if any browser is not handling the proportion properly.
			hPerDiff = kbkPerDiff(imgElement.height,imgH);
			imgElement.width = kbkPerVal(imgW,hPerDiff)
			//*/
		}
	}
	//imgElement.width=imgW>maxWidth?maxWidth:imgW;
	//imgElement.height=imgH>maxHeight?maxHeight:imgH;
	/*/
	if(imgElement(imgObjId).width > maxWidth)
		imgElement(imgObjId).width = maxWidth;
	if(imgElement(imgObjId).height > maxHeight)
		imgElement(imgObjId).height = maxHeight;
	//*/
	/*
	ln0 = "maxwidth=" + maxWidth + " & maxHeight=" + maxHeight + "\n"
	ln1 = imgW + " width " + imgElement.width + "\n";
	ln2 = imgH + " height " + imgElement.height
	alert(ln0 + ln1 + ln2);
	//*/
}
function kbkPerDiff(xc,x){
	return xc/x*100;
}
function kbkPerVal(y,xPerDiff){
	return y*xPerDiff/100;
}
//----Start--kbk-Rnd-Rect-----------------------------------------
/*
corner can have values as follows
---------12
84 21
--------
TB LR		(when TB=00=>T; TB=11=>B; TB=10=>L; TB=01=>R) and (LR have values L; R; LR;)
00 10	2
00 01	1
00 11	3
 	
11 10	14
11 01	13
11 11	15
	
10 10	10
10 01	9
10 11	11
	
01 10	6
01 01	5
01 11	7
*/
var kbkUId = 0;//This is a unique no used for creating Unique ElementId
//function kbkroundedrect(text, kbkBgColor, corner, returnFlag){
function kbkroundedrect(text, kbkBgColor, corner8421, returnFlag){
	var classTLt="kbkShow", classTRt="kbkShow", classBLt="kbkShow", classBRt="kbkShow";
	kbkUId+=1;
	if(corner8421==3){
		classBLt="kbkHide";
		classBRt="kbkHide";
		//alert(classBLt)
	}
	if(corner8421==15){
		classTLt="kbkHide";
		classTRt="kbkHide";
		//alert(classBLt)
	}

	strHtml ='<table width="100%" cellpadding="0" cellspacing="0" align="center" bgcolor="'+kbkBgColor+'" border="0">';//kbkBgColor="#66CCFF"
	strHtml+='\n';
	strHtml+='<tr>';
	strHtml+='\n';
	strHtml+='<td id="tdCornerTLt'+kbkUId+'" class="tlt1" align="left" valign="top"><img id="imgTLt'+kbkUId+'" class="'+classTLt+'" src="/images/kbkRndRectTLt.gif"></td>';
	strHtml+='\n';
	strHtml+='<td rowspan="2" align="center">';
	strHtml+='\n';
	strHtml+='\n';
	strHtml+=text;
	strHtml+='\n';
	strHtml+='\n';
	strHtml+='</td>';
	strHtml+='\n';
	strHtml+='<td id="tdCornerTRt'+kbkUId+'" class="trt1" align="right" valign="top"><img id="imgTRt'+kbkUId+'" class="'+classTRt+'" src="/images/kbkRndRectTRt.gif"></td>';
	strHtml+='\n';
	strHtml+='</tr>';
	strHtml+='\n';
	strHtml+='<tr>';
	strHtml+='\n';
	strHtml+='<td id="tdCornerBLt'+kbkUId+'" class="blt1" align="left" valign="bottom"><img id="imgBLt'+kbkUId+'" class="'+classBLt+'" src="/images/kbkRndRectBLt.gif"></td>';
	strHtml+='\n';
	strHtml+='<td id="tdCornerBRt'+kbkUId+'" class="brt1" align="right" valign="bottom"><img id="imgBRt'+kbkUId+'" class="'+classBRt+'" src="/images/kbkRndRectBRt.gif"></td>';
	strHtml+='\n';
	strHtml+='</tr>';
	strHtml+='\n';
	strHtml+='</table>';

	/*strHtml+='<scr'+'ipt language="javascript">';
	//if(corner==2)
	//strHtml+='kbkdo("imgTLt'+kbkUId+'").className="tlt";';
	//strHtml+='kbkdo("imgTRt'+kbkUId+'").className="tlt";';
	if(corner==2){
		alert("applyingBottom");
		strHtml+='kbkdo("imgBLt'+kbkUId+'").className="kbkHide";';
		strHtml+='kbkdo("imgBRt'+kbkUId+'").className="kbkHide";';
	}
	strHtml+='</scr'+'ipt>';
	*/
	//alert(strHtml)
	if(returnFlag){
		return strHtml;
	}
	else{
		document.write(strHtml);
	}
}
//----End----kbk-Rnd-Rect-----------------------------------------
