
var run = false;

if(self.location != top.location)
	top.location = self.location.href;

jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	{
		jQuery("<img>").attr("src", arguments[i]);
	}
}

$(document).ready(function(){
	
	$('.rollover').each(function(item) { 
		$.preloadImages($(this).attr('hover'));
	});
	
	$('.rollover').hover(function() {
		var currentImg = $(this).find('img').attr('src'); 
		$(this).find('img').attr('src', $(this).attr('hover')); 
		$(this).attr('hover', currentImg); 
	}, function() {
		var currentImg = $(this).find('img').attr('src'); 
		$(this).find('img').attr('src', $(this).attr('hover')); 
		$(this).attr('hover', currentImg);
	});
	
});

function JS_EmailLink(user, domain, suffix, att) {
	
	if(att == null)
		att = "";
	
	document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '" ' + att + '>' + user + '@' + domain + '.' + suffix + '</a>');
}

function JS_EmailImageMap(user, domain, suffix, shape, coords, att) {
	
	if(att == null)
		att = "";
	
	document.write('<area shape="' + shape + '" coords="' + coords + '" href="mailto:' + user + '@' + domain + '.' + suffix + '" alt="' + user + '@' + domain + '.' + suffix + '" ' + att + '>');
}

function AddToCart(form, minOrder) {
	
	var qty = parseInt(form.Qty.value);
	if(qty < minOrder) {
		alert("You must enter a quantity more than the minimal amount");
		form.Qty.select();
		return false;
	}
	
	return true;
	
}
