﻿$(document).ready(function(){
	
	$(document).pngFix();
	
	$(".marquee").each(function() { $(this).marquee(); });
	
	$(".corner4").corner("4px");
	
	// $("img").lazyload({ placeholder : "/tmwcn/files/images/grey.gif",   effect: "fadeIn" });
	
	// $(function(){ $('.wrap').equalHeights(); });
	
	// $('.jbft, .ftsh').equalHeights();
	
	// $(document).ready(function(){ fontResizer('12px','14px','16px'); });
});

function changeWordSize(size){
	var contentTag = document.getElementById("contentText");
	contentTag.style.fontSize = size+"px";
}

function check(form){   
	//检查文本框是否填写   
	var SearchValue = frmSearch.SearchValue.value;   
	if(SearchValue.length==0){   
		alert("请填写搜索关键字！");   
		form.SearchValue.focus();   
		return false;   
	}    
}

function AddFavorite(sURL, sTitle)
{
    try
    {
        window.external.addFavorite("http://www.tmwcn.com/", sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, "http://www.tmwcn.com/", "");
        }
        catch (e)
        {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}

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);
                 }
        }
}

// 图片轮转
(function($) {
	$.fn.loopedSlider = function(options) {
		
	var defaults = {			
		container: '.container',
		slides: '.slides',
		pagination: '.pagination',
		containerClick: false, // Click container for next slide
		autoStart: 0, // Set to positive number for auto start and interval time
		restart: 0, // Set to positive number for restart and restart time
		slidespeed: 300, // Speed of slide animation
		fadespeed: 150, // Speed of fade animation
		autoHeight: false // Set to positive number for auto height and animation speed
	};
		
	this.each(function() {
		
		var obj = $(this);
		var o = $.extend(defaults, options);
		var pagination = $(o.pagination+' li a',obj);
		var m = 0;
		var t = 1;
		var s = $(o.slides,obj).children().size();
		var w = $(o.slides,obj).children().outerWidth();
		var p = 0;
		var u = false;
		var n = 0;
		var interval=0;
		var restart=0;
		
		$(o.slides,obj).css({width:(s*w)});
		
		$(o.slides,obj).children().each(function(){
			$(this).css({position:'absolute',left:p,display:'block'});
			p=p+w;
		});
		
		$(pagination,obj).each(function(){
			n=n+1;
			$(this).attr('rel',n);
			$(pagination.eq(0),obj).parent().addClass('active');
		});
		
		$(o.slides,obj).children(':eq('+(s-1)+')').css({position:'absolute',left:-w});
		
		if(o.autoHeight){autoHeight(t);}
		
		$('.next',obj).click(function(){
			if(u===false) {
				animate('next',true);
				if(o.autoStart){
					if (o.restart) {autoStart();}
					else {clearInterval(sliderIntervalID);}
				}
			} return false;
		});
		
		$('.previous',obj).click(function(){
			if(u===false) {	
				animate('prev',true);
				if (o.restart) {autoStart();}
				else {clearInterval(sliderIntervalID);}
			} return false;
		});
		
		if (o.containerClick) {
			$(o.container ,obj).click(function(){
				if(u===false) {
					animate('next',true);
					if (o.restart) {autoStart();}
					else {clearInterval(sliderIntervalID);}
				} return false;
			});
		}
		
		$(pagination,obj).click(function(){
			if ($(this).parent().hasClass('active')) {return false;}
			else {
				t = $(this).attr('rel');
				$(pagination,obj).parent().siblings().removeClass('active');
				$(this).parent().addClass('active');
				animate('fade',t);
				if (o.restart) {autoStart();}
				else {clearInterval(sliderIntervalID);}
			} return false;
		});
	
		if (o.autoStart) {
			sliderIntervalID = setInterval(function(){
				if(u===false) {animate('next',true);}
			}, o.autoStart);
			function autoStart() {
				if (o.restart) {
				clearInterval(sliderIntervalID);
				clearInterval(interval);
				clearTimeout(restart);
					restart = setTimeout(function() {
						interval = setInterval(	function(){
							animate('next',true);
						},o.autoStart);
					},o.restart);
				} else {
					sliderIntervalID = setInterval(function(){
						if(u===false) {animate('next',true);}
					},o.autoStart);
				}
			};
		}
		
		function current(t) {
			if(t===s+1){t=1;}
			if(t===0){t=s;}
			$(pagination,obj).parent().siblings().removeClass('active');
			$(pagination+'[rel="' + (t) + '"]',obj).parent().addClass('active');
		};
		
		function autoHeight(t) {
			if(t===s+1){t=1;}
			if(t===0){t=s;}	
			var getHeight = $(o.slides,obj).children(':eq('+(t-1)+')',obj).outerHeight();
			$(o.container,obj).animate({height: getHeight},o.autoHeight);					
		};		
		
		function animate(dir,clicked){	
			u = true;	
			switch(dir){
				case 'next':
					t = t+1;
					m = (-(t*w-w));
					current(t);
					if(o.autoHeight){autoHeight(t);}
					$(o.slides,obj).animate({left: m}, o.slidespeed,function(){
						if (t===s+1) {
							t = 1;
							$(o.slides,obj).css({left:0},function(){$(o.slides,obj).animate({left:m})});							
							$(o.slides,obj).children(':eq(0)').css({left: 0});
							$(o.slides,obj).children(':eq('+(s-1)+')').css({ position:'absolute',left:-w});				
						}
						if (t===s) $(o.slides,obj).children(':eq(0)').css({left:(s*w)});
						if (t===s-1) $(o.slides,obj).children(':eq('+(s-1)+')').css({left:s*w-w});
						u = false;
					});					
					break; 
				case 'prev':
					t = t-1;
					m = (-(t*w-w));
					current(t);
					if(o.autoHeight){autoHeight(t);}
					$(o.slides,obj).animate({left: m}, o.slidespeed,function(){
						if (t===0) {
							t = s;
							$(o.slides,obj).children(':eq('+(s-1)+')').css({position:'absolute',left:(s*w-w)});
							$(o.slides,obj).css({left: -(s*w-w)});
							$(o.slides,obj).children(':eq(0)').css({left:(s*w)});
						}
						if (t===2 ) $(o.slides,obj).children(':eq(0)').css({position:'absolute',left:0});
						if (t===1) $(o.slides,obj).children(':eq('+ (s-1) +')').css({position:'absolute',left:-w});
						u = false;
					});
					break;
				case 'fade':
					t = [t]*1;
					m = (-(t*w-w));
					current(t);
					if(o.autoHeight){autoHeight(t);}
					$(o.slides,obj).children().fadeOut(o.fadespeed, function(){
						$(o.slides,obj).css({left: m});
						$(o.slides,obj).children(':eq('+(s-1)+')').css({left:s*w-w});
						$(o.slides,obj).children(':eq(0)').css({left:0});
						if(t===s){$(o.slides,obj).children(':eq(0)').css({left:(s*w)});}
						if(t===1){$(o.slides,obj).children(':eq('+(s-1)+')').css({ position:'absolute',left:-w});}
						$(o.slides,obj).children().fadeIn(o.fadespeed);
						u = false;
					});
					break; 
				default:
					break;
				}					
			};
		});
	};
})(jQuery);

/** jQuery-Plugin "pngFix" **/
(function($) {

jQuery.fn.pngFix = function(settings) {

	// Settings
	settings = jQuery.extend({
		blankgif: 'blank.gif'
	}, settings);

	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {

		//fix images with png-source
		jQuery(this).find("img[src$=.png]").each(function() {

			jQuery(this).attr('width',jQuery(this).width());
			jQuery(this).attr('height',jQuery(this).height());

			var prevStyle = '';
			var strNewHTML = '';
			var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
			var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
			var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
			var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
			var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
			var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
			if (this.style.border) {
				prevStyle += 'border:'+this.style.border+';';
				this.style.border = '';
			}
			if (this.style.padding) {
				prevStyle += 'padding:'+this.style.padding+';';
				this.style.padding = '';
			}
			if (this.style.margin) {
				prevStyle += 'margin:'+this.style.margin+';';
				this.style.margin = '';
			}
			var imgStyle = (this.style.cssText);

			strNewHTML += '<span '+imgId+imgClass+imgTitle+imgAlt;
			strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
			strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
			strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'scale\');';
			strNewHTML += imgStyle+'"></span>';
			if (prevStyle != ''){
				strNewHTML = '<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;'+'">' + strNewHTML + '</span>';
			}

			jQuery(this).hide();
			jQuery(this).after(strNewHTML);

		});

		// fix css background pngs
		jQuery(this).find("*").each(function(){
			var bgIMG = jQuery(this).css('background-image');
			if(bgIMG.indexOf(".png")!=-1){
				var iebg = bgIMG.split('url("')[1].split('")')[0];
				jQuery(this).css('background-image', 'none');
				jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
			}
		});
		
		//fix input with png-source
		jQuery(this).find("input[src$=.png]").each(function() {
			var bgIMG = jQuery(this).attr('src');
			jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
   		jQuery(this).attr('src', settings.blankgif)
		});
	
	}
	
	return jQuery;

};

})(jQuery);

