// Script for menu rollovers
m1on 	  = new Image(0,0);
m1on.src  = "http://www.hyosungbikes.co.uk/images/topmenu_range-on.gif";
m1off     = new Image(0,0);
m1off.src = "http://www.hyosungbikes.co.uk/images/topmenu_range.gif";
m2on 	  = new Image(0,0);
m2on.src  = "http://www.hyosungbikes.co.uk/images/topmenu_buy-on.gif";
m2off     = new Image(0,0);
m2off.src = "http://www.hyosungbikes.co.uk/images/topmenu_buy.gif";
m3on 	  = new Image(0,0);
m3on.src  = "http://www.hyosungbikes.co.uk/images/topmenu_dealer-on.gif";
m3off     = new Image(0,0);
m3off.src = "http://www.hyosungbikes.co.uk/images/topmenu_dealer.gif";
m4on 	  = new Image(0,0);
m4on.src  = "http://www.hyosungbikes.co.uk/images/topmenu_media-on.gif";
m4off     = new Image(0,0);
m4off.src = "http://www.hyosungbikes.co.uk/images/topmenu_media.gif";
m5on 	  = new Image(0,0);
m5on.src  = "http://www.hyosungbikes.co.uk/images/topmenu_contact-on.gif";
m5off     = new Image(0,0);
m5off.src = "http://www.hyosungbikes.co.uk/images/topmenu_contact.gif";
m15on 	  = new Image(0,0);
m15on.src  = "http://www.hyosungbikes.co.uk/images/topmenu_home-on.gif";
m15off     = new Image(0,0);
m15off.src = "http://www.hyosungbikes.co.uk/images/topmenu_home.gif";

m6on 	  = new Image(0,0);
m6on.src  = "http://www.hyosungbikes.co.uk/images/front_menu_range-on.gif";
m6off     = new Image(0,0);
m6off.src = "http://www.hyosungbikes.co.uk/images/front_menu_range.gif";
m7on 	  = new Image(0,0);
m7on.src  = "http://www.hyosungbikes.co.uk/images/front_menu_buy-on.gif";
m7off     = new Image(0,0);
m7off.src = "http://www.hyosungbikes.co.uk/images/front_menu_buy.gif";
m8on 	  = new Image(0,0);
m8on.src  = "http://www.hyosungbikes.co.uk/images/front_menu_dealer-on.gif";
m8off     = new Image(0,0);
m8off.src = "http://www.hyosungbikes.co.uk/images/front_menu_dealer.gif";
m9on 	  = new Image(0,0);
m9on.src  = "http://www.hyosungbikes.co.uk/images/front_menu_accessories-on.gif";
m9off     = new Image(0,0);
m9off.src = "http://www.hyosungbikes.co.uk/images/front_menu_accessories.gif";

m10on 	  = new Image(0,0);
m10on.src  = "http://www.hyosungbikes.co.uk/images/shop_menu_range-on.gif";
m10off     = new Image(0,0);
m10off.src = "http://www.hyosungbikes.co.uk/images/shop_menu_range.gif";
m11on 	  = new Image(0,0);
m11on.src  = "http://www.hyosungbikes.co.uk/images/shop_menu_buy-on.gif";
m11off     = new Image(0,0);
m11off.src = "http://www.hyosungbikes.co.uk/images/shop_menu_buy.gif";
m12on 	  = new Image(0,0);
m12on.src  = "http://www.hyosungbikes.co.uk/images/shop_menu_accessories-on.gif";
m12off     = new Image(0,0);
m12off.src = "http://www.hyosungbikes.co.uk/images/shop_menu_accessories.gif";
m13on 	  = new Image(0,0);
m13on.src  = "http://www.hyosungbikes.co.uk/images/shop_menu_dealer-on.gif";
m13off     = new Image(0,0);
m13off.src = "http://www.hyosungbikes.co.uk/images/shop_menu_dealer.gif";
m14on 	  = new Image(0,0);
m14on.src  = "http://www.hyosungbikes.co.uk/images/shop_menu_home-on.gif";
m14off     = new Image(0,0);
m14off.src = "http://www.hyosungbikes.co.uk/images/shop_menu_home.gif";

function imgOn(imgName)
{
	img = eval(imgName + "on.src");
	document[imgName].src = img;
}

