$(document).ready(function(){    // JQUERY START
		
	// PLUGIN preload images
	
	jQuery.preloadImages = function()
	{
	  for(var i = 0; i<arguments.length; i++)
	  {
		jQuery("<img>").attr("src", arguments[i]);
	  }
	}
	
	// LOGO
	
	$("#logo").click( function(){
		window.location="http://www.ibaanah.com/pub/";
	});
	
	// build flag menu, preloading hover images
	
	$("#flags .flag-item").each(function(i){
		$(this).css("background-image","url(./wp-content/themes/ibaanah/images/flag-"+$(this).attr("id")+".png)");
		$.preloadImages("./wp-content/themes/ibaanah/images/flag-"+$(this).attr("id")+"hover.png");
	});
	
	$.preloadImages("./wp-content/themes/ibaanah/images/program-selection-hover.png");
	$.preloadImages("./wp-content/themes/ibaanah/images/entry-requirements-hover.png");
	$.preloadImages("./wp-content/themes/ibaanah/images/fillout-application-hover.png");
	
	// Application Process
	
	$("#fillout-application").click( function(){
		window.location="?page_id=21";
	});
	
	$("#register-for-classes-today").click( function(){
		window.location="?page_id=21";
	});
	
	$("#program-selection").click( function(){
		window.location="?page_id=17";
	});
	
	$("#entry-requirements").click( function(){
		window.location="?page_id=19#requirements";
	});
		
	$("#registration_msg").click(function(){
		location.href="./?page_id=21";
	});
		
	$("#register-for-classes-today").click(function(){
		location.href="./?page_id=21";
	});	
		
	// on page load hide flag menu
	
	if(!$.browser.msie){
		$("#flag-bkd").fadeOut("fast");
	} else {
		$("#flag-bkd").css("width",0).css("padding","0");
	}
	/* DEACTIVATED - CLICK LANGUAGE FLAG		
	// if new flag selected SHOW flag menu
	
	$(".flag-selected-bkd").click( function() {

		if(!$.browser.msie){
			$("#flag-bkd").fadeIn("slow");
		} else {
			$("#flag-bkd").css("width",366).css("padding-left","8px");
		}
	});
	
	// if new flag selected HIDE flag menu
	

	
	$(".flag-item").click( function(){
		if(!$.browser.msie){
			$("#flag-bkd").fadeOut("fast");
		} else {
			$("#flag-bkd").css("width",0).css("padding","0");
		}
		$("#myflag").css("background-image",$(this).css("background-image").replace("-hover",""));
	});
	
	
	
	$("#flags  .flag-item").mouseover(function(){
		$(this).css("background-image","url(./wp-content/themes/ibaanah/images/flag-"+$(this).attr("id")+"-hover.png)");
	}).mouseout(function(){
		$(this).css("background-image","url(./wp-content/themes/ibaanah/images/flag-"+$(this).attr("id")+".png)");
	});
	
	
	DEACTIVATED - CLICK LANGUAGE FLAG */
	
	
	$("#video").mouseover(function(){
		// alert('hi');
		// $(this).fadeOut("slow");
	});
	
	
	
});