/** BiggerLink v2.0.1 **/ 
(function($) {
	$.fn.biggerlink = function(options) {

		// Default settings
		var settings = {
			biggerclass:'bl-bigger', 	// class added to the first contained link and others that trigger it
			hoverclass:'bl-hover', 		// class added to parent element on hover/focus
			hoverclass2:'bl-hover2', 	// class added to parent element on hover/focus of other links
			clickableclass:'bl-hot', 	// class added to parent element with behaviour
			otherstriggermaster: true,	// will all links in containing biggerlink element trigger the first link
			follow: 'auto'				// follow master link on click? : 'auto',true,false
		};
		if(options) {
			$.extend(settings, options);
		}
		$(this).filter(function(){
			 return $('a',this).length > 0;

		}).addClass(settings.clickableclass).css('cursor', 'pointer').each(function(i){
			
			// store element references
			var big = $(this).data('biggerlink',{hovered:false,focused:false,hovered2:false,focused2:false});
			var links = {
				all: $('a',this),
				big: $(this),
				master: $('a:first',this).data('biggerlink',{status:'master'}).addClass(settings.biggerclass),
				other: $('a',this).not($('a:first',this)).data('biggerlink',{status:'other'})
			};
			
			
			$('a',this).andSelf().each(function(){
				var newdata = $.extend($(this).data('biggerlink'),links);
				$(this).data('biggerlink',newdata);
			});
			
			
			
			// Add title of first link with title to parent if not already set
			var thistitle = big.attr('title');
			var newtitle = big.data('biggerlink').master.attr('title');
			if(newtitle && !thistitle)
			{
				big.attr('title', newtitle);
			}
			


		// events on biggerlink element
		
		big
			.mouseover(function(event){
				window.status = $(this).data('biggerlink').master.get(0).href;
				$(this).addClass(settings.hoverclass);
				$(this).data('biggerlink').hovered = true;
			})
			.mouseout(function(event){
				window.status = '';
				if(!$(this).data('biggerlink').focused)
				{
					$(this).removeClass(settings.hoverclass);
				}
				$(this).data('biggerlink').hovered = false;
			})
			.bind('click',function(event){

				// if clicked direct or non-link
				if(!$(event.target).closest('a').length)
				{
					$(this).data('biggerlink').master.trigger({type:'click',source:'biggerlink'});
					event.stopPropagation();
				}
			});
			
			
			
			// focus/blur
			
			links.all
			.bind('focus',function(){
				$(this).data('biggerlink').big.addClass(settings.hoverclass);
				$(this).data('biggerlink').big.data('biggerlink').focused = true;
			}).bind('blur',function(){
				if(!$(this).data('biggerlink').big.data('biggerlink').hovered)
				{
					$(this).data('biggerlink').big.removeClass(settings.hoverclass);
				}
				$(this).data('biggerlink').big.data('biggerlink').focused = false;
			});
			
		
			
			// click/focus/blur event on master (first) link within biggerlink
		
			links.master
			.bind('click',function(event){
				if(event.source == 'biggerlink')
				{
					if(settings.follow === true || settings.follow == 'auto' && event.result !== false)
					{
						window.location = $(this).attr('href');
					}
					else
					{
						event.stopPropagation();
					}
				}
			});
			
			
			// links other than the first (master) link also within biggerlink
			
			// other links are independent
			if(settings.otherstriggermaster)
			{
				links.other.addClass(settings.biggerclass)
				.bind('click',function(event){
					// trigger click events on master link instead
					$(this).data('biggerlink').master.trigger({type:'click',source:'biggerlink'});
					
					// stop this link being followed
					event.preventDefault();
					
					// prevent events on parent elements being triggered
					event.stopPropagation();
				});
			}
			
			// other links are slaves of master link 
			else
			{
				links.other
				.bind('focus',function(){
					$(this).data('biggerlink').big.addClass(settings.hoverclass2);
					$(this).data('biggerlink').big.data('biggerlink').focused2 = true;
				})
				.bind('blur',function(){
					if(!$(this).data('biggerlink').big.data('biggerlink').hovered2)
					{
						$(this).data('biggerlink').big.removeClass(settings.hoverclass2);
					}
					$(this).data('biggerlink').big.data('biggerlink').focused2 = false;
					
				})
				.bind('mouseover',function(event){
					$(this).data('biggerlink').big.addClass(settings.hoverclass2);
					$(this).data('biggerlink').big.data('biggerlink').hovered2 = true;
					event.stopPropagation();
				})
				.bind('mouseout',function(event){
					if(!$(this).data('biggerlink').big.data('biggerlink').focused2)
					{
						$(this).data('biggerlink').big.removeClass(settings.hoverclass2);
					}
					$(this).data('biggerlink').big.data('biggerlink').hovered2 = false;
					event.stopPropagation();
				});
				
				if(!links.other.attr('title'))
				{
					links.other.attr('title','');
				}
			}
		});
		return this;
	};
})(jQuery);

/**
 * Flash (http://jquery.lukelutman.com/plugins/flash)
 * A jQuery plugin for embedding Flash movies.
 * 
 * Version 1.0
 * November 9th, 2006
 *
 **/ 
;(function(){
	
var $$;

$$ = jQuery.fn.flash = function(htmlOptions, pluginOptions, replace, update) {
	
	// Set the default block.
	var block = replace || $$.replace;
	
	// Merge the default and passed plugin options.
	pluginOptions = $$.copy($$.pluginOptions, pluginOptions);
	
	// Detect Flash.
	if(!$$.hasFlash(pluginOptions.version)) {
		// Use Express Install (if specified and Flash plugin 6,0,65 or higher is installed).
		if(pluginOptions.expressInstall && $$.hasFlash(6,0,65)) {
			// Add the necessary flashvars (merged later).
			var expressInstallOptions = {
				flashvars: {  	
					MMredirectURL: location,
					MMplayerType: 'PlugIn',
					MMdoctitle: jQuery('title').text() 
				}					
			};
		// Ask the user to update (if specified).
		} else if (pluginOptions.update) {
			// Change the block to insert the update message instead of the flash movie.
			block = update || $$.update;
		// Fail
		} else {
			// The required version of flash isn't installed.
			// Express Install is turned off, or flash 6,0,65 isn't installed.
			// Update is turned off.
			// Return without doing anything.
			return this;
		}
	}
	
	// Merge the default, express install and passed html options.
	htmlOptions = $$.copy($$.htmlOptions, expressInstallOptions, htmlOptions);
	
	// Invoke $block (with a copy of the merged html options) for each element.
	return this.each(function(){
		block.call(this, $$.copy(htmlOptions));
	});
	
};
/**
 *
 * @name flash.copy
 * @desc Copy an arbitrary number of objects into a new object.
 * @type Object
 * 
 * @example $$.copy({ foo: 1 }, { bar: 2 });
 * @result { foo: 1, bar: 2 };
 *
**/
$$.copy = function() {
	var options = {}, flashvars = {};
	for(var i = 0; i < arguments.length; i++) {
		var arg = arguments[i];
		if(arg == undefined) continue;
		jQuery.extend(options, arg);
		// don't clobber one flash vars object with another
		// merge them instead
		if(arg.flashvars == undefined) continue;
		jQuery.extend(flashvars, arg.flashvars);
	}
	options.flashvars = flashvars;
	return options;
};
/*
 * @name flash.hasFlash
 * @desc Check if a specific version of the Flash plugin is installed
 * @type Boolean
 *
**/
$$.hasFlash = function() {
	// look for a flag in the query string to bypass flash detection
	if(/hasFlash\=true/.test(location)) return true;
	if(/hasFlash\=false/.test(location)) return false;
	var pv = $$.hasFlash.playerVersion().match(/\d+/g);
	var rv = String([arguments[0], arguments[1], arguments[2]]).match(/\d+/g) || String($$.pluginOptions.version).match(/\d+/g);
	for(var i = 0; i < 3; i++) {
		pv[i] = parseInt(pv[i] || 0);
		rv[i] = parseInt(rv[i] || 0);
		// player is less than required
		if(pv[i] < rv[i]) return false;
		// player is greater than required
		if(pv[i] > rv[i]) return true;
	}
	// major version, minor version and revision match exactly
	return true;
};
/**
 *
 * @name flash.hasFlash.playerVersion
 * @desc Get the version of the installed Flash plugin.
 * @type String
 *
**/
$$.hasFlash.playerVersion = function() {
	// ie
	try {
		try {
			// avoid fp6 minor version lookup issues
			// see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
			var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
			try { axo.AllowScriptAccess = 'always';	} 
			catch(e) { return '6,0,0'; }				
		} catch(e) {}
		return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
	// other browsers
	} catch(e) {
		try {
			if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
				return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
			}
		} catch(e) {}		
	}
	return '0,0,0';
};
/**
 *
 * @name flash.htmlOptions
 * @desc The default set of options for the object or embed tag.
 *
**/
$$.htmlOptions = {
	height: 240,
	flashvars: {},
	pluginspage: 'http://www.adobe.com/go/getflashplayer',
	src: '#',
	type: 'application/x-shockwave-flash',
	width: 320		
};
/**
 *
 * @name flash.pluginOptions
 * @desc The default set of options for checking/updating the flash Plugin.
 *
**/
$$.pluginOptions = {
	expressInstall: false,
	update: true,
	version: '6.0.65'
};
/**
 *
 * @name flash.replace
 * @desc The default method for replacing an element with a Flash movie.
 *
**/
$$.replace = function(htmlOptions) {
	// this.innerHTML = '<div class="alt">'+this.innerHTML+'</div>';
	jQuery(this)
		.addClass('flash-replaced')
		.prepend($$.transform(htmlOptions));
};
/**
 *
 * @name flash.update
 * @desc The default method for replacing an element with an update message.
 *
**/
$$.update = function(htmlOptions) {
	var url = String(location).split('?');
	url.splice(1,0,'?hasFlash=true&');
	url = url.join('');
	var msg = '<p>此内容需要 Flash Player 播放器. <a href="http://www.adobe.com/go/getflashplayer" target="_blank">点击下载</a>. 已经安装了 Flash Player? <a href="'+url+'">点击这里.</a></p>';
	this.innerHTML = '<span class="alt">'+this.innerHTML+'</span>';
	jQuery(this)
		.addClass('flash-update')
		.prepend(msg);
};
/**
 *
 * @desc Convert a hash of html options to a string of attributes, using Function.apply(). 
 * @example toAttributeString.apply(htmlOptions)
 * @result foo="bar" foo="bar"
 *
**/
function toAttributeString() {
	var s = '';
	for(var key in this)
		if(typeof this[key] != 'function')
			s += key+'="'+this[key]+'" ';
	return s;		
};
/**
 *
 * @desc Convert a hash of flashvars to a url-encoded string, using Function.apply(). 
 * @example toFlashvarsString.apply(flashvarsObject)
 * @result foo=bar&foo=bar
 *
**/
function toFlashvarsString() {
	var s = '';
	for(var key in this)
		if(typeof this[key] != 'function')
			s += key+'='+encodeURIComponent(this[key])+'&';
	return s.replace(/&$/, '');		
};
/**
 *
 * @name flash.transform
 * @desc Transform a set of html options into an embed tag.
 * @type String 
 *
 * @example $$.transform(htmlOptions)
 * @result <embed src="foo.swf" ... />
 *
 * Note: The embed tag is NOT standards-compliant, but it 
 * works in all current browsers. flash.transform can be
 * overwritten with a custom function to generate more 
 * standards-compliant markup.
 *
**/
$$.transform = function(htmlOptions) {
	htmlOptions.toString = toAttributeString;
	if(htmlOptions.flashvars) htmlOptions.flashvars.toString = toFlashvarsString;
	return '<embed ' + String(htmlOptions) + '/>';		
};

/**
 *
 * Flash Player 9 Fix (http://blog.deconcept.com/2006/07/28/swfobject-143-released/)
 *
**/
if (window.attachEvent) {
	window.attachEvent("onbeforeunload", function(){
		__flash_unloadHandler = function() {};
		__flash_savedUnloadHandler = function() {};
	});
}
	
})();

