	/*<![CDATA[*/
/*
	function IEHoverPseudo() {

		var navItems = document.getElementById("primary-nav").getElementsByTagName("li");
		
		for (var i=0; i<navItems.length; i++) {
			if(navItems[i].className == "menuparent") {
				navItems[i].onmouseover=function() { this.className += " over"; }
				navItems[i].onmouseout=function() { this.className = "menuparent"; }
			}
		}

	}
	window.onload = IEHoverPseudo;
	window.onLoad=preloadNavImages();
*/
	/*]]>*/

function changestyle(objRow,className) {
	document.getElementById(objRow).className=className;
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document.getElementById(changeImages.arguments[i]).src = changeImages.arguments[i+1];
		}
	}
}

function flowOver(name) {
	changestyle("flow_"+name,"flow_"+name+"_fish");
}

function flowOff(name) {
	changestyle("flow_"+name,"flow_"+name);
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function preloadNavImages() {
	if (document.images) {
		nav_01_plan = newImage("/elements/images/flow/flow_01_plan_fish.jpg");
		nav_02_approve = newImage("/elements/images/flow/flow_02_approve_fish.jpg");
		nav_03_design = newImage("/elements/images/flow/flow_03_design_fish.jpg");
		nav_04_approve = newImage("/elements/images/flow/flow_04_approve_fish.jpg");
		nav_05_build = newImage("/elements/images/flow/flow_05_build_fish.jpg");
		nav_06_approve = newImage("/elements/images/flow/flow_06_approve_fish.jpg");
		nav_07_host = newImage("/elements/images/flow/flow_07_host_fish.jpg");
	}
}

var hasDom=true;

function disguise() {
    var ary=disguise.arguments;
    for(a=0;a<ary.length;a++) {
        var name=ary[a];
        if (hasDom) {
            var lyrStyle=document.getElementById("lyr_"+name).style;
            lyrStyle.display="none";
        }
    }
}

function reveal() {
	var ary=reveal.arguments;
    for(a=0;a<ary.length;a++) {
		var name=ary[a];
        if (hasDom) {
			var lyrStyle=document.getElementById("lyr_"+name).style;
			lyrStyle.display="block";
        }

    }
}

var preloadFlag = true;

	var set_name
	
	function show(name) {
		if ( set_name ) {
			disguise(set_name)
		}
		reveal(name)
		set_name=name
	}

	function hide(name) {
		disguise(name)
		set_name=null
	}

function updateBasket(id) {
	var qty = 0
	qty = document.getElementById('first_item_quantity_'+id).value
	
	updateBasketCore(id, qty);
}

function updateBasketCore(id, qty){
	
	
	//var searchstring=document.getElementById('search').value;
	var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object…
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
        var file = '/shopping_basket_contents.php?id='+id+'&qty='+qty; //This is the path to the file we just finished making *
	    xmlhttp.open('GET', file, true); //Open the file through GET, and add the page we want to retrieve as a GET variable **
	    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var content = xmlhttp.responseText; //The content data which has been retrieved ***
                if( content ){ //Make sure there is something in the content variable
                      document.getElementById('shopping_basket').innerHTML = content; //Change the inner content of your div to the newly retrieved content ****
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}

function removeItem(item) 
{
	//get the current quantity
	qty = document.getElementById(item).value;
	//decrease the quantity by 1 if not already 0
	qty -= 1;	
	//change the select box and hidden input
	document.getElementById(item).value = qty;
	document.getElementById('changeQuantities').value = 'changeQuantities';
	//submit the form using update basket
	document.go_shopping.submit();
}


function changeShopCategory(categoryID)
{
	//alert(categoryID);
	//put the cat id into the form
	document.shop_items.selected_category.value = categoryID;
	
	//alert("Element:"+document.getElementById('selected_category').value);
	
	//submit the form
	document.getElementById('shop_items').submit();
}

function doSubmit(command)
{
	document.getElementById('action').name = command;
	document.getElementById('action').value = command;
	//alert(document.getElementById('action').name);
	document.getElementById('shop_items').submit();
}



function setVisible(obj)
{
	obj = document.getElementById(obj);
	obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
    if (screen.width > '1024') {
    obj.style.left = "46%";
    } else  {
    obj.style.left = "43%";
    }
}

function createPopUp(popUpCode) { var div = document.createElement('div'); div.innerHTML = popUpCode; document.body.appendChild(div.firstChild); }
