﻿$(function(){	
		   
    correctPNG();
	externallinks();
	
	//Flash
	$("#logo").after("<div id=\"top_banner\"><object id=\"myId\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"725\" height=\"75\"><param name=\"movie\" value=\"/7d_skin/flash/725-75.swf\" /><param name=\"wmode\" value=\"transparent\" /><!--[if !IE]>--><object type=\"application/x-shockwave-flash\" wmode=\"transparent\" data=\"/7d_skin/flash/725-75.swf\" width=\"725\" height=\"75\"><!--<![endif]--><div><h1>7D服装定制</h1><p><a href=\"http://www.adobe.com/go/getflashplayer\"><img src=\"http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif\" alt=\"Get Adobe Flash player\" /></a></p></div><!--[if !IE]>--></object><!--<![endif]--></object></div>");
/*
	$("#copy").after("<div id=\"flash\"><object id=\"myId\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"100%\" height=\"600\"><param name=\"movie\" value=\"/7d_skin/flash//1.swf\" /><param name=\"wmode\" value=\"transparent\" /><!--[if !IE]>--><object type=\"application/x-shockwave-flash\" wmode=\"transparent\" data=\"/7d_skin/flash//1.swf\" width=\"100%\" height=\"600\"><!--<![endif]--><div><h1>&nbsp;</h1><p><a href=\"http://www.adobe.com/go/getflashplayer\"><img src=\"http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif\" alt=\"Get Adobe Flash player\" /></a></p></div><!--[if !IE]>--></object><!--<![endif]--></object></div>");	
*/
	
	//关键词搜索
	$("#Keywords").focus(function() {	
	   if($.trim($(this).val())=="在此输入关键词") $(this).val("");
	})
	$("#Keywords").blur(function() {	
	   if($.trim($(this).val())=="") $(this).val("在此输入关键词");
	})
	$("#search .btn input").click(function() {
	   var keywords=$("#Keywords").val();									
	   if(keywords=="在此输入关键词" || $.trim(keywords)==""){
		   alert("请输入您的搜索关键词！");
		   return false;
	   }
	})
	
	//Menu高亮处理
	var menu_num=0;
	var body_class=$('body').attr("class").substr(1);
	if(body_class!="") menu_num=body_class;
	if(menu_num==null) menu_num=0;
	$("#menu ul li").removeClass("on");
    $("#menu ul li:eq("+menu_num+")").addClass("on");
	
	//滚回老家
	$("#copy").after("<div id=\"gototop\"><a href=\"#\" title=\"点击返回到顶部\">&nbsp;</a></div>");
	$('#gototop').topLink({
		min: 100,
		fadeSpeed: 500
	});
	$('#gototop').click(function(){
	  if($.browser.safari) {//这里判断浏览器是否为safari 
	    $('body').animate({scrollTop:0}, 'slow'); 
	    return false;//返回false可以避免在原链接后加上# 
	  } else{ 
	    $('html').animate({scrollTop:0}, 500); 
	    return false; 
	  } 
	});

});
	
//文字滚动
(function($){
	$.fn.extend({
	Scroll:function(opt,callback){
	if(!opt) var opt={};
	var _this=this.eq(0).find("ul:first");
	var lineH=_this.find("li:first").height(),
	line=opt.line?parseInt(opt.line,15):parseInt(this.height()/lineH,10),
	speed=opt.speed?parseInt(opt.speed,10):3000, //卷动速度，数值越大，速度越慢（毫秒）
	timer=opt.timer?parseInt(opt.timer,13):5000; //滚动的时间间隔（毫秒）
	if(line==0) line=1;
	var upHeight=0-line*lineH;
	scrollUp=function(){
	_this.animate({
	marginTop:upHeight
	},speed,function(){
	for(i=1;i<=line;i++){
	_this.find("li:first").appendTo(_this);
	}
	_this.css({marginTop:0});
	});
	}
	_this.hover(function(){
	clearInterval(timerID);
	},function(){
	timerID=setInterval("scrollUp()",timer);
	}).mouseout();
	}
	})
	})(jQuery);
	$(document).ready(function(){$("#bulletin").Scroll({line:1,speed:500,timer:1000});
});

//plugin
jQuery.fn.topLink = function(settings) {
	settings = jQuery.extend({
		min: 1,
		fadeSpeed: 200
	}, settings);
	return this.each(function() {
		//listen for scroll
		var el = $(this);
		el.hide(); //in case the user forgot
		$(window).scroll(function() {
			if($(window).scrollTop() >= settings.min){
				el.fadeIn(settings.fadeSpeed);
			}
			else{
				el.fadeOut(settings.fadeSpeed);
			}
		});
	});
};


function externallinks() {   
    if (!document.getElementsByTagName) return;   
    var anchors = document.getElementsByTagName("a");   
    for (var i=0; i<anchors.length; i++){   
       var anchor = anchors[i];   
       if (anchor.getAttribute("href") && anchor.getAttribute("rel")=="external") anchor.target="_blank";
    }   
}   
//window.onload = externallinks;


function SetFont(size){
	document.getElementById("txt").style.fontSize=size;
}