/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;


// 创建目标点击
(function($) {
	// plugin definition
	$.fn.bigTarget = function(options) {
		debug(this);
		// build main options before element iteration
		var opts = $.extend({}, $.fn.bigTarget.defaults, options);
		// iterate and reformat each matched element
		return this.each(function() {
			// set the anchor attributes
			var $a = $(this);
			var href = $a.attr('href');
			var title = $a.attr('title');
			// build element specific options
			var o = $.meta ? $.extend({}, opts, $a.data()) : opts;
			// update element styles
			$a.parents(o.clickZone)
				.hover(function() {
					$h = $(this);
					$h.addClass(o.hoverClass);
					if(typeof o.title != 'undefined' && o.title === true && title != '') {
						$h.attr('title',title);
					}
				}, function() {
					
					$h.removeClass(o.hoverClass);
					if(typeof o.title != 'undefined' && o.title === true && title != '') {
						$h.removeAttr('title');
					}
				})
				// click
				.click(function() {
					if(getSelectedText() == "")
					{
						if($a.is('[rel*=external]')){
							window.open(href);
							return false;
						}
						else {
							//$a.click(); $a.trigger('click');
							window.location = href;
						}
					}
				});
		});
	};
	// private function for debugging
	function debug($obj) {
		if (window.console && window.console.log)
		window.console.log('bigTarget selection count: ' + $obj.size());
	};
	// get selected text
	function getSelectedText(){
		if(window.getSelection){
			return window.getSelection().toString();
		}
		else if(document.getSelection){
			return document.getSelection();
		}
		else if(document.selection){
			return document.selection.createRange().text;
		}
	};
	// plugin defaults
	$.fn.bigTarget.defaults = {
		hoverClass	: 'hover',
		clickZone	: 'li:eq(0)',
		title		: true
	};
// end of closure
})(jQuery);

// 循环滚动
(function($) {
	$.fn.marquee = function(o) {
		//获取滚动内容内各元素相关信息
		o = $.extend({
			id: 		new Date().getTime(),
			speed:		parseInt($(this).attr('speed')) || 30, // 滚动速度
			step:		parseInt($(this).attr('step')) || 1, // 滚动步长
			direction:	$(this).attr('direction') || 'up', // 滚动方向
			pause:		parseInt($(this).attr('pause')) || 1000 // 停顿时长
		}, o || {});
		var dIndex = jQuery.inArray(o.direction, ['right', 'down']);
		if (dIndex > -1) {
			o.direction = ['left', 'up'][dIndex];
			o.step = -o.step;
		}
		var div 		= $(this); // 容器对象
		var divWidth 	= div.innerWidth(); // 容器宽
		var divHeight 	= div.innerHeight(); // 容器高
		var ul 			= $("ul", div);
		var li 			= $("li", ul);
		var liSize 		= li.size(); // 初始元素个数
		var liWidth 	= li.width(); // 元素宽
		var liHeight 	= li.height(); // 元素高
		var width 		= liWidth * liSize;
		var height 		= liHeight * liSize;
		if ((o.direction == 'left' && width > divWidth) || 
			(o.direction == 'up' && height > divHeight)) {
			// 元素超出可显示范围才滚动
			if (o.direction == 'left') {
				ul.width(2 * liSize * liWidth);
				if (o.step < 0) div.scrollLeft(width);
			} else {
				ul.height(2 * liSize * liHeight);
				if (o.step < 0) div.scrollTop(height);
			}
			ul.append(li.clone()); // 复制元素
			o.id = setInterval(_marquee, o.speed);
			div.hover(
				function(){clearInterval(o.id);},
				function(){o.id = setInterval(_marquee, o.speed);}
			);
		}
		function _marquee() {
			// 滚动
			if (o.direction == 'left') {
				var l = div.scrollLeft();
				if (o.step < 0) {
					div.scrollLeft((l <= 0 ? width : l) + o.step);
				} else {
					div.scrollLeft((l >= width ? 0 : l) + o.step);
				}
				if (l % liWidth == 0) _pause();
			} else {
				var t = div.scrollTop();
				if (o.step < 0) {
					div.scrollTop((t <= 0 ? height : t) + o.step);
				} else {
					div.scrollTop((t >= height ? 0 : t) + o.step);
				}
				if (t % liHeight == 0) _pause();
			}
		}
		function _pause() {
			// 停顿
			if (o.pause > 0) {
				clearInterval(o.id);
				setTimeout(function() {
					o.id = setInterval(_marquee, o.speed);
				}, o.pause);
			}
		}
	};
})(jQuery);

// Tab
jQuery.fn.switchTab = function(settings) {
	settings = jQuery.extend({//可配置参数
		defaultIndex: 0,
		titOnClassName: "on",
		titCell: "dt a",
		mainCell: "dd",
		delayTime: 0,
		interTime: 0,
		trigger: "click",
		effect: "",
		debug: ""
	},
	settings,
	{//插件信息
		version: 110
	});

	this.each(function() {
		var st;
		var curTagIndex = -1;
		var obj = jQuery(this);
		var cellCount = obj.find(settings.mainCell).length;//可切换个数
		var ShowSTCon = function (i){
			if(i != curTagIndex){
				obj.find(settings.titCell + ":eq(" + curTagIndex + ")").removeClass(settings.titOnClassName);
				obj.find(settings.mainCell).hide();
				obj.find(settings.titCell + ":eq(" + i + ")").addClass(settings.titOnClassName);
				if(settings.delayTime <250 && settings.effect != "")settings.effect = "";
				if(settings.effect == "fade"){
					obj.find(settings.mainCell + ":eq(" + i + ")").fadeIn({queue: false, duration: 250});
				}else if(settings.effect == "slide"){
					obj.find(settings.mainCell + ":eq(" + i + ")").slideDown({queue: false, duration: 250});
				}else{
					obj.find(settings.mainCell + ":eq(" + i + ")").show();
				}
				curTagIndex = i;
			}
		};
		
		var ShowNext = function (){
			obj.find(settings.titCell).eq(curTagIndex).removeClass(settings.titOnClassName);
			obj.find(settings.mainCell).hide();
			if(++curTagIndex >= cellCount)curTagIndex = 0;
			obj.find(settings.titCell).eq(curTagIndex).addClass(settings.titOnClassName);
			obj.find(settings.mainCell).eq(curTagIndex).show();
			//ShowSTCon(curTagIndex);
		};
		
		//根据defaultIndex初始化
		ShowSTCon(settings.defaultIndex);

		//
		if(settings.interTime > 0){
			var sInterval = setInterval(function(){
				ShowNext();
			}, settings.interTime);
		}

		//处理交互事件
		obj.find(settings.titCell).each(function(i, ele){
			if(settings.trigger=="click"){
				jQuery(ele).click(function(){
					ShowSTCon(i);
					return false;//若有链接而选择了click模式, 链接不起作用
				});
			}else if(settings.delayTime > 0){
				jQuery(ele).hover(function(){
					st = setTimeout(function(){//延时触发
						ShowSTCon(i);
						st = null;
					}, settings.delayTime);
				},function(){
					if(st!=null)clearTimeout(st);
				});
			}else{
				jQuery(ele).mouseover(function(){
					ShowSTCon(i);
				});
			}
		});
	});
	if(settings.debug!="")alert(settings[settings.debug]);
	return this;
};

// 自动匹配高度
$.fn.equalHeights = function(px) {
	$(this).each(function(){
		var currentTallest = 0;
		$(this).children().each(function(i){
			if ($(this).height() > currentTallest) { currentTallest = $(this).height(); }
		});
		if (!px || !Number.prototype.pxToEm) currentTallest = currentTallest.pxToEm(); //use ems unless px is specified
		// for ie6, set height since min-height isn't supported
		if ($.browser.msie && $.browser.version == 6.0) { $(this).children().css({'height': currentTallest}); }
		$(this).children().css({'min-height': currentTallest}); 
	});
	return this;
};

$.fn.equalWidths = function(px) {
	$(this).each(function(){
		var currentWidest = 0;
		$(this).children().each(function(i){
				if($(this).width() > currentWidest) { currentWidest = $(this).width(); }
		});
		if(!px || !Number.prototype.pxToEm) currentWidest = currentWidest.pxToEm(); //use ems unless px is specified
		// for ie6, set width since min-width isn't supported
		if ($.browser.msie && $.browser.version == 6.0) { $(this).children().css({'width': currentWidest}); }
		$(this).children().css({'min-width': currentWidest}); 
	});
	return this;
};

