// JavaScript Document
function addToOnLoad(newFunc){
	var oldonload = window.onload;
	if(typeof window.onload != 'function'){
		window.onload =  newFunc;
	} else {
		window.onload = function(){
			oldonload();
			newFunc();
		}
	}
}
function highlightRows(){
		if(!document.getElementsByTagName) return false;
			var rows = document.getElementsByTagName("tr");
						for (var i=0; i<rows.length; i++){
						if(rows[i].className=="hoverRow"){							
									rows[i].onclick = function() {
												var links = this.getElementsByTagName("a");
												window.location.href=links[0].href;
									}
									rows[i].onmouseover = function() {
									this.style.backgroundColor = "#000000";
									this.style.cursor = "hand";									
									image=this.getElementsByTagName("img");
							}
							rows[i].onmouseout = function() {
									if(this.className=="hoverRow"){
									this.style.backgroundColor = "#110E08";
									}
							}
						}
						}
	
}
function highlightDivs(){
		if(!document.getElementsByTagName) return false;
			var rows = document.getElementsByTagName("div");
						for (var i=0; i<rows.length; i++){
						if(rows[i].className=="product_inner"){							
									rows[i].onclick = function() {
												var links = this.getElementsByTagName("a");
												window.location.href=links[0].href;
									}
									rows[i].onmouseover = function() {
									this.style.backgroundColor = "#000000";
									this.style.cursor = "hand";									
									image=this.getElementsByTagName("img");
							}
							rows[i].onmouseout = function() {
									if(this.className=="product_inner"){
									this.style.backgroundColor = "#110E08";
									}
							}
						}
						}
	
}
addToOnLoad(highlightRows);
addToOnLoad(highlightDivs);

function addWrapping(){
	document.location.href='wrapping.php?action=update'
}
function loyaltySignup(){
	document.location.href='loyalty.php?action=update'
}
function saveWarning(){
	document.getElementById('warning_message').innerHTML='<p><strong style=\"color: red;\">Click \'update basket\' to save your message!</strong></p>'
}
