<!--//

function reg() //- DVPDS20070115 - Original function
{
	var Key
	if (navigator.appName == 'Netscape')
	{
		if (window.captureEvents)
		{
		}
	}
}

function netscapeKeyPress(e)
{
	if (e.which==13)
	{
     return false
	}
}

function fnTrapKD(btn, event)
{
	if (event.keyCode == 13)
	doIT(btn, event);
}

function doIT(btn, event)
{
	document.Form1.enterkey.value=btn
	event.returnValue=false;
	event.cancel = true;
	if (btn.length !=0) 
		document.Form1.submit();
}

var hidevalue;
function ClearInitQty(TheBox)
{
    if (TheBox.value !="" )
    hidevalue=TheBox.value; 
    TheBox.value ="";
}

function InitQty(TheBox, HideLabel)
{
    //nothing
}

function NewInitQty(TheBox)
{
    if (TheBox.value=="")
    TheBox.value = hidevalue; 
}


// MENU MOUSE OVER 
function menuOver(itemName) {
 clearTimeout(timeOn)
 menuActive = 1
}
// MENU MOUSE OUT 
function menuOut(itemName) {
 if(document.layers) {
 	menuActive = 0 
 	timeOn = setTimeout("hideAllMenus()", 400)
  }
}
// SET BACKGROUND COLOR 
function getImage(name) {
  if (document.layers) {
    return findImage(name, document);
  }
  return null;
}

function findImage(name, doc) {
  var i, img;
  for (i = 0; i < doc.images.length; i++)
    if (doc.images[i].name == name)
      return doc.images[i];
  for (i = 0; i < doc.layers.length; i++)
    if ((img = findImage(name, doc.layers[i].document)) != null) {
      img.container = doc.layers[i];
      return img;
    }
  return null;
}

function getImagePageLeft(img) {
  var x, obj;
  if (document.layers) {
    if (img.container != null)
      return img.container.pageX + img.x;
    else
      return img.x;
  }
  return -1;
}

function getImagePageTop(img) {
  var y, obj;
  if (document.layers) {
    if (img.container != null)
      return img.container.pageY + img.y;
    else
      return img.y;
  }
  return -1;
}

var timeOn = null
numMenus = 1;
document.onmouseover = hideAllMenus;
document.onclick = hideAllMenus;
window.onerror = null;

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	//we couldn't find the object, so we can't change its visibility
	return false;
    }
} // changeObjectVisibility

function showDDMenu(menuNumber, eventObj, labelID) {
    hideAllMenus();
	if(document.layers) {
	img = getImage("img" + menuNumber);
 	x = getImagePageLeft(img);
 	y = getImagePageTop(img);
 	menuTop = y + 12; // LAYER TOP POSITION
	eval('document.layers["menu'+menuNumber+'"].top="'+menuTop+'"');
 	eval('document.layers["menu'+menuNumber+'"].left="'+x+'"');
	}
	eventObj.cancelBubble = true;
    var menuId = 'menu' + menuNumber;
    if(changeObjectVisibility(menuId, 'visible')) {
	return true;
    } else {
	return false;
    }
}

function hideAllMenus() {
    for(counter = 1; counter <= numMenus; counter++) {
	changeObjectVisibility('menu' + counter, 'hidden');
    }
}

function moveObject(objectId, newXCoordinate, newYCoordinate) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.left = newXCoordinate;
	styleObject.top = newYCoordinate;
	return true;
    } else {
	// we couldn't find the object, so we can't very well move it
	return false;
    }
} // moveObject


//Start function for add to cart
function disabledenterkey()
{
	if (window.event.keyCode ==13)
	{  
	window.event.keyCode =0
	}
}

function clickAddtoCart(e, buttonid,thebox,thevalidator)
{ 
	var bt = document.getElementById(buttonid); 
	if (typeof bt == 'object')
	{ 
		if(navigator.appName.indexOf("Netscape")>(-1))
		{ 
			if (e.keyCode == 13)
			{
			validate = CheckQuantity1(thebox,thevalidator,bt)
				if (validate) 
				{
					bt.click(); 
					return false;
				}
			} 
		} 
		if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
		{ 
			if (event.keyCode == 13)
			{ 
				validate = CheckQuantity1(thebox,thevalidator,bt)
				if (validate)
				{
					bt.click(); 
					return false;
				}
				else
				{
					cancelevent()
					event.keyCode = 9;
				}
			} 
		} 
	} 
}

function clickAddtoCartQuickOrder(e, buttonid,thebox)
{// Enter Key down doesn't trigger the validator event . So Catch enter key function is needed to validate quantity input
 //catch enter key . if  quantity is correct , then submit the page ,otherwise , return the page
	var bt = document.getElementById(buttonid); 
	if (typeof bt == 'object')
	{ 
		if(navigator.appName.indexOf("Netscape")>(-1))
		{ 
			if (e.keyCode == 13)
			{
				bt.click(); 
				return false;
			} 
		} 
		if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
		{ 
			if (event.keyCode == 13)
			{ 
				cancelevent();				
				bt.click(); 
				return false; 
			} 
		} 
	} 
} 

