function helpPop(id)
{
	var popurl="help.jsp?id=" + id 
	winpops=window.open(popurl,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=500");
}

function open_window(newwin, width, height) {	
	flyout=window.open(newwin, "popup_sizing", "width=" + width + ",height=" + height + ",menubar=no,toolbar=no,resizeable=no,status=no,scrollbars=yes,center=1");
	flyout.focus();
}

var clicked = false;

function postPage(qs){	
	
	if (clicked != true){
		document.ItemForm.action = qs;
		clicked = true;		
		document.ItemForm.submit();				
	}
}

function processSubmit(form){	
	document["subImg"].src = "i/processing.gif"; ;
	document.getElementById("subHref").href = "#submit";	
   	form.submit();
}

function setSelectedItem(svalue){		
	document.ItemForm.o.options[svalue].selected = true;	
}

function calcPrice(){
	var selectedItem = document.ItemForm.PriceBox.selectedIndex;
	var qty = document.ItemForm.PriceBox.options[selectedItem].text;
	var unitPrice = document.ItemForm.PriceBox.options[selectedItem].value;	
	var totalPrice = qty * unitPrice;
	totalPrice = totalPrice.toFixed(2);
	document.ItemForm.itemPrice.value = totalPrice;
	document.ItemForm.itemQty.value = qty;

}

function formatCurrency(price){
	var fPrice = 0.00;	
	fPrice = price.toFixed(2);
	document.write(fPrice);
}

function reSort(qs,obj){	
	var sortId;	
	sortId = obj.value;			
	qs = qs + sortId
	document.ItemForm.action = qs;		
	document.ItemForm.submit();				
	
}

function refresh(page){
	window.location = page;		
}

function changePicture(picture,altText,dropIndex){	
	document["itemImage"].src = picture;
	document.getElementById("itemLink").href = picture;		
	var sizeCode = getCheckedRadio(document.ItemForm.size).value;
	if (dropIndex != null){
		document.ItemForm.color[dropIndex].checked = true;	
		getSizeData(document.ItemForm.product.value , document.ItemForm.color[dropIndex].value);
		document["itemImage"].title = document.ItemForm.color[dropIndex].label;
	}
	if (altText != "" && altText != null){
		document["itemImage"].title = altText;
	}
	setCheckedRadio(document.ItemForm.size,sizeCode);
}

function change_image(dropdown, productCode) {
	//Used for Select Boxes
	//document["itemImage"].src =  escape(dropdown.options[dropdown.selectedIndex].id);
	//document["itemImage"].title= dropdown.options[dropdown.selectedIndex].text;
	//document.getElementById("itemLink").href = "../" + escape(dropdown.options[dropdown.selectedIndex].id) + "";	
	
	//Use for Radio Buttons	
	document["itemImage"].src = dropdown.id;
	document["itemImage"].title = dropdown.label;
	document.getElementById("itemLink").href = dropdown.id;
		
	var colorCode = dropdown.value;
	if (productCode != null && colorCode != null) {
		getSizeData(productCode , colorCode);
	}	
	
}

function setCheckedRadio(radioObj,radioValue){
	var radioLength = radioObj.length;
	var disabled = false;
	for(var i = 0; i < radioLength; i++) {		
		if (radioObj[i].value == radioValue){			
			if (radioObj[i].disabled == true){				
				disabled = true;
			} else {
				radioObj[i].checked = true;
			}
		}
	}
	if (disabled){
		for(var i = 0; i < radioLength; i++) {
			if (radioObj[i].disabled == false){
				radioObj[i].checked = true;
				break;
			}
		}
	}
}

function getCheckedRadio(radioObj) {	
	if(!radioObj){			
		return "";
	}
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked){						
			return radioObj;
		}else{		
			radioObj.checked = true;				
			return radioObj;
		}
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i];
		}
	}
	radioObj[0].checked = true;			
	return radioObj[0];
}

function highlightTerm(){
	var anchorID = location.hash;
	if (anchorID != ""){
		anchorID = anchorID.replace(/(#)/g,"");	
		document.getElementById(anchorID).style.color = "#FF0000";	
	}
}

function protectmail(name,address,style,subject) {
	document.write('<a class="' + style + '" href=mailto:' + name + '@' + address + '?subject=' + subject + '>' + name + '@' + address + '</a>');
}

function bookmarksite(title,url){
if (window.sidebar) // firefox
window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
var elem = document.createElement('a');
elem.setAttribute('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();
}
else if(document.all)// ie
window.external.AddFavorite(url, title);
}

