var istRollOver = {
	preloadedImages:new Array(),
	preloadImage:function(uri){
		var plength = istRollOver.preloadedImages.length
		istRollOver.preloadedImages[plength] = new Image();
		istRollOver.preloadedImages[plength].src = uri;
	},
	AlphaImage:function(elem, prop){
			elem.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + elem[prop] + ",sizingMethod=scale);width:" + elem.width + "px;height:" + elem.height + "px;display:block;";		
	},
	ie6PNG:function(src){
		if(jQuery.browser.msie && jQuery.browser.version < 7 && src.indexOf('.png') > -1){
			return true;
		}else{
			return false;
		}
	},
	setRollOver:function(){
		var stayClass = "";
	
		var conf = {id:"blank", blank:""}
		
		jQuery(".imgover").each(function(){
			this.oSrc = this.src;
			this.rSrc = this.oSrc.replace(/(\.gif|\.jpg|\.png)/, "_o" + "$1");
			istRollOver.preloadImage(this.rSrc);
			if(this.src.indexOf(conf.id + stayClass) > -1){
				this.sSrc = this.oSrc.replace(/(\.gif|\.jpg|\.png)/, "_o" + "$1");
				istRollOver.preloadImage(this.sSrc);
				
				if(istRollOver.ie6PNG(this.src)){
					this.src = conf.blank;
					istRollOver.AlphaImage(this, "sSrc");
				}else{
					this.src = this.sSrc;
				}
			}else{
				if(istRollOver.ie6PNG(this.src)){
					this.src = conf.blank;
					istRollOver.AlphaImage(this, "oSrc");
					
					jQuery(this).hover(function(){
						istRollOver.AlphaImage(this, "rSrc");
					},function(){
						istRollOver.AlphaImage(this, "oSrc");
					});
				}else{
					jQuery(this).hover(function(){
						this.src = this.rSrc;
					},function(){
						this.src = this.oSrc;
					});	
				}
			}
		});		
	}
}

jQuery(function(){
	istRollOver.setRollOver();
	var imagesArray = [];
	jQuery("a").each(function(){
		var imgObj = jQuery(this).find("img");
		var src = jQuery(imgObj).attr("src");
		if(src != undefined){
			var varArray = [this.href, imgObj];
			imagesArray.push(varArray);
		}
	});
	jQuery("area.areaover").each(function(){
		var ahref = this.href;
		for(var i = 0; i< imagesArray.length; i++){
			var areahref = imagesArray[i][0];
			if(ahref == areahref){
				this.obj = imagesArray[i][1];
				jQuery(this).hover(function(){
					if(this.oSrc == undefined){
						this.oSrc = jQuery(this.obj).attr("src");
						this.rSrc= this.oSrc.replace(/(\.gif|\.jpg|\.png)/, "_o" + "$1");
					}
					jQuery(this.obj).attr("src", this.rSrc);
				},function(){
					jQuery(this.obj).attr("src", this.oSrc)
				});
			}
		}
	});
});

jQuery(function(){
	var _flashcontent = jQuery('#flashcontent').get(0);
	resizeContent();
	jQuery(window).resize(resizeContent);

	function resizeContent(){
		var _minH = 600;
		var _h = getWindowHeight() - 180;
		if(_h > _minH){
			_flashcontent.style.height = _h + 'px';
		} else {
			_flashcontent.style.height = _minH + 'px';
		}
	}

	function getWindowHeight() {
	if(window.innerHeight) return window.innerHeight; // Mozilla, Opera, NN4
	if(document.documentElement && document.documentElement.clientHeight){ // 以下 IE
		return document.documentElement.clientHeight;
	} else if(document.body && document.body.clientHeight){
		return document.body.clientHeight;
	}
		return 0;
	}
});