﻿
$(document).ready(function(){
	var ChkLn = getLang();
	var temp = new Array();
	var total,tiptip,size = "";
	
	$.ajax({
		url: "footer_cmd.aspx", 
		type: "get", 
		data: "cmd=link&ln="+ChkLn, 
		success: function(data){
			if(data != ""){
				temp = data.split("_____");
				total = temp[0];
				tiptip = temp[1];
				size = ( Math.ceil(total/2) )*146;
				$("#tiptip-footer").css("width",size);
				$("#tiptip-footer").html(tiptip);
			}
			return false;
		}
	});
	
	$("#tiptip-footer").hide();
	$("#tiptip_arrow").hide();
	
	$("#footer-related-link").hover(function(){
		$("#tiptip-footer").show();
		$("#tiptip_arrow").show();
	});

	$("#tiptip_holder").live("hover", function(event) {
		if (event.type == "mouseout"){
			$("#tiptip-footer").hide();
			$("#tiptip_arrow").hide();
		} else if(event.type == "mouseleave"){
			$("#tiptip-footer").hide();
			$("#tiptip_arrow").hide();
		}
	});
	
	$(".tiptip-link").live("hover", function(event) {
		if(event.type == "mouseover"){
			$(this).prev().css("visibility", "visible");
		}else if(event.type == "mouseenter"){
			$(this).prev().css("visibility", "visible");
		}else if(event.type == "mouseleave"){
			$(this).prev().css("visibility", "hidden");
		}else if (event.type == "mouseout") {
			$(this).prev().css("visibility", "hidden");
		}
	});
	


	var current_hlnews = $('.hlnews:eq(0)'); 
	setInterval(function(){
			$('.hlnews').fadeOut(200);
		 current_hlnews.fadeIn(1600);
		 if(current_hlnews.next().length == 1){          
			current_hlnews = current_hlnews.next();     
		 }else{         
			current_hlnews =  $('.hlnews:eq(0)');     
		 } 
	},5000);
	
});