Number.prototype.pxToEm = String.prototype.pxToEm = function(settings){
	//set defaults
	settings = jQuery.extend({
		scope: 'body',
		reverse: false
	}, settings);
	
	var pxVal = (this == '') ? 0 : parseFloat(this);
	var scopeVal;
	var getWindowWidth = function(){
		var de = document.documentElement;
		return self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
	};	
	
	/* When a percentage-based font-size is set on the body, IE returns that percent of the window width as the font-size. 
		For example, if the body font-size is 62.5% and the window width is 1000px, IE will return 625px as the font-size. 	
		When this happens, we calculate the correct body font-size (%) and multiply it by 16 (the standard browser font size) 
		to get an accurate em value. */
				
	if (settings.scope == 'body' && $.browser.msie && (parseFloat($('body').css('font-size')) / getWindowWidth()).toFixed(1) > 0.0) {
		var calcFontSize = function(){		
			return (parseFloat($('body').css('font-size'))/getWindowWidth()).toFixed(3) * 16;
		};
		scopeVal = calcFontSize();
	}
	else { scopeVal = parseFloat(jQuery(settings.scope).css("font-size")); };
			
	var result = (settings.reverse == true) ? (pxVal * scopeVal).toFixed(2) + 'px' : (pxVal / scopeVal).toFixed(2) + 'em';
	return result;
};

// 年月日显示
function tick()
{
    var today = new Date()
    // 只显示日期(带农历)
    document.getElementById("Clock").innerHTML = today.toLocaleDateString() + "&nbsp;" + GetLunarDateString(today);
    // 显示日期加动态时间
    // document.getElementById("Clock").innerHTML = today.toLocaleDateString() + "&nbsp;" + today.toLocaleTimeString() + "&nbsp;" + GetLunarDateString(today);
    // window.setTimeout("tick()", null);
}

function getCurrentWeekName()
{
  var weekday = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六")
  return weekday[new Date().getDay()];
}

// 数组LunarDaysOfMonth存入农历2001年到2050年每年中的月天数信息
// 农历每月只能是29或30天，一年用12(或13)个二进制位表示，从高到低，对应位为1表示30天，否则29天
var LunarDaysOfMonth = new Array
(
    0xd4a8, 0xd4a0, 0xda50, 0x5aa8, 0x56a0, 0xaad8, 0x25d0, 0x92d0, 0xc958, 0xa950, // 2001-2010
    0xb4a0, 0xb550, 0xb550, 0x55a8, 0x4ba0, 0xa5b0, 0x52b8, 0x52b0, 0xa930, 0x74a8, // 2011-2020
    0x6aa0, 0xad50, 0x4da8, 0x4b60, 0x9570, 0xa4e0, 0xd260, 0xe930, 0xd530, 0x5aa0, // 2021-2030
    0x6b50, 0x96d0, 0x4ae8, 0x4ad0, 0xa4d0, 0xd258, 0xd250, 0xd520, 0xdaa0, 0xb5a0, // 2031-2040
    0x56d0, 0x4ad8, 0x49b0, 0xa4b8, 0xa4b0, 0xaa50, 0xb528, 0x6d20, 0xada0, 0x55b0  // 2041-2050
);

var Animals = new Array("鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪");

// 数组LunarLeapYear存放农历2001年到2050年闰月的月份，如没有则为0，从高到低，每字节存两年
var LunarLeapYear = new Array
(
    0x40, 0x02, 0x07, 0x00, 0x50, // 2001-2010
    0x04, 0x09, 0x00, 0x60, 0x04, // 2011-2020
    0x00, 0x20, 0x60, 0x05, 0x00, // 2021-2030
    0x30, 0xb0, 0x06, 0x00, 0x50, // 2031-2040
    0x02, 0x07, 0x00, 0x50, 0x03  // 2041-2050
);

// 返回农历iLunarYear年的闰月月份，如没有则返回0 
function GetLeapMonth(iLunarYear)
{ 
    var Leap = LunarLeapYear[(iLunarYear - 2001) >> 1];
    return (((iLunarYear - 2001) & 1) == 0) ? (Leap >> 4) : (Leap & 0x0f);
}

// 返回农历iLunarYer年iLunarMonth月的天数，结果是一个长整数
// 如果iLunarMonth不是闰月， 高字为0，低字为该月的天数
// 如果iLunarMonth是闰月， 高字为后一个月的天数，低字为前一个月的天数
function LunarMonthDays(iLunarYear, iLunarMonth)
{
    var High;
    var Low;
    var Bit;

    High = 0;
    Low = 29;
    Bit = 16 - iLunarMonth;
    if ((iLunarMonth > GetLeapMonth(iLunarYear)) && (GetLeapMonth(iLunarYear) > 0))  Bit--;
    if ((LunarDaysOfMonth[iLunarYear - 2001] & (1 << Bit)) > 0)  Low++;
    if (iLunarMonth == GetLeapMonth(iLunarYear))
    {
        High = ((LunarDaysOfMonth[iLunarYear - 2001] & (1 << (Bit-1))) > 0) ?  30 : 29;
    }

    return Low + (High << 16);
}

// 返回农历iLunarYear年的总天数
function LunarYearDays(iLunarYear)
{ 
    var Days;
    var tmp;

    Days = 0;
    for (var i=1; i <= 12; i++)
    {
        tmp = LunarMonthDays(iLunarYear, i);
        Days = Days + ((tmp >> 16) & 0xffff); //取高位 
        Days = Days + (tmp & 0xffff); //取低位 
    }

    return Days;
}

// 将农历iLunarYear年格式化成天干地支记年法表示的字符串 
function FormatLunarYear(iLunarYear)
{ 
    var szText1 = new String("甲乙丙丁戊己庚辛壬癸");
    var szText2 = new String("子丑寅卯辰巳午未申酉戌亥");
    var strYear;
  
    strYear = szText1.substr((iLunarYear - 4) % 10, 1);
    strYear = strYear + szText2.substr((iLunarYear - 4) % 12, 1);

    return strYear + "年";
}

// 将农历iLunarMonth月格式化成农历表示的字符串
function FormatLunarMonth(iLunarMonth)
{ 
    var szText = new String("正二三四五六七八九十");
    var strMonth;

    if (iLunarMonth <= 10)
    {
        strMonth = szText.substr(iLunarMonth - 1, 1);
    }
    else if (iLunarMonth == 11) strMonth = "十一";
    else strMonth = "十二";

    return strMonth + "月";
}

// 将农历iLunarDay日格式化成农历表示的字符串
function FormatLunarDay(iLunarDay)
{ 
    var szText1 = new String("初十廿三");
    var szText2 = new String("一二三四五六七八九十");
    var strDay;
    if ((iLunarDay != 20) && (iLunarDay != 30))
    {
        strDay = szText1.substr((iLunarDay - 1) / 10, 1) + szText2.substr((iLunarDay - 1) % 10, 1);
    }
    else if (iLunarDay != 20)
    {
        strDay = szText1.substr(iLunarDay / 10, 1) + "十";
    }
    else
    {
        strDay = "二十";
    }
  
    return strDay;
}

// 将公历日期转换为农历日期，返回农历表示的字符串
function GetLunarDateString(SolarDate)
{
    var tmp;
    var iLunarYear;
    var iLunarMonth;
    var iLunarDay;
    var Leap = false;
    var MinMilli = 1000 * 60;
    var HrMilli = MinMilli * 60;
    var DyMilli = HrMilli * 24;
  
    // 从2001年1月1日算起，给定的公历日期已经过去的天数
    // 11323是1970年1月1日到2001年1月1日之间的天数，因为Date是从1970年1月1日作为起点的
    var iSpanDays = Math.round(SolarDate.getTime() / DyMilli) - 11323;

    // 公历2001年1月24日为农历2001年正月初一，差23天
    if (iSpanDays < 23)
    {
        iYear = 2000;
        iLunarMonth = 12;
        iLunarDay = iSpanDays + 7;
    }
    else
    {
        // 从农历2001年正月初一算起 
        iSpanDays = iSpanDays - 23;
        iLunarYear = 2001;
        iLunarMonth = 1;
        iLunarDay = 1;
  
        // 计算农历年 
        tmp = LunarYearDays(iLunarYear);
        while (iSpanDays >= tmp)
        {
            iSpanDays -= tmp;
            iLunarYear++;
            tmp = LunarYearDays(iLunarYear);
        }

        // 计算农历月 
        tmp = LunarMonthDays(iLunarYear, iLunarMonth) & 0xffff; //取低字
        while (iSpanDays >= tmp)
        {
            iSpanDays -= tmp;
            if (iLunarMonth == GetLeapMonth(iLunarYear))  // 该年该月闰月
            {
                tmp = LunarMonthDays(iLunarYear, iLunarMonth) >> 16; //取高字
                if (iSpanDays < tmp)
                {
                    Leap = (tmp > 0) ? true : false;  // 闰月的后个月？
                    break;
                }
                iSpanDays = iSpanDays - tmp;
            }
  
            iLunarMonth++;
            tmp = LunarMonthDays(iLunarYear,iLunarMonth) & 0xffff; //取低字
        }
  
        // 计算农历日 
        iLunarDay += iSpanDays;
    }
    
    iAnimals = "(" + Animals[(iLunarYear-4)%12] + ")";
    
    return "农历" + FormatLunarYear(iLunarYear) + iAnimals + (Leap ? "闰" : "") +  FormatLunarMonth(iLunarMonth) + FormatLunarDay(iLunarDay);
}

