// JavaScript Document
<!--
application = navigator.appName;

function contactUs()
{
	newWindow = window.open("contact.asp","newwindow","width=550,height=520,scrollbars=none");
	newWindow.focus();
}
function footerContent( content )
{
	jQuery(".footerContent").fadeOut(300);
	jQuery("#"+content).fadeIn(300);
	jQuery("#"+content).bind("click",function()
		{
			jQuery(this).fadeOut(300);
		}
	);
}

function sendToFriend(options)
{
	newWindow = window.open("sendtofriend.asp?linkto="+escape(window.location.href+"&modeloptions="+options),"newwindow","width=350,height=320,scrollbars=none");
	newWindow.focus();
}

function checkSaveForm( formObject )
{
	returnState = false;
	frmName = formObject.oName.value;
	frmEmail = formObject.oEmail.value;
	var validExp = /^.+\@.+\..+$/
	
	jQuery( ".failedCheck" , formObject).remove();
	if (frmName == "")
	{
		jQuery(formObject.oName)
			.after("<div class='failedCheck'><span>Please enter your name</span></div>")
			.next().fadeIn(300);
	}
	if (!(validExp.test(frmEmail)))
	{
		jQuery(formObject.oName)
			.after("<div class='failedCheck'><span>Please enter a valid email address</span></div>")
			.next().fadeIn(300);
	}
	
	if (validExp.test(frmEmail) && frmName !== "")
	{
		returnState = true;	
	}
	return returnState;
}

function gotoSaveDetails()
{
	if ( application == "Netscape")
	{
		// if firefox do this
		$('.summaryFormDetails').slideUp(500);
		$('#summaryDetails').slideUp(1000, function()
			{
				$('#summarySaveDetails').slideDown(1000, function()
					{
						var targetOffset = $("#summarySaveDetails").offset().top;
						$('html').animate({scrollTop: targetOffset}, 1000);
					}
				);
			}
		);
	}
	else
	{
		$('#summaryDetails').hide();
		$('.summaryFormDetails').hide();
		$('#summarySaveDetails').show();
	}
	// else ie is rubbish so do this
}
function gotoUserDetails()
{
	if ( application == "Netscape")
	{
		// if firefox do this
		$('.summaryFormDetails').slideUp(500);
		$('#summaryDetails').slideUp(1000, function()
			{
				$('#summaryUserDetails').slideDown(1000, function()
					{
						var targetOffset = $("#summaryUserDetails").offset().top;
						$('html').animate({scrollTop: targetOffset}, 1000);
					}
				);
			}
		);
	}
	else
	{
	// else ie is rubbish so do this
		$('#summaryDetails').hide();
		$('.summaryFormDetails').hide();
		$('#summaryUserDetails').show();
	}
}
function gotoOrderDetails()
{
	$('#summaryDetails').slideToggle(1000);
}

function imageHover(imgObj) {
	fileSrc = imgObj.src.substring(0,imgObj.src.lastIndexOf("."))
	fileExt = imgObj.src.substring(imgObj.src.lastIndexOf("."),imgObj.src.length)
	imgObj.src = fileSrc + "_h" + fileExt;
}

function imageOut(imgObj) {
	fileSrc = imgObj.src.substring(0,imgObj.src.lastIndexOf("_h"))
	fileExt = imgObj.src.substring(imgObj.src.lastIndexOf("_h")+2,imgObj.src.length)
	imgObj.src = fileSrc + fileExt;
}

function modelInfo(obj) {
	$('.infoTablet').find(".content").find("b:first").html($(obj).next().find("b:first").html());
	$('.infoTablet').find(".content").find(".modelInfo").html($(obj).next().find(".modelInfo").html());
	$('.infoTablet').find(".content").find(".rangeSpecs").html($(obj).next().find(".rangeSpecs").html());
	//$('.infoTablet').css("visibility","visible");
	$('.infoTablet').fadeIn(500);
	$('html').animate({scrollTop: 0}, 1000);
}

function selectModel(mID) {
	window.location.href = window.location.href.replace(/page=2/g,"page=3") + "&model=" + mID;
}

var rotateImages = ({ 
	init: function(options) {
		this.holder = options["holder"];
		this.fadeTime = options["fade"];
		this.waitTime = options["display"];
		this.images = $(this.holder).find("img");
		this.imagecount = this.images.length - 1;
		this.current = this.imagecount;
		this.reset();
	},
	wait: function() {
		if (this.imagecount > 1) {
			eval("setTimeout('rotateImages.next()'," + this.waitTime + ")");
		}
	},
	next: function() {
		$(this.images[this.current]).fadeOut(this.fadeTime, function(){ 
			rotateImages.current--;
			if (rotateImages.current > 0) {
				rotateImages.wait();
			} else {
				eval("setTimeout('rotateImages.reset()'," + rotateImages.waitTime + ")");
			}
		});
	},
	reset: function() {
		this.current = this.imagecount;
		$(this.images[this.current]).fadeIn(this.fadeTime, function(){
			$(rotateImages.images).each(function(index){
				$(rotateImages.images[index]).show();
			});
			rotateImages.wait();
		});
	}
});

//-->