//加入收藏
function bookmark(){
	var title=document.title;
	var url=document.location.href;
	if (window.sidebar){
	  window.sidebar.addPanel(title, url, "");
	}else if( window.opera && window.print ){
	  var mbm = document.createElement('a');
	  mbm.setAttribute('rel','sidebar');
	  mbm.setAttribute('href',url);
	  mbm.setAttribute('title',title);
	  mbm.click();
	}else if(document.all){
	  window.external.addFavorite(url, title);
	}else{
	  alert("浏览器不支持自动添加收藏夹。关闭本对话框后，请您手动使用组合快捷键'"+findKeys()+"'进行添加。");
	}
}
function findKeys(){
	var isMSIE=/*@cc_on!@*/false;
	var ua=navigator.userAgent.toLowerCase(),isMac=(ua.indexOf("mac")!=-1),isWebkit=(ua.indexOf("webkit")!=-1),str=(isMac?"Command/Cmd":"CTRL");
	if(window.opera&&(!opera.version||(opera.version()<9))){str+=" + T"}
	else{
		if(ua.indexOf("konqueror")!=-1){str+=" + B"}
		else{if(window.opera||window.home||isWebkit||isMSIE||isMac){str+=" + D"}else{str+=" + D"}}
	}
	return str;
}


function copyToClipBoard(){ 
    var txt=""; 
    txt+=document.title; 
    txt+=""; 
    txt+=this.location.href;
    if (window.clipboardData) {   
        window.clipboardData.clearData();   
        window.clipboardData.setData("Text", txt);   
    } else if (navigator.userAgent.indexOf("Opera") != -1) {   
        window.location = txt;   
    } else if (window.netscape) {   
        try {   
            netscape.security.PrivilegeManager   
                    .enablePrivilege("UniversalXPConnect");   
        } catch (e) {   
            alert("你使用的FireFox浏览器,复制功能被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车。\n然后将“signed.applets.codebase_principal_support”双击，设置为“true”");   
            return;   
        }   
        var clip = Components.classes['@mozilla.org/widget/clipboard;1']   
                .createInstance(Components.interfaces.nsIClipboard);   
        if (!clip)   
            return;   
        var trans = Components.classes['@mozilla.org/widget/transferable;1']   
                .createInstance(Components.interfaces.nsITransferable);   
        if (!trans)   
            return;   
        trans.addDataFlavor('text/unicode');   
        var str = new Object();   
        var len = new Object();   
        var str = Components.classes["@mozilla.org/supports-string;1"]   
                .createInstance(Components.interfaces.nsISupportsString);   
        var copytext = txt;   
        str.data = copytext;   
        trans.setTransferData("text/unicode", str, copytext.length * 2);   
        var clipid = Components.interfaces.nsIClipboard;   
        if (!clip)   
            return false;   
        clip.setData(trans, null, clipid.kGlobalClipboard);   
    }  
    alert("复制成功，请粘贴到你的QQ/MSN上推荐给你的好友"); 
} 

jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') {
   options = options || {};
   if (value === null) {
    value = '';
    options = $.extend({}, options);
    options.expires = -1;
   }
   var expires = '';
   if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
    var date;
    if (typeof options.expires == 'number') {
     date = new Date();
     date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
    } else {
     date = options.expires;
    }
    expires = '; expires=' + date.toUTCString();
   }
   var path = options.path ? '; path=' + (options.path) : '';
   var domain = options.domain ? '; domain=' + (options.domain) : '';
   var secure = options.secure ? '; secure' : '';
   document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else {
   var cookieValue = null;
   if (document.cookie && document.cookie != '') {
    var cookies = document.cookie.split(';');
    for (var i = 0; i < cookies.length; i++) {
     var cookie = jQuery.trim(cookies[i]);
     if (cookie.substring(0, name.length + 1) == (name + '=')) {
      cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
      break;
     }
    }
   }
   return cookieValue;
}
};

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6. 
{ 
    var arVersion = navigator.appVersion.split("MSIE") 
    var version = parseFloat(arVersion[1]) 
    if ((version >= 5.5) && (document.body.filters)) 
    { 
       for(var j=0; j<document.images.length; j++) 
       { 
          var img = document.images[j] 
          var imgName = img.src.toUpperCase() 
          if (imgName.substring(imgName.length-3, imgName.length) == "PNG") 
          { 
             var imgID = (img.id) ? "id='" + img.id + "' " : "" 
             var imgClass = (img.className) ? "class='" + img.className + "' " : "" 
             var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " 
             var imgStyle = "display:inline-block;" + img.style.cssText 
             if (img.align == "left") imgStyle = "float:left;" + imgStyle 
             if (img.align == "right") imgStyle = "float:right;" + imgStyle 
             if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle 
             var strNewHTML = "<ins " + imgID + imgClass + imgTitle 
             + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
             + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
             + "(src=\'" + img.src + "\');\"></ins>" 
             img.outerHTML = strNewHTML 
             j = j-1 
          } 
       } 
    }     
} 
//window.attachEvent("onload", correctPNG);



//百度统计
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F2ca0cfbaf94110bb8f0f101f35b3f491' type='text/javascript'%3E%3C/script%3E"));


