
/***************************************************
创建日期：2009-11-16
函数描述：添加收藏
***************************************************/
function addfavorite(url,name){
	if (document.all){
		window.external.addFavorite(url,name);
	}
	else if (window.sidebar){
		window.sidebar.addPanel(name,url, "");
	}
} 
/***************************************************
创建日期：2009-11-16
函数描述：设为首页 onclick="sethome(this,window.location)"
***************************************************/
function sethome(obj,vrl){
try{
obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
}
catch(e){
if(window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
}  
catch (e)  { 
alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'");  
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage',vrl);
}
}
}

/***************************************************
鍒涘缓鏃ユ湡锛2009-05-12
鍑芥暟鎻忚堪锛氳幏鍙栧埗瀹氬厓绱
***************************************************/
function getparms(){
	var len = arguments.length;
	var obj;
	if(len > 2 || len < 1){
		alert("js(getparms):error");
		return false;	
	}
	if(arguments[1] == "id" || arguments[1] == undefined)
		obj = document.getElementById(arguments[0]);
	if(arguments[1] == "name")
		obj = document.getElementByName(arguments[0]);
	return obj;
}

/***************************************************
鍒涘缓鏃ユ湡锛2009-10-30
鍑芥暟鎻忚堪锛歄bject jQuery Effects
***************************************************/

$(document).ready(function(){
	$(".nav_box").hover(
		function(){
			$(this).attr("class","nav_hover");
		},
		function(){
			$(this).attr("class","nav_box");
		}
	);
});
/***************************************************
鍒涘缓鏃ユ湡锛2009-12-18
鍑芥暟鎻忚堪锛歠orm
***************************************************/
$(document).ready(function(){
	$(".message_r").click(
		function(){
			getparms("news_add").reset();
		}
	);
	$(".message_s").click(
		function(){
			getparms("news_add").submit();
		}
	);
	$("#order_product").click(
		function(){
			getparms("news_add").submit();
			alert("鎮ㄧ殑鐣欒█宸茬粡鎴愬姛鍙戦侊紝鎴戜滑浼氬湪24灏忔椂鍐呯粰鎮ㄧ瓟澶!");
			window.parent.parent.GB_hide();
		}
	);
	$(".original_category").toggle(
		function(){
			$(this).next("ul").css("display","block");	
		},
		function(){
			$(this).next("ul").css("display","none");	
		}
	);
	$('#divfollow').followDiv("","20px","100px","");
});
(function($) {
$.fn.extend({
	"followDiv":function(leftpx,rightpx,toppx,bottompx){
            var _self = this;
            var pos; //层的绝对定位位置
            pos = {"left":"0px","top":"0px"};
            if(leftpx!="" && toppx!=""){
                pos = {"left":leftpx,"top":toppx};
            }
            if(leftpx!="" && bottompx!=""){
                pos = {"left":leftpx,"bottom":bottompx};
            }
            if(rightpx!="" && toppx!=""){
                pos = {"right":rightpx,"top":toppx};
            }
            if(rightpx!="" && bottompx!=""){
                pos = {"right":rightpx,"bottom":bottompx};
            }
		/*FF和IE7可以通过position:fixed来定位，*/
		_self.css({"position":"fixed","z-index":"9999"}).css(pos);
		/*ie6需要动态设置距顶端高度top.*/
		if($.browser.msie && $.browser.version == 6) {
				_self.css('position','absolute');						
				$(window).scroll(function(){
					var topIE6;
					if(bottompx!=""){
						topIE6=$(window).scrollTop() + $(window).height() - _self.outerWidth() - Number(bottompx.replace("px",""));
					}else if(toppx!=""){
						topIE6=$(window).scrollTop() + Number(toppx.replace("px",""));
					}else{
						topIE6=$(window).scrollTop() + $(window).height() - _self.outerWidth() - Number(bottompx.replace("px",''));
					}
					_self.css( 'top' , topIE6 );
				});
		}
		return _self;  //返回this，使方法可链。
	}
});
})(jQuery);


