/*
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
*/

function initRollovers() {
	if (!document.getElementById) return

	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_o'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);

			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;

			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}

			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

/*

	Use Javascript to open the browser in a new window instead of "_target" so it will validate against HTML 4 strict

*/

function externalLinks() {
if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
	var anchor = anchors[i];
		if (anchor.getAttribute("href") &&
			anchor.getAttribute("rel") == "external")
			anchor.target = "_blank";
	}
}

/*

	Load all functions

*/

function all(){
	initRollovers();
	externalLinks();
}
window.onload=all;


/*
function jumpMenu( form ) { 
		
	var newIndex1 = form.category1.selectedIndex;
	
	if ( newIndex1 == 0 ) {
		//alert( "Please select a category" );
	} else {
		
		
		//get the current URL. But test to see if which drop down is active
		if ( document.getElementById("category3") ) {
			var newIndex3 = form.category2.selectedIndex;
			if ( newIndex3 != 0 ) {
				cururl = document.getElementById("category3").value;
				alert("category 3 : " + cururl);
			}
		} else if ( document.getElementById("category2") ) {
			var newIndex2 = form.category2.selectedIndex;
			if ( newIndex2 != 0 ) {
				cururl = document.getElementById("category2").value;
				alert("category 2 : " + cururl);
			}
		} else {
			cururl = document.getElementById("category1").value;
			alert("category 1 : " + cururl);
		}
		
		
		//get the keywords
		var keyword = document.getElementById("keyword").value;
		
		cururl = cururl+"&keyword="+keyword;
		//alert(cururl);
		
		window.location.assign( cururl );
	}
	
} 
*/

function jumpMenu( form ) { 
	
	var keyword = document.getElementById("keyword").value;
	
	//If category 1 is active
	if ( document.getElementById("category1") ) {
		cururl = document.getElementById("category1").value;
		if ( cururl == "Search all" ) {
			cururl = "index.php?keyword="+keyword;
			window.location.assign( cururl );
			return;
		}
		
		
		//If category 2 is active
		if ( document.getElementById("category2") ) {
			cururl_2 = document.getElementById("category2").value;
			if ( cururl_2 == "Search all" ) {
				cururl = cururl+"&keyword="+keyword;
				window.location.assign( cururl );
				return;
			} else {
				cururl = cururl_2;
			}
			
			
			//If category 3 is active
			if ( document.getElementById("category3") ) {
				cururl_3 = document.getElementById("category3").value;
				if ( cururl_3 == "Search all" ) {
					cururl = cururl+"&keyword="+keyword;
					window.location.assign( cururl );
					return;
				} else {
					cururl = cururl_3;
				}
			} //end of category 3
		} //end of category 2
	}//end of category 1
	
	
	//For default relocation
	cururl = cururl+"&keyword="+keyword;
	window.location.assign( cururl );
	return;
	
	
}