﻿this.tooltip = function(){	
	/* CONFIG */		
		xOffset = -40;
		yOffset = 30;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	jQuery("area").hover(function(e){
		//this.a = this.title;
		//this.tip = "";
		jQuery(this).attr("title", "");
		jQuery("body").append("<p id='tooltip'>"+ this.getAttribute('tip') +"</p>");
		jQuery("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		//this.tip = this.a;		
		jQuery("#tooltip").remove();
    });	
	jQuery("area").mousemove(function(e){
		jQuery("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

this.pagetooltip = function(){	
	/* CONFIG */		
		xOffsetp = 10;
		yOffsetp = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	jQuery(".news_page_pages a").hover(function(e){
		this.t = this.title;
		this.title = "";
		jQuery("body").append("<p id='tooltipp'>"+ this.t +"</p>");
		jQuery("#tooltipp")
			.css("top",(e.pageY - xOffsetp) + "px")
			.css("left",(e.pageX + yOffsetp) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		jQuery("#tooltipp").remove();
    });	
	jQuery(".news_page_pages a").mousemove(function(e){
		jQuery("#tooltipp")
			.css("top",(e.pageY - xOffsetp) + "px")
			.css("left",(e.pageX + yOffsetp) + "px");
	});			
};

jQuery(document).ready(function() {
	var thisFolder = document.URL.replace(/(\\|\/)[^\\\/]*$/, '/');
	//alert(thisFolder);
	
	jQuery(function(){
	  jQuery('#ul_page>li').hover(
	    function(){
		   jQuery(this).addClass("li_hover");
	    },function(){
		   jQuery(this).removeClass("li_hover");
	    });
    })
	
	jQuery(".top_head_logo").click(function(){ window.location='#'; });
	jQuery(".footer_logo").click(function(){ window.location='#'; });
    jQuery(".footer_home").click(function(){ window.location='#'; });
	
	jQuery(".top_head_home_homepage").click(function(){ SetHome(this); });
	jQuery(".top_head_home_favorites").click(function(){ window.external.addFavorite('http://www.chengpou.com.mo/','正報'); });
	
	//jQuery("#new_clo").click(function(){jQuery("#new_link_top").click();});
	
	function SetHome(obj){
	try{
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage('http://www.chengpou.com.mo/');
	}catch(e){
		if(window.netscape){
			try{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}catch(e){
				alert("抱歉，此操作被浏览器拒绝！\n\n请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为'true'");
			};
		    }else{
			    alert("抱歉，您所使用的浏览器无法完成此操作。\n\n您需要手动将'http://www.chengpou.com.mo/'设置为首页。");
		    };
	    };
    };
	
	//alert("news_middle_right_con_middle left:"+jQuery(".news_middle_right_con_middle").offset().left);
	



var myDate=new Date();
var myYear=myDate.getFullYear();
var myMonth=myDate.getMonth()+1;
var myDay=myDate.getDate();
var myWeek=myDate.getDay();
var today = new Array("星期天","星期一","星期二","星期三","星期四","星期五","星期六");
$('.top_date p').html('您好，今天是'+myYear+'年'+myMonth+'月'+myDay+'日 '+ today[myWeek]);

$('.search').html('<form><input name="searchtxt" class="searchtxt" type="text" /></form>');
$('.search').click(function(){alert('搜索功能建立中...');});
});



