function validateEmail(str) {	
	var INVALID_EMAIL_ADDRESS = "Please enter a valid email address.";
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   alert(INVALID_EMAIL_ADDRESS)
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert(INVALID_EMAIL_ADDRESS)
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    alert(INVALID_EMAIL_ADDRESS)
	    return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	    alert(INVALID_EMAIL_ADDRESS)
	    return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    alert(INVALID_EMAIL_ADDRESS)
	    return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	    alert(INVALID_EMAIL_ADDRESS)
	    return false
	 }
	
	 if (str.indexOf(" ")!=-1){
	    alert(INVALID_EMAIL_ADDRESS)
	    return false
	 }

	 return true					
}
function initialiseTestimonials(){
	var testoption1 = {
		firstname: "testimonialTicker1",
		secondname: "showTestimonialHere",
		thirdname:"testimonialDisplay",
		fourthname:"test_button",
		playingtitle:"Now Playing:",
		nexttitle:"Next News:",
		prevtitle:"Prev News:",
		newsspeed:'10000',
		effectis:'1',
		mouseover:false,
		newscountname:"test",
		disablenewscount:true,
		imagedir:"images/"
	}
	$.init_test(testoption1);
}
function initialiseNews(){	
	var newsoption1 = {
		firstname: "orgnews",
		secondname: "showhere",
		thirdname:"news_display",
		fourthname:"news_button",
		playingtitle:"Now Playing:",
		nexttitle:"Next News:",
		prevtitle:"Prev News:",
		newsspeed:'10000',
		effectis:'1',
		mouseover:false,
		newscountname:"test",
		disablenewscount:true,
		imagedir:"images/"
		}
	$.init_news(newsoption1);
}
function setupContactForm () {
	$(document).ready(function() {
		$("img#contactButton").click(function(){
			$("div#contactFormContainer").css("display", "block");
			$("div#contactFormContainer").css("height", "185px");
			$("div#contactFormContainer").css("padding", "20px");
			$("div#contactFormContainer").css("padding-top", "10px");
			$("div#contactFormContainer").css("border", "1px solid #ccc");
			$("div#contactFormContainer").center();
			//$("body").addClass("fade");
			$("#contactFormFade").show();
		});
		$("a#enquiryLink").click(function(){
			$("div#contactFormContainer").css("display", "block");
			$("div#contactFormContainer").css("height", "185px");
			$("div#contactFormContainer").css("padding", "20px");
			$("div#contactFormContainer").css("padding-top", "10px");
			$("div#contactFormContainer").css("border", "1px solid #ccc");
			$("div#contactFormContainer").center();
			//$("body").addClass("fade");
			$("#contactFormFade").show();
		});
		$("div#closeButton").click(function(){
			$("div#contactFormContainer").css("display", "none");			
		});	   
	});
}
function openContactForm () {
	$("div#contactFormContainer").css("display", "block");
	$("div#contactFormContainer").css("height", "185px");
	$("div#contactFormContainer").css("width", "340px");
	$("div#contactFormContainer").css("padding", "20px");
	$("div#contactFormContainer").css("padding-top", "10px");
	$("div#contactFormContainer").css("border", "1px solid #ccc");
	//$("body").addClass("fade");
	$("#contactFormFade").show();
	$("div#contactFormContainer").center();
	$("div#closeButton").click(function(){
		$("div#contactFormContainer").css("display", "none");			
	});

}
function closeContactForm(){
	$("div#contactFormContainer").css("display", "none");
	$("#contactFormFade").hide();
}
jQuery.fn.center = function () {
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}

function ieFix(topLevel) {
	var ua = navigator.userAgent;
	var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
	var isMSIE5_5 = isMSIE && (ua.indexOf('MSIE 5.5') != -1);
	var isMSIE6 = isMSIE && (ua.indexOf('MSIE 6.0') != -1);

	if (isMSIE5_5 || isMSIE6){	
		$("#siteMenu li").hover(
		  function () {
		    $(this).addClass("hover");		    
		  },
		  function () {
		  	$(this).removeClass("hover");	
		  }
		);	
	}
}
