$(function() {

	/*CONTACT FORM*/
	$(".send-contact-email").livequery(function(){
		$(".send-contact-email").click(function(e) {
			e.preventDefault();
			var $this = $(this);
			//var type;
			var type = $this.attr("id").replace(/^send-/,'');
			//console.log(type);
			var selectval = $("#"+type+"-team .field_subject").fieldValue();
			//console.log(selectval[0]);
			$("#email-feedback").load("/include/sendemail.php",
				{
					type: type,
					name : $("#"+type+"-team .field_name").val(),
					email: $("#"+type+"-team .field_email").val(),
					email_confirm: $("#"+type+"-team .field_email_confirm").val(),
					alias: $("#"+type+"-team .field_alias").val(),
					querytype: selectval[0],
					query: $("#"+type+"-team .field_message").val(),
					refer: $("#"+type+"-team .refer").val(),
					sitename: $("#"+type+"-team .sitename").val()
				}
			);
			$("#email-forms").empty();
		});
	});

});


/* cufon font */

Cufon.DOM.ready(function() {
    Cufon.replace('h2,.section-header, .sub-header');
});

/* rollover buttons */
$(document).ready(function() {
  $(".rollover img, input.rollover").hover(
     function(){
        this.src = this.src.replace("_on","_off");
    },
     function(){
            this.src = this.src.replace("_off","_on");
     }
    );  // put all your jQuery goodness in here.
});


/* Launch Game to specific tabs
-----------------------------------*/
function launchGame(iRoom,loc,tab,dl) {
        var bGameOpen = false;
        //debugger
        loc = "/skin/play.php";
        if(dl) loc += "?tab=" + tab + "&DL=" + dl + "&cachebuster=" + (Math.random()+'');
        else   loc += "?tab=" + tab + "&cache=" + (Math.random()+'');

        // check if game window already open
        try
        {
          var oTest = playWin.document;
          if (oTest != null)	bGameOpen = true;
                }
        catch(ee)
                {
                bGameOpen = false;
                }

        if (!bGameOpen)
                {
                        h=(screen.height*.9)-54
                        w=(screen.width*.9)

                        if (navigator.appName.indexOf("Microsoft") != -1)
                        {
                                playWin = window.open(loc, "playWin", "height="+h+",width="+w+",top=1,left=1,resizable");
                        }
                        else
                        {
                                playWin = window.open(loc, "playWin", "height="+screen.height-2+",width="+screen.width-2+",screenY=1,screenX=1,resizable");
                }
                playWin.focus();
        }
  else
        {
                playWin.focus();
        }
}