/**
 * Template Scripts
 *
 */


//*****************	//
// SLIDESHOW SCRIPT //
//*****************	//
		
		$(document).ready(function() {
				$("img.rollover").hover(
					function()
					{
						this.src = this.src.replace("_off","_on");
					},
						function()
					{
						this.src = this.src.replace("_on","_off");
					}
					);
				
					$('.slideshow img:first').fadeIn(1000, function() {
						$('.slideshow').cycle();
					});
		

		});
		


//*****************	//
// Text SlideShow Function   //
//*****************	//

//var customer = new Array()
//customer[0]= "<center><h3>Customer Testimonials</h3>I'm stoked... I never thought it would be so easy to buy a board online!<br/><b>Scott D - NSW</b></center>"
//customer[1]= "<center><h3>Customer Testimonials</h3>The easiest way to sell your board online. Hands Down.<br/><b>Jim H - VIC</b></center>"
//customer[2]= "<center><h3>Customer Testimonials</h3>My custom board is awesome! The shaper called me within hours of my order being placed. I'll definitely be //using boardbound again.<br/><b>Josh R - NSW</b></center>"
//customer[3]= "<center><h3>Customer Testimonials</h3>I love how boardbound works, your buyers can contact you directly, cutting out the third party!<br/><b>//Mattthew M - WA</b></center>"
/**quotations[4]= "<center><h3>Customer Testimonials</h3>I head about boardbound.com.au <br/><br/><b>Thomas Alva Edison</b></center>"
quotations[5]= "<center><h3>Customer Testimonials</h3>I head about boardbound.com.au <br/><br/><b>Thomas Alva Edison<b></b></center>"**/
//function displayCustomers()
//{
//a=Math.floor(Math.random()*customer.length)
//document.getElementById('customer').innerHTML=customer[a]
//setTimeout("displayCustomers()",5000)
//}


//var shaper = new Array()
//shaper[0]= "<center><h3>Shaper Testimonials</h3>Any board, any time, with boardbound!<br/><b>boardbound.com.au</b></center>"
/*shaper[1]= "<center><h3>Shaper Testimonials</h3>I'm stoked... I never thought it would be so easy to buy a board online!<br/><b>Scott Duncan</b></center>"
shaper[2]= "<center><h3>Shaper Testimonials</h3>I'm stoked... I never thought it would be so easy to buy a board online!<br/><b>Scott Duncan</b></center>"
shaper[3]= "<center><h3>Shaper Testimonials</h3>I'm stoked... I never thought it would be so easy to buy a board online!<br/><b>Scott Duncan</b></center>"
shaper[4]= "<center><h3>Shaper Testimonials</h3>I'm stoked... I never thought it would be so easy to buy a board online!<br/><b>B</b></center>"*/
//function displayShapers()
//{
//a=Math.floor(Math.random()*shaper.length)
//document.getElementById('shaper').innerHTML=shaper[a]
//setTimeout("displayShapers()",3500)
//}

//*************************//
// END SlideShow Function //
//***********************//


