//  Show <DIV> in center of window
var MessWaitingAnilize="<table bgcolor=#FFFFFF style='BORDER:  #B4D8D4 3px solid;' ><tr><td><img src='progress2.gif' border='0'></td></tr></table>";
function showdeadcenterdiv(Xwidth,Yheight,divid) { 
// First, determine how much the visitor has scrolled
var scrolledX, scrolledY; 
if( self.pageYOffset ) { 
scrolledX = self.pageXOffset; 
scrolledY = self.pageYOffset; 
} else if( document.documentElement && document.documentElement.scrollTop ) { 
scrolledX = document.documentElement.scrollLeft; 
scrolledY = document.documentElement.scrollTop; 
} else if( document.body ) { 
scrolledX = document.body.scrollLeft; 
scrolledY = document.body.scrollTop; 
}

// Next, determine the coordinates of the center of browser's window

var centerX, centerY; 
if( self.innerHeight ) { 
centerX = self.innerWidth; 
centerY = self.innerHeight; 
} else if( document.documentElement && document.documentElement.clientHeight ) { 
centerX = document.documentElement.clientWidth; 
centerY = document.documentElement.clientHeight; 
} else if( document.body ) { 
centerX = document.body.clientWidth; 
centerY = document.body.clientHeight; 
}

// Xwidth is the width of the div, Yheight is the height of the 
// div passed as arguments to the function: 
var leftOffset = scrolledX + (centerX - Xwidth) / 2; 
var topOffset = scrolledY + (centerY - Yheight) / 2; 
// The initial width and height of the div can be set in the 
// style sheet with display:none; divid is passed as an argument to // the function 
var o=document.getElementById(divid); 
var r=o.style; 
r.position='absolute'; 
r.top = topOffset + 'px'; 
r.left = leftOffset + 'px'; 
// UsmAdd
r.width=Xwidth+"px";
r.height=Yheight+"px";
//end UsmAdd
r.display = "block"; 
} 
function CheckNumeric(El,Ev)
{
var k=Ev.keyCode;
var strString=El.value;
var strValidChars = "0123456789.-";
var strChar;
var kDot=0;
var blnResult = true;
   if (strString.length > 0) 
	{
	   //  test strString consists of valid characters listed above
	   var backString="";
	   for (i = 0; i < strString.length; i++)
	      {
	      strChar = strString.charAt(i);
	     	if (strValidChars.indexOf(strChar) == -1)
	        {
		         blnResult = false;
	        }
	     	else if (strChar == ".")
	        {
			if (kDot<1)
			backString=backString+strChar;
			else			
			blnResult = false;
			 kDot++;
	        }
		else
		{
			backString=backString+strChar;
		}
	      }
	if (!blnResult)
	El.value=backString;
	}
}
function ShowDivProg()
{
  document.getElementById("showprogress").innerHTML=MessWaitingAnilize;
  showdeadcenterdiv(100,100,"showprogress");
  document.getElementById("showprogress").style.visibility='visible';
  document.getElementById("showprogress").style.zIndex=1000;
}
function CloseDivProg()
{
  document.getElementById("showprogress").innerHTML="";
  document.getElementById("showprogress").style.zIndex=-150;
}
function checkemail(email) {

       var UhoMesto=email.indexOf("@");
       var dlina=email.length;
	if (dlina<4)
          return false;
       if (UhoMesto==-1)
          return false;
       if (UhoMesto==-1 || UhoMesto==0 || UhoMesto==dlina)
          return false;
       var tStr=email.substring(UhoMesto+1);
        if (tStr.length<3)
           return false
       if (tStr.indexOf(".")==-1 || tStr.indexOf(".")==0 || tStr.indexOf(".")==tStr.length){
           return false;
       }
       if (tStr.indexOf(".")==tStr.length-1)
           return false;
        if (tStr.indexOf("@")!=-1)
           return false
 return true;
 }  
