/* ---------------------------------------------------------------------
COPYRIGHT LINCS MEDIA LTD. ALL RIGHTS RESERVED.
ALL CODE IS FULLY PROTECTED BY COPYRIGHT LAWS AND INTERNATIONAL TREATY
PROVISIONS AND IS CONSIDERED A TRADE SECRET BELONGING TO THE COPYRIGHT HOLDER.

ANY UNAUTHORIZED REPRODUCTION OR DISTRIBUTION OF THIS CODE IN PART
OR IN ITS ENTIRETY IS STRICTLY PROHIBITED.
----------------------------------------------------------------------*/

function check_option(product_id, loc)
{	
	if(product_id == '-')
	{
		alert('Please select an option from the menu.');
		document.getElementById("option").focus();
	}
	else
	{
		document.location = 'http://www.sportsbikeshop.co.uk/motorcycle_parts/' + loc + '/' + product_id;
	}
}

function search_submit()
{
	term = document.getElementById("search_term_head").value;

	if(term != '' && !isNaN(term))
	{
		document.location = 'http://www.sportsbikeshop.co.uk/motorcycle_parts/content_prod/' + term;
	}
	else
	{		
		document.location = 'http://www.sportsbikeshop.co.uk/motorcycle_parts/content_group/' + term;
	}
}

function openSignup(close)
{
	winWidth = 800;
	winHeight = 750;
	xPos = (screen.width - winWidth) / 2;
	yPos = 100;
	signUp = window.open('http://join.sportsbikeshop.co.uk','signup_window','toolbar=0,menubar=0,scrollbars=yes,scrolling=auto,status=0,resizable=0,top=' + yPos + ',left=' + xPos + ',width=' + winWidth + ',height=' + winHeight);
	signUp.blur();
	if(close == 'true')
	{
		signUp.window.close();
	}
	window.focus();
}

ns = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3));
ie = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4));

function openWindow(url, width, height, x, y)
{
	if ((ns))window.open(url,"displayWindow","toolbar=no,width=" + width + ",height=" + height + ",left=" + x + ",top=" + y + ",directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no");
	if ((ie))window.open(url,"displayWindow","type=fullWindow,toolbar=no,width=" + width + ",height=" + height + ",left=" + x + ",top=" + y + ",directories=no,status=no,scrollbars=yes,resizable=yes");
}

function sendQuery(loc)
{
	if(loc == 'home')
	{
		term = query_home.value.toUpperCase();
	}
	else
	{
		term = query.value.toUpperCase();
	}
	term = term.replace(' ', '+');
	loc = 'http://www.sportsbikeshop.co.uk/motorcycle_parts/login/' + term
	document.location = loc;
}

function showhide(layer_ref, label)
{
	if(document.getElementById)
	{
		hza = document.getElementById(layer_ref);
		if(hza.style.display == 'none')
		{
			state = 'block';
			new_label = 'View Less';
			new_class = 'less';
		}
		else
		{
			state = 'none';
			new_label = label;
			new_class = 'more';
		}
		hza.style.display = state;
		
		if(layer_ref.substr(0, 5) == 'more_')
		{
			document.getElementById(layer_ref + '_link').innerHTML = new_label;
		}
	}
}

function favorites()
{
	logFav = new Image();
	logFav.src = "http://www.sportsbikeshop.co.uk/bookmark.php";
	
	var url = 'http://www.sportsbikeshop.co.uk/#BOOKMARK';
	var title = 'SPORTSBIKESHOP';
	
	if(window.sidebar)
	{
		window.sidebar.addPanel(title, url, "");
	}
	else if( window.external )
	{
		window.external.AddFavorite( url, title);
	}
	else if(window.opera && window.print)
	{
		return true;
	}
}


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";
		}
	}   
}