var eventname;

function cancelevent()
{   
	event.returnValue=false;
    event.cancel = true;
}

function validatefields(fields)
{
	for (var i=0; i< fields.length;i++)
	{
	var returnvalue
	returnvalue = true
	eval("var otmp = document.forms(0)." + fields[i][0]);
	if (otmp=="[object]" || otmp=="[object HTMLInputElement]")
	{
		if (otmp.value=="")
		{
			alert(fields[i][1]);
			otmp.focus();
			returnvalue =  false;
			break;
		}
		else if (eventname == fields[0][0])
		{
			eval("var otmp = document.forms(0)." + fields[i+1][0]);
			if (otmp=="[object]" || otmp=="[object HTMLInputElement]")
			{
				if (otmp.value=="")
				{
					otmp.focus()
					returnvalue =  false
					break;
				}
			}
		}
	}
	}
	return returnvalue
}

//END function for addto cart

function CheckQuantity1(theQty,theValidator,bt)
{ //
var thistalue;
var theText = document.getElementById(theQty); 
var validator = document.getElementById(theValidator); 
if (typeof theText == 'object')
{ 
	thistalue = theText.value
	if (parseFloat(thistalue) == 0)
	{ 
		if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
			validator.style.display =""
		else
		    bt.click()
			//alert("");
		theText.focus();
		return false;}
	if (!IsBlank(thistalue))
	{ 
	if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
        validator.style.display =""
	else  
	    bt.click();
       // alert("");
	theText.focus();
	return false;
	}
	else
	{  
		theText.value=parseFloat(thistalue);
		theText.focus();
		return true;
	}
	}
}

function IsBlank(thevalue)
{
//  check for valid numeric strings	
 
	var strValidChars = "0123456789";
	var strChar;
	var blnResult = true;

	if (thevalue.length == 0) return false;

	//  test strString consists of valid characters listed above
	for (i = 0; i < thevalue.length && blnResult == true; i++)
	{
		strChar = thevalue.charAt(i);
		if (strValidChars.indexOf(strChar) == -1)
		{
			blnResult = false;
		}
	}
	return blnResult;
}

function IsNumeric(strString)
//  check for valid numeric strings	
{
	var strValidChars = "0123456789";
	var strChar;
	var blnResult = true;

	if (strString.length == 0) return false;

	//  test strString consists of valid characters listed above
	for (i = 0; i < strString.length && blnResult == true; i++)
	{
	strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1)
		{
			blnResult = false;
		}
	}
	return blnResult;
}


function createFakeEventObj() {
    // create a fake event object for older browsers to avoid errors in function call
    // when we need to pass the event object to functions
    if (!window.event) {
	window.event = false;
    }
} // createFakeEventObj


function resizeBlankDiv() {
    // resize blank placeholder div so IE 5 on mac will get all clicks in window
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	getStyleObject('blankDiv').width = document.body.clientWidth - 20;
	getStyleObject('blankDiv').height = document.body.clientHeight - 20;
    }
}

function explorerMacResizeFix()
{
    location.reload(false);
}

function mClk(src)
{ 
    if(event.srcElement.tagName=='TD')
    src.children.tags('A')[0].click();
}

function populateState(countryObj,stateObj)
{
    var country = countryObj[countryObj.selectedIndex].value;
    stateObj.options.length = 1;
    if (country != "")
    {
        if (state[country][state[country].length-1].toLowerCase()== "false")
        {
            stateObj.disabled=false;
            for (i = 0; i < (state[country].length-1); i++)
            {
                stateObj.options[i + 1] = new Option(statename[country][i], state[country][i]);
            }
        }
        else
        {
        stateObj.disabled=true;
        }
    }
}

function PickUp(src,dest)
{
    var theSource,theDestination
    theSource =document.getElementById(src)
    theDestination =document.getElementById(dest)
    var thetemp1=theSource
    var thetemp2=theDestination
    var tempSelected
    tempSelected=false

    var optionCount
    optionCount=theDestination.length

    for (var i=0; i<theSource.length ;i++)
    {  
        if (theSource .options [i].selected)
        {
            tempOption= new Option(theSource.options[i].text,theSource.options[i].value)
            theDestination.options[optionCount]=tempOption
            theDestination.options[optionCount].selected=true
            theSource.options[i]=null
            optionCount++
            tempSelected=true
        }
    }
    if (tempSelected)
    PickUp(src,dest)	
    return true	
}

function selectall(theListBox)
{ 
    var theSource
    theSource =document.getElementById(theListBox)
    for (var i=0;i<theSource .length  ;i++)
    {
        theSource.options[i].selected=true;
    }
    return true
}

//-->
