//preload - http://www.htmlite.com/JS020.php

var myimages = new Array();

function preloading()
{
	for (x=0; x<preloading.arguments.length; x++)
	{
		myimages[x] = new Image();
		myimages[x].src = preloading.arguments[x];
	}
}

preloading(
	"http://www.speedqueenwa.com.au/images/buttons/enquiry_hover.gif",
	"http://www.speedqueenwa.com.au/images/buttons/our_company_hover.gif",
	"http://www.speedqueenwa.com.au/images/buttons/our_brands_hover.gif",
	"http://www.speedqueenwa.com.au/images/buttons/our_products_hover.gif",
	"http://www.speedqueenwa.com.au/images/buttons/our_services_hover.gif",
	"http://www.speedqueenwa.com.au/images/buttons/rent_finance_hover.gif",
	"http://www.speedqueenwa.com.au/images/buttons/home_hover.gif"
);

//end preload

var imageDir = './images/buttons/';

var imageName = new Array();
	imageName['01'] = 'enquiry';
	imageName['02'] = 'our_company';
	imageName['03'] = 'our_brands';
	imageName['04'] = 'our_products';
	imageName['05'] = 'our_services';
	imageName['06'] = 'rent_finance';
	imageName['07'] = 'home';

function changeImg(link)
{
	var x = link;
	var navItem = document.getElementById(x);

	navItem.src= imageDir + imageName[x] + '_hover.gif';
}

function changeImgBack(link)
{
	var x = link;
	var navItem = document.getElementById('m' + x);

	navItem.src= imageDir + imageName[x] + '.gif';
}

function buttonChangeImg(obj, imageTo) {
	var imageDir = './images/buttons/';
	var pos = obj.src.lastIndexOf('/');
	var currentImage = imageDir + obj.src.substr(pos + 1);
	imageTo = imageDir + imageTo;

	obj.src = imageTo;
}

function popUp(fileName, fWidth, fHeight)
{
	var n = fileName;
	var x = fWidth;
	var y = fHeight;

	return window.open(n, "", "width="+x+",height="+y+", scrollbars=no, toolbars=no");
}

$(function() {
	$('.sub_nav_buttons ul li, .nav ul li').bind('mouseover', function() {
		$(this).children('ul').show();
	});
	
	$('.sub_nav_buttons ul li, .nav ul li').bind('mouseout', function() {
		$(this).children('ul').hide();
	});
});