function taxSaleInfo(Kod)
{
var s="";
	if (Kod=="1") s="Only while quantities last";
	else if (Kod=="2") s="In stock items only";
	else if (Kod=="3") s="No special orders";
	else if (Kod=="4") s="Not valid with any other offer";
	else if (Kod=="5") s="Display Model-Store Pickup Only";
	else if (Kod=="6") s="While quantities last";
	else if (Kod=="7") s="Final Sale / No Returns";
	else if (Kod=="8") s="Display Model";
	else if (Kod=="9") s="In Store pick-up";
return s;
}
function usmCheckValue(Vhod){
var back=true;
if (Vhod=="")
	back=false;
else if (Vhod=="0")
	back=false;
else if (Vhod=="0.00")
	back=false;
else if (Vhod=="na")
	back=false;
else if (Vhod=="tbn")
	back=false;
else if (Vhod=="tbd")
	back=false;
return back;
}
function usmEscape(Vhod)
{
var k=escape(Vhod);
for(;k.indexOf("+")>-1;)
	k=k.replace("+", "%2b");
return k;
}
function ldDataTable(dop)
{
var s="";
	if (dop!="" && dop!="undefined")
	{
	var b=[];
	var sDiv="<2>";
	var sD2="<@>";
	var arr1=dop.split(sDiv);
	var arr2=arr1[0].split(sD2);
		b.push(ldDataRow("Weight",arr2[0],"",""));
ProductName=arr2[1];
		b.push(ldDataRow("Product Name",arr2[1],"",""));
		b.push(ldDataRow("UPC",arr2[2],"",""));
		b.push(ldDataRow("Category",arr2[3],"",""));
		b.push(ldDataRow("Glass",arr2[4],"",""));
		b.push(ldDataRow("Connection",arr2[5],"",""));
	   arr2=arr1[1].split(sD2);
		if (arr2[0]=="Y")
		{
		b.push(ldDataRow("Shipped Via","UPS","",""));
		}
		b.push(ldDataRow("Safety Rating",arr2[1],"",""));
		b.push(ldDataRow("Safety Listing",arr2[2],"",""));
		b.push(ldDataRow("Canopy",arr2[3],"",""));
		b.push(ldDataRow("Chain",arr2[4],"",""));
		b.push(ldDataRow("Wire",arr2[5],"",""));
		b.push(ldDataRow("Top to outlet",arr2[6],"",""));
		b.push(ldDataRow("Special feature",arr2[7],"",""));
	   arr2=arr1[2].split(sD2);
		b.push(ldDataBulb("Bulb",arr2[0],arr2[1],arr2[2],arr2[3],arr2[4],arr2[5],arr2[6]));
	   arr2=arr1[3].split(sD2);
		b.push(ldDataBulb("Bulb 2",arr2[0],arr2[1],arr2[2],arr2[3],arr2[4],arr2[5],""));
	   arr2=arr1[4].split(sD2);
		b.push(ldDataRow("Motor Size",arr2[0],"",""));
		b.push(ldDataRow("Motor Housing",arr2[1],"",""));
		b.push(ldDataRow("Motor Mounting System",arr2[2],"",""));
		b.push(ldDataRow("Blade Pitch",arr2[3],"",""));
		b.push(ldDataRow("Blade Span",arr2[4],"",""));
		b.push(ldDataRow("Blade Type",arr2[5],"",""));
		b.push(ldDataRow("Blade Finish",arr2[6],"",""));
		b.push(ldDataRow("Blade Qty",arr2[7],"",""));
		b.push(ldDataRow("Downrow",arr2[8],"",""));
		b.push(ldDataRow("Mounting System",arr2[9],"",""));
		b.push(ldDataRow("Reverse Air Flow",arr2[10],"",""));
		b.push(ldDataRow("Speeds",arr2[11],"",""));
		b.push(ldDataRow("Light Kit",arr2[12],"",""));
		b.push(ldDataRow("Optional Control",arr2[13],"",""));
		b.push(ldDataRow("Electricity Use",arr2[14],"",""));
		b.push(ldDataRow("Manufacturer Warranty",arr2[15],"",""));
		b.push(ldDataRow("(CFM/WATT)",arr2[16],"",""));
		b.push(ldDataRow("(CFM)",arr2[17],"",""));
	   arr2=arr1[5].split(sD2);
		b.push(ldDataRow("Designer",arr2[0],"",""));
		b.push(ldDataRow("Installation Instruction",arr2[1],"",""));
		b.push(ldDataRow("Parts Diagram",arr2[2],"",""));
		LongDescription=arr2[3];
	s=b.join("");
	}
return s;
}
function ldDataBulb(sName,sInc,sNumber,sType,sMax,sBase,sSource,sVoltage)
{
var s="";
if (usmCheckValue(sInc) || usmCheckValue(sNumber) || usmCheckValue(sType) || usmCheckValue(sMax) || usmCheckValue(sBase) || usmCheckValue(sSource) || usmCheckValue(sVoltage))
{
var b2=[];
		b2.push(ldDataHeader(sName,"style='padding-left:3px;border-top:2px solid #666666;border-left:2px solid #666666;border-right:2px solid #666666;font-size:12px;'"));
	if (usmCheckValue(sInc))
	{
		b2.push(ldDataRow("Bulb Included","Yes","style='border-left:2px solid #666666;padding-left:3px;'","style='border-right:2px solid #666666;'"));
	}
	if (usmCheckValue(sNumber))
	{
		b2.push(ldDataRow("# of bulbs",sNumber,"style='border-left:2px solid #666666;padding-left:3px;'","style='border-right:2px solid #666666;'"));
	}
	if (usmCheckValue(sMax))
	{
		b2.push(ldDataRow("Max Wattage",sMax,"style='border-left:2px solid #666666;padding-left:3px;'","style='border-right:2px solid #666666;'"));
	}
	if (usmCheckValue(sType))
	{
		b2.push(ldDataRow("Bulb Type",sType,"style='border-left:2px solid #666666;padding-left:3px;'","style='border-right:2px solid #666666;'"));
	}
	if (usmCheckValue(sBase))
	{
		b2.push(ldDataRow("Base",sBase,"style='border-left:2px solid #666666;padding-left:3px;'","style='border-right:2px solid #666666;'"));
	}
	if (usmCheckValue(sSource))
	{
		b2.push(ldDataRow("Light Source",sSource,"style='border-left:2px solid #666666;padding-left:3px;'","style='border-right:2px solid #666666;'"));
	}
	if (usmCheckValue(sVoltage))
	{
		b2.push(ldDataRow("Voltage",sVoltage,"style='border-left:2px solid #666666;padding-left:3px;'","style='border-right:2px solid #666666;'"));
	}
		b2.push(ldDataHeader("","style='border-top:2px solid #666666;height:5px;'"));
s=b2.join("");
}
return s;
}
function DoNothing()
{
}

