$(document).ready(function() {
	   
	   $('input').each(function(i) {
		  $(this).focus(function(){			   
           	$(this).select();
		   });
		});
	   
	   
	   
     $('.promotion_box').mouseover(function(e){	
	 	$(this).attr('class','promotion_box_over');
	});
	$('.promotion_box').mouseout(function(e){	
	 	$(this).attr('class','promotion_box');
	});
	
	
	
	$('.useful_link_box').mouseover(function(e){	
	 	$(this).attr('class','useful_link_box_over');
	});
	$('.useful_link_box').mouseout(function(e){	
	 	$(this).attr('class','useful_link_box');
	});
	
	   
	   
	   
	   
	   
	$('.highlight_box_blue').mouseover(function(e){	
	 	$(this).attr('class','highlight_box_blue_over');
	});
	$('.highlight_box_blue').mouseout(function(e){	
	 	$(this).attr('class','highlight_box_blue');
	});
	
	   
	   
	   
	$('.highlight_box_deep_blue').mouseover(function(e){	
	 	$(this).attr('class','highlight_box_deep_blue_over');
	});
	$('.highlight_box_deep_blue').mouseout(function(e){	
	 	$(this).attr('class','highlight_box_deep_blue');
	});
	
	
	
	$('.highlight_box_purple').mouseover(function(e){	
	 	$(this).attr('class','highlight_box_purple_over');
	});
	$('.highlight_box_purple').mouseout(function(e){	
	 	$(this).attr('class','highlight_box_purple');
	});
	
	   
	$('.highlight_box_yellow').mouseover(function(e){	
	 	$(this).attr('class','highlight_box_yellow_over');
	});
	$('.highlight_box_yellow').mouseout(function(e){	
	 	$(this).attr('class','highlight_box_yellow');
	});
	
	
	
	
	
	$('.highlight_box_green').mouseover(function(e){	
	 	$(this).attr('class','highlight_box_green_over');
	});
	$('.highlight_box_green').mouseout(function(e){	
	 	$(this).attr('class','highlight_box_green');
	});
	
	
	$('.events_box').mouseover(function(e){	
	 	$(this).attr('class','events_box_over');
	});
	$('.events_box').mouseout(function(e){	
	 	$(this).attr('class','events_box');
	});
	
	
	
		
	$('.events_box2').mouseover(function(e){	
	 	$(this).attr('class','events_box2_over');
	});
	$('.events_box2').mouseout(function(e){	
	 	$(this).attr('class','events_box2');
	});
	
	
	
	
	$('.upcoming_event_over').hide();
	$('.upcoming_event').mouseover(function(e){	
	 	$(this).hide();
		$('.upcoming_event_over').show();
		
	});
	$('.upcoming_event_over').mouseout(function(e){	
	 	$(this).hide();
		$('.upcoming_event').show();
	});
	
	
	
	
	
	
	
	showTabContent();
	$('.tab_content_link').click(function(e){
		e.preventDefault();	
		 $('.tab_content_link').each(function(i) {
				$(this).removeClass("current");	  
		});			
		$(this).addClass("current");
		showTabContent();
	});						
	
	
	
	
	
	
	
	
	
	hideAllManageRow();
	$('.manage_row').click(function(e){	
		hideAllManageRow();
	 	expand_area = $(this).attr('expand_area');
		if($(this).attr('checked') == undefined || $(this).attr('checked') == '0' ){
			$(this).attr('checked','1');
		}else{
			$(this).attr('checked','0');
		}
		
		if($(this).attr('checked') == '1'){
			$('.'+expand_area).show();
		}else{
			$('.'+expand_area).hide();
		}
	
	});
	
	
	
	
	   
});

function hideAllManageRow(){
//	alert(2);
	 $('.manage_row').each(function(i) {
			expand_area = $(this).attr('expand_area');
			$(this).attr('checked','0');
			$('.'+expand_area).hide();
			
		  
	 });
}




function hideAllTabContent(){
	//alert(1);
	 $('.tab_content').each(function(i) {
			$(this).hide();
	 });
}
function showTabContent(){
	 hideAllTabContent();
	 $('.tab_content_link').each(function(i) {
			 if($(this).hasClass('current')){
				 //alert($('#'+$(this).attr('tab_id')));
				 $('#'+$(this).attr('tab_id')).show();
			 }	  
	 });
	
}

function switchLang(from,to) {
    var currentStr = window.location.href;
    currentStr = currentStr.replace("/" + from + "/", "/" + to + "/");
    //currentStr = currentStr.replace("lang=" + from, "lang=" + to);
	//currentStr=currentStr.replace("?land="+from,"");
    window.location.href = currentStr;
}
