function openWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}
function showHide(obj) {
	var newObject = document.getElementById(obj);
	if(newObject.className == "show"){
		newObject.className = "hideitem";
	}else{
		newObject.className = "show";
	}
}

function bookmarkPage(title, url){
	if (document.all)
	window.external.AddFavorite(url, title);
	else if (window.sidebar)
	window.sidebar.addPanel(title, url, "");
}


function do_onload(){
    // This gets the first element
    // in the subnavcontainer
    var content=document.getElementById("tabcontainer");
    if(content) {
    cdiv=content.getElementsByTagName("div");

    var cookievalue = readCookie(cookiename);
    var tablink = document.getElementById(cookievalue+'-link');
    if(cookievalue && tablink) {
        var tablink = document.getElementById(cookievalue+'-link');
        expandcontent(cookievalue, tablink);
    } else {
        expandcontent(cdiv[0].id, tabobjlinks[initialtab[0]-1]);
    }
    }
}

// if (window.addEventListener)
// window.addEventListener("load", do_onload, false)
// else if (window.attachEvent)
// window.attachEvent("onload", do_onload)
// else if (document.getElementById)
// window.onload=do_onload

function checkWeHaveQuantity(submitBtn) {
	var myform = submitBtn.getParent("form");
	var mySelects = myform.getElements("select");
	
	if(!myform) return false;
	if(!mySelects || !mySelects.length) return false;
	
	var isValid = true; 
	//mySelects.each(function(el){
	var c = mySelects.length;
	for(var i = 0; i < c; i++) {
		var myValue = mySelects[i].get("value");
		if(myValue.clean() == "" || myValue.clean() < 1 ) {
			isValid = false;
		} else{
			isValid = true;
			break
		} 
	}
	if(isValid == false) {
		alert("Please select a quantity to add to basket");
	}
	
	return isValid;
}

