function addBookmark() {
  if (window.external)
    external.AddFavorite(location.href)
  else
    alert("Your browser doesn't support this feature.");
}

function createWindow(cUrl,cName,cFeatures) {
	var xWin = window.open(cUrl,cName,cFeatures)
}

function closeWindow() {
	window.close()
}


var valuesArr = new Array;
var textArr = new Array;

function autosuggest(oTextBox, arrValues, arrText, sListBoxId) {
	var oListBox = document.getElementById(sListBoxId);
	var arrResult = new Array;
	var arrResultValues = new Array;
	var sText = oTextBox.value;
	var text;
	var compare;
	if(sText != "") {
		compare = sText.toLowerCase();
		for(var i=0; i<arrText.length; i++) {
			text = arrText[i].toLowerCase();			
			if(text.indexOf(compare) == 0) {
				arrResult.push(arrText[i]);
				arrResultValues.push(arrValues[i]);
			}
		}
	} else {
		oListBox.style.display = 'none';
	}
	
	if(arrResult.length != 0) {
		clear(oListBox);
		oListBox.style.display = 'block';  
		for( var j=0; j<arrResult.length; j++) {
			oListBox.options[j] = new Option(arrResult[j], arrResultValues[j], true);
		}
		oListBox.size = oListBox.length + 1;
		oListBox.selectedIndex = -1;
	} else {
		clear(oListBox);
	}
}

function clear(oListBox) {
	if(oListBox.options != null) {
		for(var i=oListBox.options.length-1; i >=0; i--) {
			oListBox.remove(i);
		}
	}
}

function setText(oListBox, sTextBoxId, sHiddenId) {
	var oTextBox = document.getElementById(sTextBoxId);
	var oHidden = document.getElementById(sHiddenId)
	
	if(oListBox.selectedIndex > -1) {
		oTextBox.value = oListBox.options[oListBox.selectedIndex].text;
		oHidden.value = oListBox.options[oListBox.selectedIndex].value;
		oListBox.style.display='none';  
		oTextBox.focus();  
	}
}

function checkCookies(oEvent) {
	var cookieEnabled=(navigator.cookieEnabled)? true : false

	//if not IE4+ nor NS6+
	if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled){ 
		document.cookie="testcookie"
		cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)? true : false
	}
	
	if (!cookieEnabled) {//if cookies are enabled on client's browser
		alert("Sorry, your browser needs to have cookies activated.");
		 var e = oEvent || window.event; 
		 e.cancelBubble = true; 
		 if (e.stopPropagation) e.stopPropagation(); 
		 return false;
	} 
}
var cartWindow;
function newWindow()
{cartWindow=window.open('','cartwin',config='height=650, width=770, toolbar=no, menubar=no, resizable=no, location=no, directories=no, status=yes, scrollbars=yes');
cartWindow.focus();}
function newPrintWindow()
{cartWindow=window.open('','printwin',config='height=650, width=770, left=50, top=50, toolbar=no, menubar=no, resizable=no, location=no, directories=no, status=yes, scrollbars=yes');
cartWindow.focus();}

function doGoto(sSelectId) {
	var oSelectBox = document.getElementById(sSelectId);
	var iSelected = oSelectBox.selectedIndex;
	if (iSelected > 0)
	{
		var url = oSelectBox[iSelected].value;
		//alert("we have value" + url);
		if(navigator.userAgent.indexOf("Firefox") != -1)
		{
		   window.location = url;
		}
		else
		{
			document.URL = url;
		}
		return true;
	}
}