// JavaScript Document
//主要JS
$(document).ready(function(){
	var sLan = $.cookie("sLan");
	//alert(sLan);		
})

function set_lan(Lan)
{
	if(Lan=="zh_cn")
	{
		$.cookie("sLan","zh_cn",{path:'/',expires: 7});
	}
	if(Lan=="en_us")
	{
		$.cookie("sLan","en_us",{path:'/',expires: 7});
	}
	window.location.reload();
}

function DrawImage(MyPic, W, H) {
	var flag = false;
	var image = new Image();
	image.src = MyPic.src;
   
	if (image.width > 0 && image.height > 0) {
		flag = true;
		if (image.width / image.height >= W / H) {
			if (image.width > W) {
				MyPic.width = W;
				MyPic.height = (image.height * W) / image.width;
			}
			else {
				MyPic.width = image.width;
				MyPic.height = image.height;
			}
		}
		else {
			if (image.height > H) {
				MyPic.height = H;
				MyPic.width = (image.width * H) / image.height;
			}
			else {
				MyPic.width = image.width;
				MyPic.height = image.height;
			}
		}
	}
}

function bookmarkit()
{
	window.external.addFavorite('http://www.norking.net/','诺金电气设备中心！')
}

function addHome()
{
    if (window.sidebar) 
    {
        try {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
        }
        catch (e)
        {
            alert("此操作被浏览器拒绝!"); 
        }
        var prefs =  Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch );
        prefs.setCharPref("browser.startup.homepage",'http://www.norking.net/');
    }
    else if(document.all)
    {
        document.body.style.behavior="url(#default#homepage)";
        document.body.setHomePage('http://www.norking.net/');
    }
    else
    {
        ;
    }
}

function DrawImage(ImgD,FitWidth,FitHeight) 
{ 
	var image=new Image(); 
	image.src=ImgD.src;
	
	if ( image.height <= image.width )
	{
		if ( FitWidth < image.width )
		{
			ImgD.width = FitWidth;
			ImgD.height = FitHeight * ( image.height / image.width );
		}
		else
		{
			ImgD.width = image.width;
			ImgD.height = image.height;
		}
	}
	else if ( FitHeight < image.height )
	{
		ImgD.height = FitHeight;
		ImgD.width = FitHeight * ( image.width / image.height );
	}
	else
	{
		ImgD.width = image.width;
		ImgD.height = image.height;
	}
}

function RefreshImage(ImgD){
var image=new Image(); 
ImgD.src=ImgD.src+'?';
}

//==========================================
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';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}};
eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'([237-9n-zA-Z]|1\\w)'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(s(m){3.fn.pngFix=s(c){c=3.extend({P:\'blank.gif\'},c);8 e=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 5.5")!=-1);8 f=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 6.0")!=-1);p(3.browser.msie&&(e||f)){3(2).B("img[n$=.C]").D(s(){3(2).7(\'q\',3(2).q());3(2).7(\'r\',3(2).r());8 a=\'\';8 b=\'\';8 g=(3(2).7(\'E\'))?\'E="\'+3(2).7(\'E\')+\'" \':\'\';8 h=(3(2).7(\'F\'))?\'F="\'+3(2).7(\'F\')+\'" \':\'\';8 i=(3(2).7(\'G\'))?\'G="\'+3(2).7(\'G\')+\'" \':\'\';8 j=(3(2).7(\'H\'))?\'H="\'+3(2).7(\'H\')+\'" \':\'\';8 k=(3(2).7(\'V\'))?\'float:\'+3(2).7(\'V\')+\';\':\'\';8 d=(3(2).parent().7(\'href\'))?\'cursor:hand;\':\'\';p(2.9.v){a+=\'v:\'+2.9.v+\';\';2.9.v=\'\'}p(2.9.w){a+=\'w:\'+2.9.w+\';\';2.9.w=\'\'}p(2.9.x){a+=\'x:\'+2.9.x+\';\';2.9.x=\'\'}8 l=(2.9.cssText);b+=\'<y \'+g+h+i+j;b+=\'9="W:X;white-space:pre-line;Y:Z-10;I:transparent;\'+k+d;b+=\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;\';b+=\'J:K:L.t.M(n=\\\'\'+3(2).7(\'n\')+\'\\\', N=\\\'O\\\');\';b+=l+\'"></y>\';p(a!=\'\'){b=\'<y 9="W:X;Y:Z-10;\'+a+d+\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;">\'+b+\'</y>\'}3(2).hide();3(2).after(b)});3(2).B("*").D(s(){8 a=3(2).11(\'I-12\');p(a.A(".C")!=-1){8 b=a.13(\'url("\')[1].13(\'")\')[0];3(2).11(\'I-12\',\'none\');3(2).14(0).15.J="K:L.t.M(n=\'"+b+"\',N=\'O\')"}});3(2).B("input[n$=.C]").D(s(){8 a=3(2).7(\'n\');3(2).14(0).15.J=\'K:L.t.M(n=\\\'\'+a+\'\\\', N=\\\'O\\\');\';3(2).7(\'n\',c.P)})}return 3}})(3);',[],68,'||this|jQuery||||attr|var|style||||||||||||||src|navigator|if|width|height|function|Microsoft|appVersion|border|padding|margin|span|px|indexOf|find|png|each|id|class|title|alt|background|filter|progid|DXImageTransform|AlphaImageLoader|sizingMethod|scale|blankgif|appName|Internet|Explorer|parseInt|MSIE|align|position|relative|display|inline|block|css|image|split|get|runtimeStyle'.split('|'),0,{}))
