/***********************************************
* jQuery exexute
***********************************************/

$(document).ready(function() {                

	/*external link*/
	$('a[@rel$="external"]').click(function(){this.target = "_blank";});
			
		
	/*hide and show single ul*/
	$('ul.display li> ul').hide();
  	$('ul.display li> h4.openbox').click(function() {
	$(this).next('ul').slideToggle('fast')
	.parent().siblings('li').find('ul:visible').slideUp('fast');
  });
				
});



/***********************************************
* Safe email links
***********************************************/

function hideEmail() {
	var s1 = "info";
			var s2 = "@";
			var s3 = "jumbospartyhire.com.au";
			var s4 = "?Subject=Enquiry%20from%20" + s3;
			var s5 = s1 + s2 + s3;
			document.write("<a href=" + "mail" + "to:" + s1 + s2 + s3 + s4 + ">" + s5 + "</a>");
}


/***********************************************
* Form fields Validation Script
***********************************************/

function ValidateForm(f){

      with(f){
         if (isEmpty(_1_Name.value)) {
            alert("Please enter your Name");
            _1_Name.focus();
            return false;
         }

         if (isEmpty(_2_Email_From.value)) {
            alert("Please enter your Email Address");
            _2_Email_From.focus();
            return false;
         }

         if ( !isEmail(_2_Email_From.value) ) {
            alert("Please enter a valid Email Address.");
            _2_Email_From.focus();
            return false;
         }

         if (!isEmpty(_3_Phone.value)) {
	         if (!IsNumber(_3_Phone.value, true)) {
            	alert("Please enter only numbers for your Phone");
            	_3_Phone.focus();
            	return false;
         	}
         }
         if (isEmpty(_4_Event_Date.value)) {
            alert("Please enter the date of your event");
            _4_Event_Date.focus();
            return false;
         }
									 if (isEmpty(_5_Event_Location.value)) {
            alert("Please enter your event's location");
            _5_Event_Location.focus();
            return false;
         }
         if (isEmpty(_6_Comments.value)) {
            alert("Please enter your comments");
            _6_Comments.focus();
            return false;
         }
   	}
   return true;
 }



/***********************************************
* Image Preloader + popup window
***********************************************/

//<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

MM_preloadImages('images/core/bg-star.jpg','images/core/bg-home.jpg','images/core/bg-inner.jpg')

//-->

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