// 圆角
if (!document.createElement('canvas').getContext) {

(function() {

  // alias some functions to make (compiled) code shorter
  var m = Math;
  var mr = m.round;
  var ms = m.sin;
  var mc = m.cos;

  // this is used for sub pixel precision
  var Z = 10;
  var Z2 = Z / 2;

  /**
   * This funtion is assigned to the <canvas> elements as element.getContext().
   * @this {HTMLElement}
   * @return {CanvasRenderingContext2D_}
   */
  function getContext() {
    if (this.context_) {
      return this.context_;
    }
    return this.context_ = new CanvasRenderingContext2D_(this);
  }

  var slice = Array.prototype.slice;

  function bind(f, obj, var_args) {
    var a = slice.call(arguments, 2);
    return function() {
      return f.apply(obj, a.concat(slice.call(arguments)));
    };
  }

  var G_vmlCanvasManager_ = {
    init: function(opt_doc) {
      if (/MSIE/.test(navigator.userAgent) && !window.opera) {
        var doc = opt_doc || document;
        // Create a dummy element so that IE will allow canvas elements to be
        // recognized.
        doc.createElement('canvas');
        doc.attachEvent('onreadystatechange', bind(this.init_, this, doc));
      }
    },

    init_: function(doc) {
      // create xmlns
      if (!doc.namespaces['g_vml_']) {
        doc.namespaces.add('g_vml_', 'urn:schemas-microsoft-com:vml');
      }

      // Setup default CSS.  Only add one style sheet per document
      if (!doc.styleSheets['ex_canvas_']) {
        var ss = doc.createStyleSheet();
        ss.owningElement.id = 'ex_canvas_';
        ss.cssText = 'canvas{display:inline-block;overflow:hidden;' +
            // default size is 300x150 in Gecko and Opera
            'text-align:left;width:300px;height:150px}' +
            'g_vml_\\:*{behavior:url(#default#VML)}';
      }

    },

    /**
     * Public initializes a canvas element so that it can be used as canvas
     * element from now on. This is called automatically before the page is
     * loaded but if you are creating elements using createElement you need to
     * make sure this is called on the element.
     * @param {HTMLElement} el The canvas element to initialize.
     * @return {HTMLElement} the element that was created.
     */
    i: function(el) {
      if (!el.getContext) {

        el.getContext = getContext;

        // do not use inline function because that will leak memory
        el.attachEvent('onpropertychange', onPropertyChange);
        el.attachEvent('onresize', onResize);

        var attrs = el.attributes;
        if (attrs.width && attrs.width.specified) {
          // TODO: use runtimeStyle and coordsize
          // el.getContext().setWidth_(attrs.width.nodeValue);
          el.style.width = attrs.width.nodeValue + 'px';
        } else {
          el.width = el.clientWidth;
        }
        if (attrs.height && attrs.height.specified) {
          // TODO: use runtimeStyle and coordsize
          // el.getContext().setHeight_(attrs.height.nodeValue);
          el.style.height = attrs.height.nodeValue + 'px';
        } else {
          el.height = el.clientHeight;
        }
        //el.getContext().setCoordsize_()
      }
      return el;
    }
  };

  function onPropertyChange(e) {
    var el = e.srcElement;

    switch (e.propertyName) {
      case 'width':
        el.style.width = el.attributes.width.nodeValue + 'px';
        el.getContext().clearRect();
        break;
      case 'height':
        el.style.height = el.attributes.height.nodeValue + 'px';
        el.getContext().clearRect();
        break;
    }
  }

  function onResize(e) {
    var el = e.srcElement;
    if (el.firstChild) {
      el.firstChild.style.width =  el.clientWidth + 'px';
      el.firstChild.style.height = el.clientHeight + 'px';
    }
  }

  G_vmlCanvasManager_.init();

  // precompute "00" to "FF"
  var dec2hex = [];
  for (var i = 0; i < 16; i++) {
    for (var j = 0; j < 16; j++) {
      dec2hex[i * 16 + j] = i.toString(16) + j.toString(16);
    }
  }

  function createMatrixIdentity() {
    return [
      [1, 0, 0],
      [0, 1, 0],
      [0, 0, 1]
    ];
  }

  function processStyle(styleString) {
    var str, alpha = 1;

    styleString = String(styleString);
    if (styleString.substring(0, 3) == 'rgb') {
      var start = styleString.indexOf('(', 3);
      var end = styleString.indexOf(')', start + 1);
      var guts = styleString.substring(start + 1, end).split(',');

      str = '#';
      for (var i = 0; i < 3; i++) {
        str += dec2hex[Number(guts[i])];
      }

      if (guts.length == 4 && styleString.substr(3, 1) == 'a') {
        alpha = guts[3];
      }
    } else {
      str = styleString;
    }

    return [str, alpha];
  }

  function processLineCap(lineCap) {
    switch (lineCap) {
      case 'butt':
        return 'flat';
      case 'round':
        return 'round';
      case 'square':
      default:
        return 'square';
    }
  }

  /**
   * This class implements CanvasRenderingContext2D interface as described by
   * the WHATWG.
   * @param {HTMLElement} surfaceElement The element that the 2D context should
   * be associated with
   */
  function CanvasRenderingContext2D_(surfaceElement) {
    this.m_ = createMatrixIdentity();

    this.mStack_ = [];
    this.aStack_ = [];
    this.currentPath_ = [];

    // Canvas context properties
    this.strokeStyle = '#000';
    this.fillStyle = '#000';

    this.lineWidth = 1;
    this.lineJoin = 'miter';
    this.lineCap = 'butt';
    this.miterLimit = Z * 1;
    this.globalAlpha = 1;
    this.canvas = surfaceElement;

    var el = surfaceElement.ownerDocument.createElement('div');
    el.style.width =  surfaceElement.clientWidth + 'px';
    el.style.height = surfaceElement.clientHeight + 'px';
    el.style.overflow = 'hidden';
    el.style.position = 'absolute';
    surfaceElement.appendChild(el);

    this.element_ = el;
    this.arcscaleX_ = 1;
    this.arcscaleY_ = 1;
  }

  var contextPrototype = CanvasRenderingContext2D_.prototype;
  contextPrototype.clearRect = function() {
    this.element_.innerHTML = '';
    this.currentPath_ = [];
  };

  contextPrototype.beginPath = function() {
    // TODO: Branch current matrix so that save/restore has no effect
    //       as per safari docs.
    this.currentPath_ = [];
  };

  contextPrototype.moveTo = function(aX, aY) {
    var p = this.getCoords_(aX, aY);
    this.currentPath_.push({type: 'moveTo', x: p.x, y: p.y});
    this.currentX_ = p.x;
    this.currentY_ = p.y;
  };

  contextPrototype.lineTo = function(aX, aY) {
    var p = this.getCoords_(aX, aY);
    this.currentPath_.push({type: 'lineTo', x: p.x, y: p.y});

    this.currentX_ = p.x;
    this.currentY_ = p.y;
  };

  contextPrototype.bezierCurveTo = function(aCP1x, aCP1y,
                                            aCP2x, aCP2y,
                                            aX, aY) {
    var p = this.getCoords_(aX, aY);
    var cp1 = this.getCoords_(aCP1x, aCP1y);
    var cp2 = this.getCoords_(aCP2x, aCP2y);
    this.currentPath_.push({type: 'bezierCurveTo',
                           cp1x: cp1.x,
                           cp1y: cp1.y,
                           cp2x: cp2.x,
                           cp2y: cp2.y,
                           x: p.x,
                           y: p.y});
    this.currentX_ = p.x;
    this.currentY_ = p.y;
  };

  

  contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) {
    // Will destroy any existing path (same as FF behaviour)
    this.beginPath();
    this.moveTo(aX, aY);
    this.lineTo(aX + aWidth, aY);
    this.lineTo(aX + aWidth, aY + aHeight);
    this.lineTo(aX, aY + aHeight);
    this.closePath();
    this.fill();
    this.currentPath_ = [];
  };

  contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) {
    return new CanvasGradient_('gradient');
  };

  contextPrototype.createRadialGradient = function(aX0, aY0,
                                                   aR0, aX1,
                                                   aY1, aR1) {
    var gradient = new CanvasGradient_('gradientradial');
    gradient.radius1_ = aR0;
    gradient.radius2_ = aR1;
    gradient.focus_.x = aX0;
    gradient.focus_.y = aY0;
    return gradient;
  };

  contextPrototype.stroke = function(aFill) {
    var lineStr = [];
    var lineOpen = false;
    var a = processStyle(aFill ? this.fillStyle : this.strokeStyle);
    var color = a[0];
    var opacity = a[1] * this.globalAlpha;

    var W = 10;
    var H = 10;

    lineStr.push('<g_vml_:shape',
                 ' fillcolor="', color, '"',
                 ' filled="', Boolean(aFill), '"',
                 ' style="position:absolute;width:', W, ';height:', H, ';"',
                 ' coordorigin="0 0" coordsize="', Z * W, ' ', Z * H, '"',
                 ' stroked="', !aFill, '"',
                 ' strokeweight="', this.lineWidth, '"',
                 ' strokecolor="', color, '"',
                 ' path="');

    var newSeq = false;
    var min = {x: null, y: null};
    var max = {x: null, y: null};

    for (var i = 0; i < this.currentPath_.length; i++) {
      var p = this.currentPath_[i];
      var c;

      switch (p.type) {
        case 'moveTo':
          lineStr.push(' m ');
          c = p;
          lineStr.push(mr(p.x), ',', mr(p.y));
          break;
        case 'lineTo':
          lineStr.push(' l ');
          lineStr.push(mr(p.x), ',', mr(p.y));
          break;
        case 'close':
          lineStr.push(' x ');
          p = null;
          break;
        case 'bezierCurveTo':
          lineStr.push(' c ');
          lineStr.push(mr(p.cp1x), ',', mr(p.cp1y), ',',
                       mr(p.cp2x), ',', mr(p.cp2y), ',',
                       mr(p.x), ',', mr(p.y));
          break;
        case 'at':
        case 'wa':
          lineStr.push(' ', p.type, ' ');
          lineStr.push(mr(p.x - this.arcscaleX_ * p.radius), ',',
                       mr(p.y - this.arcscaleY_ * p.radius), ' ',
                       mr(p.x + this.arcscaleX_ * p.radius), ',',
                       mr(p.y + this.arcscaleY_ * p.radius), ' ',
                       mr(p.xStart), ',', mr(p.yStart), ' ',
                       mr(p.xEnd), ',', mr(p.yEnd));
          break;
      }


      // TODO: Following is broken for curves due to
      //       move to proper paths.

      // Figure out dimensions so we can do gradient fills
      // properly
      if (p) {
        if (min.x == null || p.x < min.x) {
          min.x = p.x;
        }
        if (max.x == null || p.x > max.x) {
          max.x = p.x;
        }
        if (min.y == null || p.y < min.y) {
          min.y = p.y;
        }
        if (max.y == null || p.y > max.y) {
          max.y = p.y;
        }
      }
    }
    lineStr.push(' ">');

    if (typeof this.fillStyle == 'object') {
      var focus = {x: '50%', y: '50%'};
      var width = max.x - min.x;
      var height = max.y - min.y;
      var dimension = width > height ? width : height;

      focus.x = mr(this.fillStyle.focus_.x / width * 100 + 50) + '%';
      focus.y = mr(this.fillStyle.focus_.y / height * 100 + 50) + '%';

      var colors = [];

      // inside radius (%)
      if (this.fillStyle.type_ == 'gradientradial') {
        var inside = this.fillStyle.radius1_ / dimension * 100;

        // percentage that outside radius exceeds inside radius
        var expansion = this.fillStyle.radius2_ / dimension * 100 - inside;
      } else {
        var inside = 0;
        var expansion = 100;
      }

      var insidecolor = {offset: null, color: null};
      var outsidecolor = {offset: null, color: null};

      // We need to sort 'colors' by percentage, from 0 > 100 otherwise ie
      // won't interpret it correctly
      this.fillStyle.colors_.sort(function(cs1, cs2) {
        return cs1.offset - cs2.offset;
      });

      for (var i = 0; i < this.fillStyle.colors_.length; i++) {
        var fs = this.fillStyle.colors_[i];

        colors.push(fs.offset * expansion + inside, '% ', fs.color, ',');

        if (fs.offset > insidecolor.offset || insidecolor.offset == null) {
          insidecolor.offset = fs.offset;
          insidecolor.color = fs.color;
        }

        if (fs.offset < outsidecolor.offset || outsidecolor.offset == null) {
          outsidecolor.offset = fs.offset;
          outsidecolor.color = fs.color;
        }
      }
      colors.pop();

      lineStr.push('<g_vml_:fill',
                   ' color="', outsidecolor.color, '"',
                   ' color2="', insidecolor.color, '"',
                   ' type="', this.fillStyle.type_, '"',
                   ' focusposition="', focus.x, ', ', focus.y, '"',
                   ' colors="', colors.join(''), '"',
                   ' opacity="', opacity, '" />');
    } else if (aFill) {
      lineStr.push('<g_vml_:fill color="', color, '" opacity="', opacity,
                   '" />');
    } else {
      var lineWidth = Math.max(this.arcscaleX_, this.arcscaleY_) *
          this.lineWidth;
      lineStr.push(
        '<g_vml_:stroke',
        ' opacity="', opacity, '"',
        ' joinstyle="', this.lineJoin, '"',
        ' miterlimit="', this.miterLimit, '"',
        ' endcap="', processLineCap(this.lineCap), '"',
        ' weight="', lineWidth, 'px"',
        ' color="', color, '" />'
      );
    }

    lineStr.push('</g_vml_:shape>');

    this.element_.insertAdjacentHTML('beforeEnd', lineStr.join(''));
  };

  contextPrototype.fill = function() {
    this.stroke(true);
  };

  contextPrototype.closePath = function() {
    this.currentPath_.push({type: 'close'});
  };

  contextPrototype.getCoords_ = function(aX, aY) {
    return {
      x: Z * (aX * this.m_[0][0] + aY * this.m_[1][0] + this.m_[2][0]) - Z2,
      y: Z * (aX * this.m_[0][1] + aY * this.m_[1][1] + this.m_[2][1]) - Z2
    }
  };

  function CanvasPattern_() {}

  // set up externs
  G_vmlCMjrc = G_vmlCanvasManager_;
  //CanvasRenderingContext2D = CanvasRenderingContext2D_;
  //CanvasGradient = CanvasGradient_;
  //CanvasPattern = CanvasPattern_;

})();

} // if


