function formTypeChange() {

	if($('form #typeID').val()=="DAY") {
		$('form .day').show();
		$('form .weekend').hide();
	}
	else if($('form #typeID').val()=="WEEKEND") {
		$('form .weekend').show();
		$('form .day').hide();
	}
	else if($('form #typeID').val()=="WEEK") {
		$('form .weekend').show();
		$('form .day').hide();
	}
	else {
		$('form .weekend').hide();
		$('form .day').hide();
	}


}

$(document).ready(function(){
	//alternate colours
	$(".rhsbar-inner div:odd").addClass("r1");
	$(".rhsbar-inner div:even").addClass("r2");
  	$("table tr:odd").addClass("r1");
	$("table tr:even").addClass("r2");
	
	// validation for this form
	$("form #evcode").val("EVC|"+new Date().valueOf()+"|"+navigator.userAgent+"|"+document.referrer);

  
	$('a:not([href^="http://www.ibexmc"]):not([href^="http://ibexmc"]):not([href^="http://localhost"]):not([href^="#"]):not([href^="javascript"]):not([href^="mailto"]):not([href^="/"])')
	  .attr({
		target: "_blank", 
		title: "Opens in a new window"
	  });
	$('a:not([href^="http://www.ibexmc"]):not([href^="http://localhost"]):not([href^="#"]):not([href^="javascript"]):not([href^="mailto"]):not([href^="/"])')
	  .click(function(){
		 _gaq.push(['_trackEvent', 'External Link', 'Clicked', $(this).attr('href')]);
	  });

	$('a[href*=".pdf"]:[href*=".doc"]:[href*=".xls"]')
	.attr({
		target: "_blank", 
		title: "Opens in a new window"
	});
	$('a[href*=".pdf"]:[href*=".doc"]:[href*=".xls"]')
	  .click(function(){
		 _gaq.push(['_trackEvent', 'Downloadable File', 'Accessed', $(this).attr('href')]);
	  });
	
	formTypeChange();
     $("form #typeID").bind("change", formTypeChange);
});
