/***********************************************
* jQuery execute
***********************************************/

$(document).ready(function() {                
              
	/*external link*/
	$('a[@rel$="external"]').click(function(){this.target = "_blank";});
	
	/*set hover class for anything*/
	$('.bor').hover(function() {$(this).addClass('borhover');}, function() {$(this).removeClass('borhover');});
	
	/*show and hide*/
	$('#slide').hide();
  $('a.openbox').click(function() {$('.tell-a-friend').toggle(400);return false;});

});


/***********************************************
* Safe email links
***********************************************/

function hideEmail() {
	var s1 = "smile";
			var s2 = "@";
			var s3 = "dental359.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 for tell a friend page
***********************************************/

function ValidateForm2(f){
	with(f){
		if (isEmpty(Name_From.value)) {alert("Please enter your Name");Name_From.focus();return false;}
		if ( isEmpty(Email_From.value) ) {alert("Please enter your Email Address");Email_From.focus();return false;}
		if ( !isEmail(Email_From.value) ) {alert("Please enter a valid Email Address for yourself");Email_From.focus();return false;}
		if (isEmpty(Name_To.value)) {alert("Please enter your Friend's Name");Name_To.focus();return false;}
		if ( isEmpty(Email_To.value) ) {alert("Please enter your Friend's Email Address");Email_To.focus();return false;}
		if ( !isEmail(Email_To.value) ) {alert("Please enter a valid Email Address for your Friend");Email_To.focus();return false;}
	}
	return true;
}


/***********************************************
* Form fields Validation for contact page
***********************************************/

function ValidateForm(f){
	with(f){
		if (isEmpty(_1_First_Name.value)) {alert("Please enter your First Name");_1_First_Name.focus();return false;}
		if (isEmpty(_8_Email_From.value)) {alert("Please enter your Email Address");_8_Email_From.focus();return false;}
		if ( !isEmail(_8_Email_From.value) ) {alert("Please enter a valid Email Address.");_8_Email_From.focus();return false;}
		if (isEmpty(_9_Comments.value)) {alert("Please enter your Comments");_9_Commentss.focus();return false;}
	}
	return true;
}


/***********************************************
* Dropdown Fix for IE
***********************************************/

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);



/***********************************************
* Random Images Script (for banner-testimonial-contact)
***********************************************/


<!-- Begin
// Set up the image files to be used.
var theImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theImages[0] = 'images/core/bg-innerbanner.jpg'
theImages[1] = 'images/core/bg-innerbanner.jpg'
theImages[2] = 'images/core/bg-innerbanner.jpg'
theImages[3] = 'images/core/bg-innerbanner.jpg'
theImages[4] = 'images/core/bg-innerbanner.jpg'
theImages[5] = 'images/core/bg-innerbanner.jpg'

// do not edit anything below this line

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="'+theImages[whichImage]+'">');
}

//  End -->


<!-- Begin
var theImages2 = new Array()
theImages2[0] = 'images/core/img-testimonial.jpg'
theImages2[1] = 'images/core/img-testimonial1.jpg'
theImages2[2] = 'images/core/img-testimonial2.jpg'
theImages2[3] = 'images/core/img-testimonial3.jpg'

var j = 0
var p = theImages2.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage2 = Math.round(Math.random()*(p-1));
function showImage2(){
document.write('<img src="'+theImages2[whichImage2]+'">');
}
//  End -->


<!-- Begin
var theImages3 = new Array()
theImages3[0] = 'images/core/img-contact1.jpg'
theImages3[1] = 'images/core/img-contact2.jpg'
theImages3[2] = 'images/core/img-contact3.jpg'

var j = 0
var p = theImages3.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage3 = Math.round(Math.random()*(p-1));
function showImage3(){
document.write('<img src="'+theImages3[whichImage3]+'">');
}
//  End -->


/***********************************************
* Popup Pic Script
***********************************************/

function PopupPic() {
 if (arguments[1] == null || arguments[1].length == 0 || arguments[2] == null || arguments[2].length == 0) {
  window.open( "popup.asp?" + arguments[0], "", "resizable=1,HEIGHT=200,WIDTH=200"); 
 }
 else {
  window.open( "popup.asp?" + arguments[0], "", "resizable=1,HEIGHT=" + arguments[2] + ",WIDTH=" + arguments[1] + ""); 
 }
} 


/***********************************************
* ShowandHide Script
***********************************************/

//<!--
function viewinfo(id) {
	box = document.getElementById(id);
	if(box.className == "visible") {
		box.className = "hidden";
	} else {
		box.className = "visible";
	}
}
//-->
