	/*<![CDATA[*/
	function IEHoverPseudo() {

		var navItems = document.getElementById("primary-nav").getElementsByTagName("li");
		
		for (var i=0; i<navItems.length; i++) {
			if(navItems[i].className == "") {
				navItems[i].onmouseover=function() { this.className += " over"; }
				navItems[i].onmouseout=function() { this.className = "menuparent"; }
			}
		}

	}
	/*window.onload = IEHoverPseudo;*/
	
	/*]]>*/
	
	
sfHover = function() {
	var sfEls = document.getElementById("navlist").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

/*window.onload = sfHover;*/


function addLoadEvent(func) { 
	var oldonload = window.onload; 
	if (typeof window.onload != 'function') { 
		window.onload = func; 
	} else { 
		window.onload = function() { 
			  if (oldonload) { 
			    oldonload(); 
			  } 
			  func(); 
		} 
	} 
} 
/*
addLoadEvent(IEHoverPseudo);
addLoadEvent(sfHover);
*/
window.onload = IEHoverPseudo; 



var preloadFlag = true;

function changestyle(objRow,className) {
	document.getElementById(objRow).className=className;
}

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 changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var hasDom=true;
var hasAll=document.all;
var hasNSDom=document.layers;

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";
        }

    }
}

function clearText(theField) {
   if (theField.defaultValue == theField.value)
   theField.value = '';
}

function addText(theField) {
   if (theField.value == '')
   theField.value = theField .defaultValue;
}











setActiveStyleSheet('');
function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}
function getActiveStyleSheet() {
var i, a;
 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
  if(a.getAttribute("rel").indexOf("style") != -1
  && a.getAttribute("title")
  && !a.disabled) return a.getAttribute("title");
  }
  return null;
}




/* Ultimater's edited version of:
   http://jibbering.com/2002/4/httprequest.html
   to serve IE7 with XMLHttpRequest instead of ActiveX */

var xmlhttp=false;
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 	try {
 		 xmlhttp = new XMLHttpRequest();
 	} catch (e) {
 		 xmlhttp=false;
 	}
}

// Don't delete this, back supports IE
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
if (!xmlhttp){
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
}
@end @*/

if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

// Display the appraisal popup
function submitAppraisal() {
	show('apprasial_map')
	open_url('appraisal_window.php?apid='+document.download_apprasial.appraisal_id.value+'&popup=map','lyr_apprasial_map')
	hide_popup_remove_gray('appraisals_popup_div','appraisals_gray_div')
}

/* Ultimater's edited version of:
   http://javascript.internet.com/ajax/ajax-navigation.html */

//var please_wait = "Please wait...";
var please_wait = " ";

function open_url(url, targetId) {
  if(!xmlhttp)return false;
    var e=document.getElementById(targetId);if(!e)return false;
    
    var d = new Date();
	var tm=d.getDate() + d.getHours() + d.getMinutes() + d.getMilliseconds();
	// Check to see if there is a ? in the url, then add a timestamp
	if ( url.search(/\?/)<0 ) { url += '?tm='+tm	 }
	else { url += '&tm='+tm }
    
    if(please_wait)e.innerHTML = please_wait;
    xmlhttp.open("GET", url, true);
    xmlhttp.onreadystatechange = function() { response(url, e); }
    try{
      xmlhttp.send(null);
    } catch(l) {
    while(e.firstChild)e.removeChild(e.firstChild);//e.innerHTML="" the standard way
    e.appendChild(document.createTextNode("request failed"));
  }
  
}

function response(url, e) {
  if(xmlhttp.readyState != 4)return;
    var tmp= (xmlhttp.status == 200 || xmlhttp.status == 0) ? xmlhttp.responseText : "Ooops!! A broken link! Please contact the webmaster of this website ASAP and give him the following error code: " + xmlhttp.status+" "+xmlhttp.statusText;
    var d=document.createElement("div");
    d.innerHTML=tmp;
    setTimeout(function(){
      while(e.firstChild)e.removeChild(e.firstChild);//e.innerHTML="" the standard way
      e.appendChild(d);
    },10)
}


function callRemotePage(url) {

	xmlhttp.open("GET",url, true);
  	xmlhttp.send(null);

}




var preloadFlag = true;

function updateBasket(id,view_type,item_format,close_link){
	//prompt the adding item to cart
	if ( window.confirm("Do you want to add this item to your shopping basket?") ) {
		
		//check if any shop item extra fields have been added to this item that need to be selected/passed through in url
		var i=1;
		var shop_field_url="";
		var get_shop_item_extra_fields = false;
		var add_item_to_cart = true;
		var elm = "";
		
		//alert(shop_field_url);
		//alert(get_shop_item_extra_fields);
		
		while (get_shop_item_extra_fields == true){
			elm = document.getElementById("shop_item_extra_field_"+id+"_"+i)
			//alert("shop_item_extra_field_"+id+"_"+i);
			//alert(elm);
			//check the element exists
			if(elm != null){
				//element exists, check to see if a value has been selected
				if(elm.value != ""){
					//add value to url
					shop_field_url = shop_field_url+"&shop_item_extra_field_"+i+"="+elm.value;
					//alert(shop_field_url);
				}else{
					//pronpt user to select value
					alert("Please select a "+elm.name);
					get_shop_item_extra_fields = false;
					add_item_to_cart = false;
				}
			}else{
				get_shop_item_extra_fields = false;
			}
			i++;
		}
		
		//alert(shop_field_url);
		//alert(get_shop_item_extra_fields);
		
		if(add_item_to_cart == true){
			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+'&item_format='+item_format+shop_field_url; //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
		    hide(close_link);
		    return;
		}
		
	}
}


	var hasDom=true;
	var hasAll=document.all;
	var hasNSDom=document.layers;

	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 set_name
	
	function show(name) {
		if ( set_name ) {
			disguise(set_name)
		}
		reveal(name)
		set_name=name
	}

	function hide(name) {
		disguise(name)
		set_name=null
	}
	
var curNum = 1;	
function nextResult	( num ) {
	disguise('result_'+curNum)
	reveal('result_'+num)
	curNum=num
}


function view_checkout() {

	if ( window.confirm("Do you want to proceed to the checkout now?") ) {
		//window.location=url
		window.location="/shopping-basket/"
	}

}

