// Slide show and random quotes //
var $interval_time=5000;
var $quote_count=4;
//var $quote_count=$j('.quote-text div').size();
var $random_number=Math.floor(Math.random()*$quote_count+1);
var $random_quote='#quote_'+$random_number;

function slideSwitch() {
	var $active = $j('#slideshow img.active');

	if ( $active.length == 0 ) $active = $j('#slideshow img:last');

	var $next =  $active.next().length ? $active.next()
		: $j('#slideshow img:first');

	$active.addClass('last-active');

	$next.css({opacity: 0.0})
		.addClass('active')
		.animate({opacity: 1.0}, 1000, function() {
			$active.removeClass('active last-active');
		});
}

$j(function() {
	setInterval( "slideSwitch()", $interval_time );
	$j($random_quote).removeClass('no-display');
});

// Validation for booking form //
function validate_form(thisform){
	with (thisform){
		if (validate_required(fname,"Please enter your name.")==false)
			{fname.focus();return false;}
			
		if (validate_required(lname,"Please enter your name.")==false)
			{lname.focus();return false;}
			
		if (validate_required(email,"Email must be filled out!")==false)
			{email.focus();return false;}
			
		if (validate_email(email,"Not a valid email address!")==false)
			{email.focus();return false;}
			
		if (validate_model(model,"Please select the model.")==false)
			{model.focus();return false;}
			
		if (validate_required(serial,"Please enter a serial number.")==false)
			{serial.focus();return false;}
	}
}

function validate_required(field,alerttxt){
	with (field){
		if (value==null||value=="")
			{alert(alerttxt);return false;}
		else {return true;}
	}
}

function validate_email(field,alerttxt){
	with (field){
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2)
			{alert(alerttxt);return false;}
		else {return true;}
	}
}

function validate_model(field,alerttxt){
	with (field){
		if (selectedIndex==0 )
			{alert(alerttxt);return false;valid = false;}
		else {return true;}
	}
}

// Codes used in booking form //
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('3(7.X){7["R"+a]=a;7["z"+a]=6(){7["R"+a](7.1k)};7.X("1e",7["z"+a])}E{7.19("z",a,15)}2 j=H V();6 a(){2 e=q.1d("1a");3(e){o(e,"P");2 N=B(q,"*","14");3((e.12<=10)||(N=="")){c(e,"P",d)}}4=B(q,"*","1n");k(i=0;i<4.b;i++){3(4[i].F=="1g"||4[i].F=="1f"||4[i].F=="1c"){4[i].1b=6(){r();c(v.5.5,"f",d)};4[i].O=6(){r();c(v.5.5,"f",d)};j.D(j.b,0,4[i])}E{4[i].O=6(){r();c(v.5.5,"f",d)};4[i].18=6(){o(v.5.5,"f")}}}2 C=17.16.13();2 A=q.M("11");3(C.K("J")+1){c(A[0],"J",d)}3(C.K("I")+1){c(A[0],"I",d)}}6 r(){k(2 i=0;i<j.b;i++){o(j[i].5.5,"f")}}6 B(m,y,w){2 x=(y=="*"&&m.Y)?m.Y:m.M(y);2 G=H V();w=w.1m(/\\-/g,"\\\\-");2 L=H 1l("(^|\\\\s)"+w+"(\\\\s|$)");2 n;k(2 i=0;i<x.b;i++){n=x[i];3(L.1j(n.8)){G.1i(n)}}1h(G)}6 o(p,T){3(p.8){2 h=p.8.Z(" ");2 U=T.t();k(2 i=0;i<h.b;i++){3(h[i].t()==U){h.D(i,1);i--}}p.8=h.S(" ")}}6 c(l,u,Q){3(l.8){2 9=l.8.Z(" ");3(Q){2 W=u.t();k(2 i=0;i<9.b;i++){3(9[i].t()==W){9.D(i,1);i--}}}9[9.b]=u;l.8=9.S(" ")}E{l.8=u}}',62,86,'||var|if|elements|parentNode|function|window|className|_16|initialize|length|addClassName|true|_1|highlighted||_10||el_array|for|_13|_6|_c|removeClassName|_e|document|safari_reset||toUpperCase|_14|this|_8|_9|_7|load|_4|getElementsByClassName|_3|splice|else|type|_a|new|firefox|safari|indexOf|_b|getElementsByTagName|_2|onfocus|no_guidelines|_15|event_load|join|_f|_11|Array|_17|attachEvent|all|split|450|body|offsetWidth|toLowerCase|guidelines|false|userAgent|navigator|onblur|addEventListener|main_body|onclick|file|getElementById|onload|radio|checkbox|return|push|test|event|RegExp|replace|element'.split('|'),0,{}))