if (jQuery.browser.msie) {
	document.execCommand("BackgroundImageCache", false, true);
}

		
(function($){
		
	var isMSIE = $.browser.msie;
	var isltMSIE7 = isMSIE && !window.XMLHttpRequest;
	var isOpera = $.browser.opera;
	var canvasSupport = typeof document.createElement('canvas').getContext == "function";
	
	// get number as integer
	var Num = function(i) { return parseInt(i,10) || 0; };
		
	// get lowest number from array
	/*
	var asNum = function(a, b) { return a-b; };
	var getMin = function(a) {
		var b = a.concat();
		return b.sort(asNum)[0];
	};*/
	
	// a basic replacement for jquery .css()
	// getStyle(elm,BorderTopWidth,border-top-width)
	var getStyle = function(el,styleProp,styleProp2) {
		var x = el,y;
		if (x.currentStyle) {
			y = x.currentStyle[styleProp];
		} else if (window.getComputedStyle) {
			if (typeof arguments[2] == "string") styleProp = styleProp2;
			y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
		}
		return y;
	};
	
	var getBorderColor = function (elm,p) {
		return getStyle(elm,'border'+p+'Color','border-'+p.toLowerCase()+'-color')
	};

	var getBorderWidth = function(elm,p) {

		if (elm.currentStyle && !isOpera) {
			w = elm.currentStyle['border'+p+'Width'];
			if (w == 'thin') w = 2;
			if (w == 'medium' && !(elm.currentStyle['border'+p+'Style'] == 'none')) w = 4;
			if (w == 'thick') w = 6;
		} else {
			p = p.toLowerCase();
			w = document.defaultView.getComputedStyle(elm,null).getPropertyValue('border-'+p+'-width');
		}
		return Num(w);
	};
	
	var isElm = function(elm,i) {
		return elm.tagName.toLowerCase() == i;
	};
	
	var rotationSteps = function(r_type,a,b,c,d) {
		if (r_type == 'tl') return a;
		if (r_type == 'tr') return b;
		if (r_type == 'bl') return c;
		if (r_type == 'br') return d;
	};
	
	// draw the round corner in Canvas object
	var drawCorner = function(canvas,radius,r_type,bg_color,border_width,border_color,corner_effect) {
		
		var steps,curve_to;
		
		// change rgba(1,2,3,0.9) to rgb(1,2,3)
		if (bg_color.indexOf('rgba') != -1) {
			var reg = /^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/;   
			var bits = reg.exec(bg_color);
			if (bits) {
				var channels = [Num(bits[1]),Num(bits[2]),Num(bits[3])];
				bg_color = 'rgb('+channels[0]+', '+channels[1]+', '+channels[2]+')';
			} 
		}
		
		var ctx = canvas.getContext('2d');
		
		if (radius == 1 || corner_effect == 'notch') {
			
			if (border_width > 0 && radius > 1) {
				ctx.fillStyle = border_color;
				ctx.fillRect(0,0,radius,radius);
				ctx.fillStyle = bg_color;
				steps = rotationSteps(r_type,[0-border_width,0-border_width],[border_width,0-border_width],[0-border_width,border_width],[border_width,border_width]);
				ctx.fillRect(steps[0],steps[1],radius,radius);
			} else {
				ctx.fillStyle = bg_color;
				ctx.fillRect(0,0,radius,radius);
			}
			return canvas;
		} else if (corner_effect == 'bevel') {
			steps = rotationSteps(r_type,[0,0,0,radius,radius,0,0,0],[0,0,radius,radius,radius,0,0,0],[0,0,radius,radius,0,radius,0,0],[radius,radius,radius,0,0,radius,radius,radius]);
			ctx.fillStyle = bg_color;
			ctx.beginPath();
			ctx.moveTo(steps[0],steps[1]);
			ctx.lineTo(steps[2], steps[3]);
			ctx.lineTo(steps[4], steps[5]);
			ctx.lineTo(steps[6], steps[7]);
			ctx.fill(); 
			if (border_width > 0 && border_width < radius) {
				ctx.strokeStyle = border_color;
	        	ctx.lineWidth = border_width;
    			ctx.beginPath();
				steps = rotationSteps(r_type,[0,radius,radius,0],[0,0,radius,radius],[radius,radius,0,0],[0,radius,radius,0]);
    			ctx.moveTo(steps[0],steps[1]);
				ctx.lineTo(steps[2],steps[3]);
    			ctx.stroke();
			}
			return canvas;
		}

		steps = rotationSteps(r_type,
					[0,0,radius,0,radius,0,0,radius,0,0],
					[radius,0,radius,radius,radius,0,0,0,0,0],
					[0,radius,radius,radius,0,radius,0,0,0,radius],
					[radius,radius,radius,0,radius,0,0,radius,radius,radius]);
         
		ctx.fillStyle = bg_color;
    	ctx.beginPath();
     	ctx.moveTo(steps[0],steps[1]); 
     	ctx.lineTo(steps[2], steps[3]);
    	if(r_type == 'br') ctx.bezierCurveTo(steps[4], steps[5], radius, radius, steps[6], steps[7]);
    	else ctx.bezierCurveTo(steps[4], steps[5], 0, 0, steps[6], steps[7]);
		ctx.lineTo(steps[8], steps[9]);
        ctx.fill(); 
         
        // draw border
        if (border_width > 0 && border_width < radius) {
	        
	        // offset caused by border
	        var offset = border_width/2; 
	        var ro = radius-offset;
			steps = rotationSteps(r_type,
				[ro,offset,ro,offset,offset,ro],
				[ro,ro,ro,offset,offset,offset],
				[ro,ro,offset,ro,offset,offset,offset,ro],
				[ro,offset,ro,offset,offset,ro,ro,ro]	
			);

			curve_to = rotationSteps(r_type,[0,0],[0,0],[0,0],[radius, radius]);

	        ctx.strokeStyle = border_color;
	        ctx.lineWidth = border_width;
    		ctx.beginPath();
    		// go to corner to begin curve
     		ctx.moveTo(steps[0], steps[1]); 
     		// curve from righttop to leftbottom (for the tl canvas)
    		ctx.bezierCurveTo(steps[2], steps[3], curve_to[0], curve_to[1], steps[4], steps[5]); 
			ctx.stroke();
	        
	    }
	    
	    return canvas;
	    
	};
	
	// create and append canvas element to parent
	var createCanvas = function(p,radius) {
		
		var elm = document.createElement('canvas');
		elm.setAttribute("height", radius);
		elm.setAttribute("width", radius); 
	    elm.style.display = "block";
		elm.style.position = "absolute";
		elm.className = "jrCorner";
		
		appendToParent(p,elm);
		
		if (!canvasSupport && isMSIE) { // no native canvas support
			if (typeof G_vmlCanvasManager == "object") { // use excanvas
				elm = G_vmlCanvasManager.initElement(elm);
			} else if (typeof G_vmlCMjrc == "object") { // use the stipped down version of excanvas
				elm = G_vmlCMjrc.i(elm);
			} else {
				 throw Error('Could not find excanvas');
			}
		}
		
		return elm;
	};
	
	var appendToParent = function(p,elm) {
		if (p.is("table")) {
			p.children("tbody").children("tr:first").children("td:first").append(elm); 
			p.css('display','block'); // only firefox seems to need this
		} else if(p.is("td")) {
			if (p.children(".JrcTdContainer").length === 0) {
				// only is msie you can absolute position a element inside a table cell, so we need a wrapper
				p.html('<div class="JrcTdContainer" style="padding:0px;position:relative;margin:-1px;zoom:1;">'+p.html()+'</div>');
				p.css('zoom','1');
				if (isltMSIE7) { //  msie6 only
					p.children(".JrcTdContainer").get(0).style.setExpression("height","this.parentNode.offsetHeight"); 
				}
				
			} 
			p.children(".JrcTdContainer").append(elm); 
			
		} else {
			p.append(elm); 
		}

	};
	
	// hide corners in ie print
	// (using canvas {display:none} doesnt work)
	if (isMSIE) {
		var ss = document.createStyleSheet(); 
		ss.media = 'print';
    	ss.cssText = '.jrcIECanvasDiv { display:none !important; }';
    }
	
    // $.corner function
	var _corner = function(options) {
		
		// nothing to do || no support for native canvas or excanvas
		if (this.length==0 || !(canvasSupport || isMSIE)) {
			return this;
		}	
		
		if (options == "destroy") {
			return this.each(function() {
				var p, elm = $(this);
				if (elm.is(".jrcRounded")) {
					if (typeof elm.data("ie6tmr.jrc") == 'number') window.clearInterval(elm.data("ie6tmr.jrc"));
					if (elm.is("table")) p = elm.children("tbody").children("tr:first").children("td:first");
					else if (elm.is("td")) p = elm.children(".JrcTdContainer");
					else p = elm;
					p.children(".jrCorner").remove();
					elm.unbind('mouseleave.jrc').unbind('mouseenter.jrc').removeClass('jrcRounded').removeData('ie6tmr.jrc');
					if (elm.is("td")) elm.html(elm.children(".JrcTdContainer").html());
				}
			});
		}
			
		// interpret the (string) argument
   		var o = (options || "").toLowerCase();
   		var radius = Num((o.match(/(\d+)px/)||[])[1]) || "auto"; // corner width
   		var bg_arg = ((o.match(/(#[0-9a-f]+)/)||[])[1]) || "auto";  // strip color
   		var re = /round|bevel|notch/; // Corner Effects
    	var fx = ((o.match(re)||['round'])[0]);
    	var hover = /hover/.test(o);
    	var overSized = /oversized/.test(o);
    	var hiddenparent_arg = o.match("hiddenparent");
    	if (isMSIE) {
    		var re = /ie6nofix|ie6fixinit|ie6fixexpr|ie6fixonload|ie6fixwidthint|ie6fixheightint|ie6fixbothint/; // Type of iefix
    		var ie6Fix = ((o.match(re)||['ie6fixinit'])[0]);
    	} 	
    	
   		//var edges = { T:0, B:1 };
    	var opts = {
        	tl:  /top|left|tl/.test(o),       
        	tr:  /top|right|tr/.test(o),
        	bl:  /bottom|left|bl/.test(o),    
        	br:  /bottom|right|br/.test(o)
    	};
    	
    	// round all corners if nothing is set
    	if ( !opts.tl && !opts.tr && !opts.bl && !opts.br) opts = { tl:1, tr:1, bl:1, br:1 };
    	       	
		this.each(function() {

			var elm = $(this),rbg=null,bg,s,b,pr;
			var a = this;
			var elm_display = getStyle(this,'display');
			var elm_position = getStyle(this,'position');
			var elm_lineheight = getStyle(this,'lineHeight','line-height');
					
			if (bg_arg == "auto") { // no background color of the parent is set ...
				s = elm.siblings(".jrcRounded:eq(0)");
				if (s.length > 0) { // sibling already has the parent background color stored?
					b = s.data("rbg.jrc");
					if (typeof b == "string") {
						rbg = b;
					}
				}
			}
			
			if (hiddenparent_arg || rbg === null) {
				// temporary show hidden parent (wm.morgun) + search for background color
				var current_p = this.parentNode, hidden_parents = new Array(),a = 0;
				while( (typeof current_p == 'object') && !isElm(current_p,'html') ) {
					
					if (hiddenparent_arg && getStyle(current_p,'display') == 'none') {
						hidden_parents.push({
							originalvisibility: getStyle(current_p,'visibility'),
							elm: current_p
						});
						current_p.style.display = 'block';
						current_p.style.visibility = 'hidden';
					}
					var pbg = getStyle(current_p,'backgroundColor','background-color');
					if (rbg === null && pbg != "transparent" && pbg != "rgba(0, 0, 0, 0)") {
						rbg = pbg;
					}
					
					current_p = current_p.parentNode;
	
				}
				
				if (rbg === null) rbg = "#ffffff";
			}
			
			// store the parent background color
			if (bg_arg == "auto") {
				bg = rbg;
				elm.data("rbg.jrc",rbg);
			} else {
				bg = bg_arg;
			}
			
			// if element is hidden we cant get the size..
			if (elm_display == 'none') {
				var originalvisibility = getStyle(this,'visibility');
				this.style.display = 'block';
				this.style.visibility = 'hidden';
				var ishidden = true;
			} else {
				var ishiddden = false;
			}
			
			// save width/height
			var elm_height = elm.height();
			var elm_width = elm.width();
			
			// hover (optional argument - for a alterative to #roundedelement:hover)
			if (hover) {
				
				var newOptions = o.replace(/hover|ie6nofix|ie6fixinit|ie6fixexpr|ie6fixonload|ie6fixwidthint|ie6fixheightint|ie6fixbothint/g, "");
				if (ie6Fix != 'ie6nofix') newOptions = "ie6fixinit "+newOptions;
				
				elm.bind("mouseenter.jrc", function(){
					elm.addClass('jrcHover');
					elm.corner(newOptions);
				});
				elm.bind("mouseleave.jrc", function(){
					elm.removeClass('jrcHover');
					elm.corner(newOptions);
				});
				
			}
			
	   		// msie6 rendering bugs 
			if (isltMSIE7 && ie6Fix != 'ie6nofix') {
				
				this.style.zoom = 1;
				
				//if (this.currentStyle['height'] == 'auto') {
				//	elm.height(elm_height); 
				//}
				
				// http://www.pmob.co.uk/temp/onepxgap.htm
				if (ie6Fix != 'ie6fixexpr') {
					if (elm.width()%2 != 0)elm.width(elm.width()+1);
			 		if (elm.height()%2 != 0) elm.height(elm.height()+1);
			 	}

			 	$(window).load(function () {
					 	if (ie6Fix == 'ie6fixonload') {
							if (elm.css('height') == 'auto') elm.height(elm.css('height')); 
				 			if (elm.width()%2 != 0) elm.width(elm.width()+1);
				 			if (elm.height()%2 != 0) elm.height(elm.height()+1);
			 			} else if (ie6Fix == 'ie6fixwidthint' || ie6Fix == 'ie6fixheightint' || ie6Fix == 'ie6fixbothint') {
				 			var myInterval,ie6FixFunction;
				 			if (ie6Fix == 'ie6fixheightint') {
					 			ie6FixFunction = function () {
									elm.height('auto');
									var elm_height = elm.height();
									if (elm_height%2 != 0) elm_height = elm_height+1;
		  							elm.css({height:elm_height}); 
								};
							} else if (ie6Fix == 'ie6fixwidthint') {
								ie6FixFunction = function () {
									elm.width('auto');
									var elm_width = elm.width();
		  							if (elm_width%2 != 0) elm_width = elm_width+1;
		  							elm.css({width:elm_width}); 
		  							elm.data('lastWidth.jrc',elm.get(0).offsetWidth);
								};
							} else if(ie6Fix == 'ie6fixbothint') {
								ie6FixFunction = function () {
									elm.width('auto');
									elm.height('auto');
									var elm_width = elm.width();
									var elm_height = elm.height();
									if (elm_height%2 != 0) elm_height = elm_height+1;
		  							if (elm_width%2 != 0) elm_width = elm_width+1;
		  							elm.css({width:elm_width,height:elm_height}); 
								};
							} 
							myInterval = window.setInterval(ie6FixFunction,100);
							elm.data("ie6tmr.jrc",myInterval);
				 		}
    			});

			 	// ie6fixwidthint|ie6fixheightint
			 	
			 	//this.style.setExpression("height","parseInt(this.clientHeight) % 2 != 0 ? parseInt(this.style.height)-1 : parseInt(this.style.height)"); 
			 	//alert(this.style.height);
			 	//if (elm_lineheight != 'normal' && elm_height < elm_lineheight) {
				// 	elm.css('lineHeight', elm_height);
				//}
			}
			
			// get lowest height/width
			/*
			var arr = [this.offsetHeight,this.offsetWidth];
			if (elm_height != 0) arr[arr.length] = elm_height;
			if (elm_width != 0) arr[arr.length] = elm_width;
			var widthHeightSmallest = getMin(arr);*/
			
			var widthHeightSmallest = elm_height < elm_width ? this.offsetHeight : this.offsetWidth;
			
			
			// the size of the corner is not defined...
			if (radius == "auto") {
				radius = widthHeightSmallest/2;
				if (radius > 10) radius = widthHeightSmallest/4; 
			}

			// the size of the corner can't be to high
			if (radius > widthHeightSmallest/2 && !overSized) {
				radius = widthHeightSmallest/2;
			}
			
			radius = Math.floor(radius);
			
			// get border width
			var border_t = getBorderWidth(this, 'Top');
			var border_r = getBorderWidth(this, 'Right');
			var border_b = getBorderWidth(this, 'Bottom');
			var border_l = getBorderWidth(this, 'Left');
			
			// some css thats required in order to position the canvas elements
			if (elm_position == 'static' && !isElm(this,'td')) { 
				//elm.css('position','relative'); 
				this.style.position = 'relative';
			// only needed for ie6 and (ie7 in Quirks mode) , CSS1Compat == Strict mode
			} else if (elm_position == 'fixed' && isMSIE && !(document.compatMode == 'CSS1Compat' && !isltMSIE7)) { 
				//elm.css('position','absolute');
				this.style.position = 'absolute';
			}
			
			// overflow hidden + border makes the real borders at the corners visible
			// so we set overflow to visible when it has borders
			if (border_t+border_r+border_b+border_l > 0) {
				//elm.css('overflow','visible');
				this.style.overflow = 'visible';
			}
			
			// restore css
			if (ishidden) elm.css({display:'none',visibility:originalvisibility});
			
			//  restore css of hidden parents
			if (typeof hidden_parents != "undefined") {
				for (var i = 0; i < hidden_parents.length; i++) {
					hidden_parents[i].elm.style.display = 'none';
					hidden_parents[i].elm.style.visibility = hidden_parents[i].originalvisibility;
				}
			}	
			
			var p_top = 0-border_t, 
				p_right = 0-border_r, 
				p_bottom = 0-border_b,
				p_left = 0-border_l;
				
			var mhc = (elm.find("canvas").length > 0);
			
			if (mhc) {
				// pr is the parent of the canvas elements
				if (isElm(this,'table')) pr = elm.children("tbody").children("tr:first").children("td:first");
				else if (isElm(this,'td')) pr = elm.children(".JrcTdContainer");
				else pr = elm;
			}
	
			// draw Corners in canvas elements (createCanvas also appends it to parent)
			if (opts.tl) { 
				// use lowest border size
				bordersWidth = border_t < border_l ? border_t : border_l;
				// remove old corner
				if (mhc) pr.children("canvas.jrcTL").remove(); 
				// create,append and draw corner
				var tl = drawCorner(createCanvas(elm,radius),radius,'tl',bg,bordersWidth,getBorderColor(this,'Top'),fx); 
				// position corner
				$(tl).css({left:p_left,top:p_top}).addClass('jrcTL'); 
			}
			if (opts.tr) { 
				bordersWidth = border_t < border_r ? border_t : border_r;
				if (mhc) pr.children("canvas.jrcTR").remove();
				var tr = drawCorner(createCanvas(elm,radius),radius,'tr',bg,bordersWidth,getBorderColor(this,'Top'),fx); 
				$(tr).css({right:p_right,top:p_top}).addClass('jrcTR'); 
			}
			if (opts.bl) { 
				bordersWidth = border_b < border_l ? border_b : border_l;
				if (mhc) pr.children("canvas.jrcBL").remove();
				var bl = drawCorner(createCanvas(elm,radius),radius,'bl',bg,bordersWidth,getBorderColor(this,'Bottom'),fx);
				$(bl).css({left:p_left,bottom:p_bottom}).addClass('jrcBL');  
			}
			if (opts.br) { 
				bordersWidth = border_b < border_r ? border_b : border_r;
				if (mhc) pr.children("canvas.jrcBR").remove();
				var br = drawCorner(createCanvas(elm,radius),radius,'br',bg,bordersWidth,getBorderColor(this,'Bottom'),fx);
				$(br).css({right:p_right,bottom:p_bottom}).addClass('jrcBR');
			}
			
			// we need this to hide it in ie print
			if (isMSIE) elm.children('canvas.jrCorner').children('div').addClass('jrcIECanvasDiv');
			
			// based on fix: http://www.ilikespam.com/blog/the-odd-pixel-bug
			if (isltMSIE7 && ie6Fix == 'ie6fixexpr') {
				if (opts.bl) {
					bl.style.setExpression("bottom","this.parentNode.offsetHeight % 2 == 0 || this.parentNode.offsetWidth % 2 == 0 ? 0-(parseInt(this.parentNode.currentStyle['borderBottomWidth'])) : 0-(parseInt(this.parentNode.currentStyle['borderBottomWidth'])+1)");
				}
				if (opts.br) {
					br.style.setExpression("right", "this.parentNode.offsetWidth  % 2 == 0 || this.parentNode.offsetWidth % 2 == 0 ? 0-(parseInt(this.parentNode.currentStyle['borderRightWidth']))  : 0-(parseInt(this.parentNode.currentStyle['borderRightWidth'])+1)");
					br.style.setExpression("bottom","this.parentNode.offsetHeight % 2 == 0 || this.parentNode.offsetWidth % 2 == 0 ? 0-(parseInt(this.parentNode.currentStyle['borderBottomWidth'])) : 0-(parseInt(this.parentNode.currentStyle['borderBottomWidth'])+1)");
				}
				if (opts.tr) {
					tr.style.setExpression("right","this.parentNode.offsetWidth   % 2 == 0 || this.parentNode.offsetWidth % 2 == 0 ? 0-(parseInt(this.parentNode.currentStyle['borderRightWidth']))  : 0-(parseInt(this.parentNode.currentStyle['borderRightWidth'])+1)");
				}	
			}
			
			elm.addClass('jrcRounded');
			
				
   		});  
   		
   		// callback function (is called when the last element is rounded)
		if (typeof arguments[1] == "function") arguments[1](this); 
   		return this;
   		
	};
	
	$.fn.corner = _corner;
	
})(jQuery);

// 延迟载入图片
(function($) {

    $.fn.lazyload = function(options) {
        var settings = {
            threshold    : 0,
            failurelimit : 0,
            event        : "scroll",
            effect       : "show",
            container    : window
        };
                
        if(options) {
            $.extend(settings, options);
        }

        /* Fire one scroll event per scroll. Not one scroll event per image. */
        var elements = this;
        if ("scroll" == settings.event) {
            $(settings.container).bind("scroll", function(event) {
                var counter = 0;
                elements.each(function() {
                    if (!$.belowthefold(this, settings) &&
                        !$.rightoffold(this, settings)) {
                            $(this).trigger("appear");
                    } else {
                        if (counter++ > settings.failurelimit) {
                            return false;
                        }
                    }
                });
                /* Remove image from array so it is not looped next time. */
                var temp = $.grep(elements, function(element) {
                    return !element.loaded;
                });
                elements = $(temp);
            });
        }
        
        return this.each(function() {
            var self = this;
            /* TODO: use .data() instead of .attr() */
            $(self).attr("original", $(self).attr("src"));
            if ("scroll" != settings.event 
                         || $.belowthefold(self, settings) 
                         || $.rightoffold(self, settings)) {
                if (settings.placeholder) {
                    $(self).attr("src", settings.placeholder);      
                } else {
                    $(self).removeAttr("src");
                }
                self.loaded = false;
            } else {
                self.loaded = true;
            }
            
            /* When appear is triggered load original image. */
            $(self).one("appear", function() {
                if (!this.loaded) {
                    $("<img />")
                        .bind("load", function() {
                            $(self)
                                .hide()
                                .attr("src", $(self).attr("original"))
                                [settings.effect](settings.effectspeed);
                            self.loaded = true;
                        })
                        .attr("src", $(self).attr("original"));
                };
            });

            /* When wanted event is triggered load original image */
            /* by triggering appear.                              */
            if ("scroll" != settings.event) {
                $(self).bind(settings.event, function(event) {
                    if (!self.loaded) {
                        $(self).trigger("appear");
                    }
                });
            }
        });

    };

    /* Convenience methods in jQuery namespace.           */
    /* Use as  $.belowthefold(element, {threshold : 100, container : window}) */

    $.belowthefold = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).height() + $(window).scrollTop();
        }
        else {
            var fold = $(settings.container).offset().top + $(settings.container).height();
        }
        return fold <= $(element).offset().top - settings.threshold;
    };
    
    $.rightoffold = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).width() + $(window).scrollLeft();
        }
        else {
            var fold = $(settings.container).offset().left + $(settings.container).width();
        }
        return fold <= $(element).offset().left - settings.threshold;
    };
    
    /* Custom selectors for your convenience.   */
    /* Use as $("img:below-the-fold").something() */

    $.extend($.expr[':'], {
        "below-the-fold" : "$.belowthefold(a, {threshold : 0, container: window})",
        "above-the-fold" : "!$.belowthefold(a, {threshold : 0, container: window})",
        "right-of-fold"  : "$.rightoffold(a, {threshold : 0, container: window})",
        "left-of-fold"   : "!$.rightoffold(a, {threshold : 0, container: window})"
    });
    
})(jQuery);