function imgOff(imgName)
{
	img = eval(imgName + "off.src");
	document[imgName].src = img;
}


// Script to pop up dealer search results 
function popupform(dealersearch, windowname)
{
	if (!window.focus) return true;
	window.open('', windowname, 'height=400,width=600,scrollbars=yes');
	dealersearch.target=windowname;
	return true;
}


// Script to pop up zoomed images

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}


// Script to ask for confirmation when the 'Delete' button has been pressed
function confirmDelete()
{
var agree=confirm("ARE YOU SURE YOU WANT TO PERMANENTLY DELETE THIS FILE?");
if (agree)
	return true ;
else
	return false ;
}


// Script for colour changes in Product Range
var IE=document.all;
var NS6=document.getElementById;
var OPERA=navigator.userAgent.match("Opera");

function changeColour(imageIndex,newFilename)
{                                            
	newImage=new Image(0,0);
	newImage.src=newFilename;
	                                            
	document[imageIndex].src=newImage.src;
}

function checkForm()
{
	var mailval=document.contactform.email.value;
	var nameval=document.contactform.fullname.value;
	var telval=document.contactform.telephone.value;
	var val1=true, val2=true, val3=true;
	
	document.styleSheets[0].rules[0].style.color="black";
	document.styleSheets[0].rules[1].style.color="black";
	document.styleSheets[0].rules[2].style.color="black";
	
	if(nameval=="")
	{
		document.styleSheets[0].rules[0].style.color="red";
		val2=false;
	}
	
	if(!mailval.match(/\S+\@\S+\.\S+/))
	{
		document.styleSheets[0].rules[1].style.color="red";
		val1=false;
	}
	
	if(telval=="")
	{
		document.styleSheets[0].rules[2].style.color="red";
		val3=false;
	}
	
	if((val1==false)||(val2==false)||(val3==false)) returnval=false
	else
		returnval=true;
		
	return returnval;
}

function checkOrder()
{

	var titleval=document.orderform.salutation.value;
	var nameval=document.orderform.fullname.value;
	var telval=document.orderform.telephone.value;
	var mailval=document.orderform.email.value;
	var addressval=document.orderform.address.value;
	var postcodeval=document.orderform.postcode.value;
	var partexval=document.orderform.partex.value;	
	var paymentval=document.orderform.payment.value;
	var returnval=true;
	
	document.styleSheets[0].rules[8].style.color="black";
	document.styleSheets[0].rules[0].style.color="black";
	document.styleSheets[0].rules[2].style.color="black";
	document.styleSheets[0].rules[1].style.color="black";
	document.styleSheets[0].rules[3].style.color="black";
	document.styleSheets[0].rules[4].style.color="black";
	document.styleSheets[0].rules[5].style.color="black";
	document.styleSheets[0].rules[7].style.color="black";

	if(titleval=="")
	{
		document.styleSheets[0].rules[8].style.color="red";
		returnval=false;
	}

	if(nameval=="")
	{
		document.styleSheets[0].rules[0].style.color="red";
		returnval=false;
	}
	
	if(telval=="")
	{
		document.styleSheets[0].rules[2].style.color="red";
		returnval=false;
	}
	
	if(!mailval.match(/\S+\@\S+\.\S+/))
	{
		document.styleSheets[0].rules[1].style.color="red";
		returnval=false;
	}

	if(addressval=="")
	{
		document.styleSheets[0].rules[3].style.color="red";
		returnval=false;
	}
	
	postcodeval=postcodeval.toUpperCase();
	if(!postcodeval.match(/([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$/))
	{
		document.styleSheets[0].rules[4].style.color="red";
		returnval=false;
	}
	
	if(partexval=="")
	{
		document.styleSheets[0].rules[5].style.color="red";
		returnval=false;
	}

	if(paymentval=="")
	{
		document.styleSheets[0].rules[7].style.color="red";
		returnval=false;
	}
	
	return returnval;
}

function checkColour()
{
	var colourval=document.buyonline.colour_choice.value;
	var val1=true;
	
	document.styleSheets[0].rules[9].style.color="black";
	
	if(colourval=="")
	{
		document.styleSheets[0].rules[9].style.color="red";
		val1=false;
	}
	
	if(val1==false) returnval=false
	else
		returnval=true;
		
	return returnval;
}
