$(this).ready(function(){
	/* Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*) */
	$("ul.subnav").parent().append("<span></span>"); 
	$("ul.topnav li span").mouseover(function() { 
		/* When trigger is mouserover... 
		 * Following events are applied to the subnav itself(moving subnav up and down) 
		 * Drop down the subnav on click */
		$(this).parent().find("ul.subnav").slideDown('fast').show(); 
		$(this).parent().hover(function() {
		}, function(){
		/* When the mouse Hovers Out of the subnav, move it back up */
			$(this).parent().find("ul.subnav").slideUp('slow'); 
		});
		/* Following events are applied to the trigger (Hover events for the trigger) */
		}).hover(function() {
			/* On Hover Over, add class "subhover" */
			$(this).addClass("subhover"); 
		}, function(){	
			/* On Hover Out, remove class "subhover" */ 
			$(this).removeClass("subhover"); 
	});
	
    $("ul#topnav li").hover(function() { //Hover over event on list item
        	$(this).css({ 'background' : '#1376c9 repeat-x'}); //Add background color + image on hovered list item
            $(this).find("span").show(); //Show the subnav
    } , function() { //on hover out...
            $(this).css({ 'background' : 'none'}); //Ditch the background
            $(this).find("span").hide(); //Hide the subnav
    });

});

//Subscribe Enews
function subEmailOnfocus() {
	if(document.getElementById("subemail").value == "" 
		|| document.getElementById("subemail").value == "Please, enter your email." 
		|| document.getElementById("subemail").value == "กรุณาใส่อีเมล์ของคุณ") {
		document.getElementById("subemail").value = "";
		document.getElementById("subemail").style.cssText = "font-style: normal; height: 25px; width: 220px; color: #000000;";
	}
}

function subEmailOnblur(lang) {
	if(document.getElementById("subemail").value == "") {
		if(lang == 1) {
			document.getElementById("subemail").value = "Please, enter your email.";
		} else {
			document.getElementById("subemail").value = "กรุณาใส่อีเมล์ของคุณ";
		} 
		document.getElementById("subemail").style.cssText = "font-style: italic; height: 25px; width: 220px; color: #c0c0c0;";
	}
}  
