function reg() //- DVPDS20070115 - Original function
{
	var Key
	if (navigator.appName == 'Netscape')
	{
		if (window.captureEvents)
		{
		}
	}
}

function netscapeKeyPress(e)
{
	if (e.which==13)
	{
    fnTrapKD("",e); // disabled
	}
}

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 value
function SetupProvinceCode()
{
var countrycode
var currcountrycode
var statecode
var description
var dCountry
var dState 
var index
var lastindex
var isempty = false
  
dState = document.Form1.Account1_dState
dCountry =document.Form1.Account1_dCountry
for (i=0;i<dCountry.length ;i++)
{
	if (dCountry.options[i].selected)
	{
		countrycode=dCountry.options[i].value
		break;
	}
}

do
{
isempty=false
	for (var i=0;i<dState.length;i++)
	{
		dState .options [i]=null
		isempty=true
	}
}
while(isempty)
	
var j =0 
tOption= new Option("Select a Prov./State","")
dState.options [j]=tOption
j=j+1
for(i=0;i<StateCodes.length -1 ;i++){
	value = StateCodes[i]
	currcountrycode =getcode()
	if (currcountrycode == countrycode){
		statecode =getcode()
		description =getcode()
		tOption= new Option(description,statecode)
		dState.options [j]=tOption
		j=j+1
	}
}
dState.options[0].selected =true
}

function getcode()
{
	var index;
	var code;
	index = value.indexOf(":");
	if (index==-1)
	{
		code = value
	}
	else
	{
		code = value.substring(0,index);
		value = value.substring(index+1);
}
return code
}



var hidevalue;
function ClearInitQty(TheBox)
{

if (TheBox.value !="" )
  hidevalue=TheBox.value; 
  TheBox.value ="";
}

function InitQty(TheBox, HideLabel)
{

}

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)
				if (validate) 
				{
					bt.click(); 
					return false;
				}
			} 
		} 
		if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
		{ 
			if (event.keyCode == 13)
			{ 
				validate = CheckQuantity1(thebox,thevalidator)
				if (validate)
				{
					bt.click(); 
					return false;
				}
				else
				{
					cancelevent()
					event.keyCode = 9;
				}
			} 
		} 
	} 
} 

function clickAddtoCartQuickOrder(e, buttonid,thebox)
{
	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; 
			} 
		} 
	} 
} 
//END function for addto cart

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();
}

