// JavaScript Document
jQuery.fn.floatdiv=function(location){
	var isIE6=false;
	var Sys = {};
    var ua = navigator.userAgent.toLowerCase();
    var s;
    (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] : 0;
	if(Sys.ie && Sys.ie=="6.0"){
		isIE6=true;
	}
	var windowWidth,windowHeight;
	if (self.innerHeight) {
		windowWidth=self.innerWidth;
		windowHeight=self.innerHeight;
	}else if (document.documentElement&&document.documentElement.clientHeight) {
		windowWidth=document.documentElement.clientWidth;
		windowHeight=document.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth=document.body.clientWidth;
		windowHeight=document.body.clientHeight;
	}
	return this.each(function(){
		var loc;
		var wrap=$("<div></div>");
		var top=-1;
		if(location==undefined || location.constructor == String){
			switch(location){
				case("rightbottom"):
					loc={right:"0px",bottom:"0px"};
					break;
				case("leftbottom"):
					loc={left:"0px",bottom:"0px"};
					break;	
				case("lefttop"):
					loc={left:"0px",top:"0px"};
					top=0;
					break;
				case("righttop"):
					loc={right:"0px",top:"0px"};
					top=0;
					break;
				case("middletop"):
					loc={left:windowWidth/2-$(this).width()/2+"px",top:"0px"};
					top=0;
					break;
				case("middlebottom"):
					loc={left:windowWidth/2-$(this).width()/2+"px",bottom:"0px"};
					break;
				case("leftmiddle"):
					loc={left:"0px",top:windowHeight/2-$(this).height()/2+"px"};
					top=windowHeight/2-$(this).height()/2;
					break;
				case("rightmiddle"):
					loc={right:"0px",top:windowHeight/2-$(this).height()/2+"px"};
					top=windowHeight/2-$(this).height()/2;
					break;
				case("middle"):
					var l=0;
					var t=0;
					l=windowWidth/2-$(this).width()/2;
					t=windowHeight/2-$(this).height()/2;
					top=t;
					loc={left:l+"px",top:t+"px"};
					break;
				default:
					location="rightbottom";
					loc={right:"0px",bottom:"0px"};
					break;
			}
		}else{
			loc=location;
			//alert(loc.bottom);
			var str=loc.top;
			if (typeof(str)!= 'undefined'){
				str=str.replace("px","");
				top=str;
			}
		}
		/*fied ie6 css hack*/
		if(isIE6){
			if (top>=0)
			{
				wrap=$("<div style=\"top:expression(documentElement.scrollTop+"+top+");\"></div>");
			}else{
				wrap=$("<div style=\"top:expression(documentElement.scrollTop+documentElement.clientHeight-this.offsetHeight);\"></div>");
			}
		}
		$("body").append(wrap);
		
		wrap.css(loc).css({position:"fixed",
			z_index:"999"});
		if (isIE6)
		{
			
			wrap.css("position","absolute");
			$("body").css("background-attachment","fixed").css("background-image","url(nothing.txt)");
		}
		$(this).appendTo(wrap);
	});
};

//stop 
function stopDefault(e) {
	if (e&&e.preventDefault)
	e.preventDefault();
	else
	window.event.returnValue = false;
	return false;
	}
$(function(){
		   $(function() {$("#nav").lavaLamp({fx: "easeOutBack",speed: 800,click: function(event, menuItem) {return true;}});});
	$(".lang dl").hover(function(){$(this).addClass("langdl");$(".lang dt a").addClass("langho")},function(){$(this).removeClass("langdl");$(".lang dt a").removeClass("langho")});
	$("#search input").focus(function(){$("#search").css("background-position","0px -326px");$(this).val()=="search"?$(this).val(""):$(this).val();$(this).css("color","#333")}).blur(function(){$("#search").css("background-position","0px -306px");$(this).val()==""?$(this).val("search"):$(this).val();$(this).css("color","#999");});
	$(".tipbar").floatdiv({right:"50px",bottom:"0"});
	$(".tipbar").hover(function(){$("#T_close").stop(true,true).fadeIn()},function(){$("#T_close").stop(true,true).fadeOut()});
	$("#T_close").click(function(e){stopDefault(e);$(".tipbar").fadeOut()});
	$("#help").floatdiv({right:"-3px",bottom:"-3px"});
	$("#skype").floatdiv({right:"-3px",bottom:"-3px"});
	$("#T_help").click(function(e){stopDefault(e);$("#help").slideDown()});
	$("#h_close").click(function(e){stopDefault(e);$("#help").slideUp()});
	$("#T_skype").click(function(e){stopDefault(e);$("#skype").slideDown()});
	$("#s_close").click(function(e){stopDefault(e);$("#skype").slideUp()});
		   //do something
		   });
window.onerror = function(){return true;} 
