﻿//需要引用JQUERY
//myjs----------------------------------------------------------------------
$(document).ready(function(){
	alphaimg();
	$("#nav-one li").hover(function(){$("ul", this).fadeIn('slow');}, function(){});
	if(document.all){$("#nav-one li").hoverClass ("sfHover");}
	if(parseInt($(".newsreadcontent").height())<400){$(".newsreadcontent").height(400);}
	var h1=$("#allleft").height();
	var h2=$("#allright").height();
	var h3=$("#mainbody").height();
	//网页左右两边等高
	if(h1<h2){$("#allleft").css("height",h2);}
	else{$("#mainbody").css("height",h3+h1-h2)}
	//当前位置导航
	$("#mylocala").width(710-233-$("#mylocalb").width());
	$("#mylocala").text("·························································································");
	
});
jQuery.fn.hoverClass = function(c){return this.each(function(){$(this).hover(function() { $(this).addClass(c);},function() { $(this).removeClass(c);});});};

//如果是臭火夫 判断CSS样式连接 title="stylesheet" rel="stylesheet"  的 变为火夫专用CSS文件
if($.browser.mozilla) {$('link[@rel*=stylesheet][title=stylesheet]').attr("href","images/css2.css");}

window.onerror = killErrors; 

function showphoto(photoname){
	$("#fade").width($(window).width());
	$("#fade").height($(document).height());
	document.getElementById("fade").style.display="block";
	if(photoname.indexOf("/")>-1){
		$("#floatphotos img").attr("src",photoname);
	}
	else{
		$("#floatphotos img").attr("src","storepage/news/"+photoname);
	}
	$("#floatphotos img").css("margin-top",parseInt(($(window).height()-$("#floatphotos img").height())/4));
	$("#floatphotos").show('slow');
}
function closephoto(){
	$("#floatphotos").hide('slow');
	document.getElementById("fade").style.display="none";
}

//myjs----------------------------------------------------------------------


//sysjs----------------------------------------------------------------------
//屏蔽脚本错误提示
function killErrors(){ 
	return true; 
}
//物体绝对垂直居中
//obj物体  windowheight物体要垂直居中相对元素的高 objheight物体的高
function AutoCenter(obj,windowheight,objheight){ 
	if(windowheight>objheight){			
		obj.each(function(){
			$(this).css("margin-top",parseInt((windowheight-objheight)/2)+"px");
		});
	}
}

//设置图片半透明效果 需要给要半透明的图片加上 name=alphaimg 的属性
function alphaimg(){
	var objimg = document.getElementsByName("alphaimg");
	if (typeof(objimg)!="undefined" && objimg!=null){
		
		for(var i=0;i<objimg.length;i++){
			objimg[i].style.cssText="-moz-opacity:0.8;filter:alpha(opacity=80);";
			objimg[i].onmouseover=function(){this.style.MozOpacity=1;this.filters.alpha.opacity=100;};
			objimg[i].onmouseout=function(){this.style.MozOpacity=0.8;this.filters.alpha.opacity=80;};
		}
	}
}

//设置图片不变形
function Shapeimg(obj,maxheight,maxwidth){
	obj.each(function(){
		myheight=$(this).height();
		mywidth=$(this).width();
	});
}



 