var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open()
{  jsddm_canceltimer();
   jsddm_close();
   ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

function jsddm_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{  closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

$(document).ready(function()
{  $('#jsddm > li').bind('mouseover', jsddm_open)
   $('#jsddm > li').bind('mouseout',  jsddm_timer)});

document.onclick = jsddm_close;




// Form Validation
<!--
		function checkform(frm) {
			if (frm.realname.value == '') {
					alert("Please enter a value in the field 'Your name'.");
					frm.realname.focus();
					return(false);
			}
			if (frm.email.value == '') {
					alert("Please enter a value in the field 'Your Email'.");
					frm.email.focus();
					return(false);
			}
			validemail=0;
			var checkStr = frm.email.value;
			for (i = 0; i < checkStr.length; i++){
				if(checkStr.charAt(i)=="@")
					validemail |= 1;
				if(checkStr.charAt(i)==".")
					validemail |= 2;
			}
			if(validemail != 3){
				alert("Please enter a valid email address.");
				frm.email.focus();
				return (false);
			}
			if (frm.message.value == '') {
					alert("Please enter a value in the field 'Message'.");
					frm.message.focus();
					return (false);
			}
		}
		//-->
		

//*******************************//
//*****Random Shaper Display*****//
//*******************************//


//Returns a number between 1 and n
function rand ( n )
{
  return ( Math.floor ( Math.random ( ) * n + 1 ) );
}

function chooseRandomShaper(){
	var totalShapers = 17;
	var shaperName;
	var shaperEmail;
	var shaperID;
	var x = rand(totalShapers);
	if(x==1){
		shaperName = "goodtime-surfboards";
		shaperEmail = "infoborkgoodtime.com.au";
		shaperID = "738";
		displayShaper(shaperName, shaperEmail, shaperID);
	}
	if(x==2){
	shaperName = "outline-surfboards";
	shaperEmail = "outlinesurfborkbigpond.com.au";
	shaperID = "743";	
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	if(x==3){
	shaperName = "jack-surfboards";
	shaperEmail = "jackknightsurfboardsborklive.com";
	shaperID = "745";	
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	if(x==4){
	shaperName = "gangsta-surfboards";
	shaperEmail = "pugsborkgangstasurf.com";
	shaperID = "744";	
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	if(x==5){
	shaperName = "outline-surfboards";
	shaperEmail = "outlinesurfborkbigpond.com.au";
	shaperID = "743";	
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	if(x==6){
	shaperName = "rms-surfboards";
	shaperEmail = "rexborkrmshapes.com";
	shaperID = "11";	
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	if(x==7){
	shaperName = "wizstix-surfboards";
	shaperEmail = "bimmy2006borkhotmail.com";
	shaperID = "137";	
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	if(x==8){
	shaperName = "conditionRed-surfboards";
	shaperEmail = "conditionredborkoptusnet.com.au";
	shaperID = "64";	
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	if(x==9){
	shaperName = "bm-surfboards";
	shaperEmail = "bmsurfborkwn.com.au";
	shaperID = "149";	
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	if(x==10){
	shaperName = "samurai-surfboards";
	shaperEmail = "paulborksamuraisurfboards.com.au";
	shaperID = "67";	
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	if(x==11){
	shaperName = "zak-surfboards";
	shaperEmail = "zakborkzaksurfboards.com";
	shaperID = "178";	
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	if(x==12){
	shaperName = "dylan-surfboards";
	shaperEmail = "dylanborkdylansurfboards.com.au";
	shaperID = "189";
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	if(x==13){
	shaperName = "dcs-surfboards";
	shaperEmail = "dcoop1180borkvirginbroadband.com.au";
	shaperID = "173";
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	if(x==14){
	shaperName = "cory-surfboards";
	shaperEmail = "corysurfboardsborkoptusnet.com.au";
	shaperID = "177";	
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	if(x==15){
	shaperName = "nirvana-surfboards";
	shaperEmail = "nirvanasurfboardsborkbigpond.com";
	shaperID = "522";	
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	
	if(x==16){
	shaperName = "MG-surfboards";
	shaperEmail = "mauricioborkmgsurfboards.com.au";
	shaperID = "767";	
	displayShaper(shaperName, shaperEmail, shaperID);
	}
	
	if(x==17){
	shaperName = "vanda-surfboards";
	shaperEmail = "vanda.surfborkhotmail.com";
	shaperID = "747";	
	displayShaper(shaperName, shaperEmail, shaperID);
	}

	
	
		
	
		
	

	

	
	
	
}
function displayShaper(name, email, ID){
	
	var shaperName = name;
	var shaperEmail = email;
	var shaperID = ID;
		document.write('<center><a href="/buy-custom-surfboards-shapers.php?n=' + shaperName + '&e=' + shaperEmail + '&s=' + shaperID + '"><img src="/images/shapers/'+shaperName+'.jpg" alt="Custom Surfboard Shapers Australia - ' + shaperName + ' Surfboards" style="padding:5px" /></a><a href="http://www.boardbound.com.au/searchresults.php?owner=' + shaperID + '"><h3>[View '+shaperName+'\'s Boards]</h3></a><br/></center>');
	
	
}
