﻿// JScript File
function MouseCurrentOver(obj)
{
      obj.style.color='#ff7e55';
      obj.style.marginLeft="0px";
}

function MouseCurrentOut(obj)
{
     obj.style.color='#dcdcdc';
     obj.style.marginLeft="0px";   
}

function MenuCurrentSelected(obj)
{
     obj.style.color='#ff7e55';
     obj.style.marginLeft="6px";   
}

function MenuBrCurrentSelected(obj)
{
     obj.style.color='#ff7e55';
     obj.style.marginLeft="0px";   
}

function MouseOver(obj)
{
      obj.style.color='#ffc6b4';
      obj.style.marginLeft="0px";
}
function MouseOut(obj)
{
     obj.style.color='#646464';
     obj.style.marginLeft="0px";   
}

function MenuSelected(obj)
{
     obj.style.color='#ffc6b4';
     obj.style.marginLeft="6px";   
}

function MenuBrSelected(obj)
{
     obj.style.color='#ffc6b4';
     obj.style.marginLeft="0px";   
}

function MenuSecondCurrentSelected(obj,imgID,imgSrc)
{
     obj.style.color='#ff7e55';
     obj.style.marginLeft="6px"; 
     objImg = document.getElementById(imgID);
     objImg.src ="Image"+imgSrc;  
}

function MouseSecondCurrentOver(obj,imgID,imgSrc)
{
      obj.style.color='#ff7e55';
      obj.style.marginLeft="0px";
      objImg = document.getElementById(imgID);
      objImg.src ="Image"+imgSrc;
}

function MenuSecondSelected(obj,imgID,imgSrc)
{   
     obj.style.color='#ffc6b4';
     obj.style.marginLeft="6px";   
      objImg = document.getElementById(imgID);
      objImg.src ="Image"+imgSrc;
}
function MouseSecondCurrentOut(obj,imgID,imgSrc)
{
     obj.style.color='#dcdcdc';
     obj.style.marginLeft="0px";   
     objImg = document.getElementById(imgID);
     objImg.src ="Image"+ imgSrc;
}
function MouseSecondOver(obj,imgID,imgSrc)
{
      obj.style.color='#ffc6b4';
      obj.style.marginLeft="0px";
      objImg = document.getElementById(imgID);
      objImg.src ="Image"+imgSrc;
}
function MouseSecondOut(obj,imgID,imgSrc)
{
     obj.style.color='#646464';
     obj.style.marginLeft="0px"; 
     objImg = document.getElementById(imgID);
     objImg.src ="Image"+ imgSrc;  
}

function ImgIconOver(obj,imgSrc,menuID)
{
     obj.src ="Image"+imgSrc;
      
    if($.browser.msie)
    {
        obj.style.cursor='hand';
     }
     else
     {
         obj.style.cursor='pointer';
     }
     objMenu = document.getElementById(menuID);
     objMenu.style.color='#ff7e55';


}
function ImgIconOut(obj,imgSrc,menuID,menuColor)
{
     obj.src ="Image"+imgSrc;  
     if($.browser.msie)
     {
        obj.style.cursor='hand';
     }
     else
     {
         obj.style.cursor='pointer';
     }
     objMenu = document.getElementById(menuID);
     objMenu.style.color=menuColor;
}
function ProColImgIconOver(obj,imgSrc)
{
    obj.src ="Image"+imgSrc;
     obj.style.cursor='pointer';
}

function ProColImgIconOut(obj,imgSrc)
{
    obj.src ="Image"+imgSrc;
    obj.style.cursor='pointer';
}

function ImgOver(obj)
{

     obj.style.color='#ff7e55';
     obj.style.border ="3px solid #ff7e55";
     obj.style.marginLeft ="-3px";
      if($.browser.msie && $.browser.version <7)
     {
            obj.style.marginTop ="0px";
     }
//     obj.style.opacity ="1.00";
//     obj.style.filter ="alpha(opacity=100)";   
}
function ImgGrayOver(obj)
{

     obj.style.color='#ffc6b4';
     obj.style.marginLeft ="-3px";
      if($.browser.msie && $.browser.version <7)
     {
            obj.style.marginTop ="0px";
     }
}

function ImgOut(obj)
{
     obj.style.borderWidth="0";
     obj.style.color='#ffc6b4';
     //obj.style.border ="3px solid black";
     obj.style.marginLeft ="0px";
    if($.browser.msie && $.browser.version <7)
     {
            obj.style.marginTop ="0px";
     }
}
function ImgGray(obj)
{
     obj.style.borderWidth="0";
     obj.style.opacity ="0.2";
     obj.style.filter ="alpha(opacity=20)";
     obj.style.height="182px";
     obj.style.width="125px";
}

function ImgHighLight(obj)
{
    obj.style.color='#ff7e55';
     obj.style.height="182px";
     obj.style.width="121px";
     obj.style.opacity ="1.00";
     obj.style.filter ="alpha(opacity=100)";   
}
function LabelOver(obj)
{
    obj.style.color='#ff7e55';
}

function LabelOut(obj)
{
    obj.style.color='#dcdcdc';
}
function load() 
{
    bodyZoom();
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    
}
//add by terry liu 20110126  页面Load时，获得滚动条
function loadScroll(classname) 
{
    GetScrollBar(classname);
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    
}
//end add
function EndRequestHandler(html) 
{
    $(document).ready(function(){ $("#LoadArticleHtml").load(html);}); 
   
}
function correctPNG()
{
//     alert('document.images.length = '+document.images.length);
//    if($.browser.msie & $.browser.version < 7)
//    {
//        for(var i=0; i<document.images.length; i++)
//        {
//            
//            var img = document.images[i]
//            var imgName = img.src.toUpperCase()
//            if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
//            {
//                var imgID = (img.id) ? "id='" + img.id + "' " : ""
//                var imgClass = (img.className) ? "class='" + img.className + "' " : ""
//                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
//                var imgStyle = "display:inline-block;" + img.style.cssText
//                if (img.align == "left") imgStyle = "float:left;" + imgStyle
//                if (img.align == "right") imgStyle = "float:right;" + imgStyle
//                if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
//                var strNewHTML = "<span "+ imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src='" + img.src + "', sizingMethod='scale');\"></span>"
//                img.outerHTML = strNewHTML
////                alert('strNewHTML=  '+strNewHTML
////                 alert('img.outerHTML= '+img.outerHTML);
////                      alert('document.images.length = '+document.images.length);
//                i = i-1
//            }
//        }
//    }
    
}

function ImgRedirect(firstMenuKey,secondMenuKey)
{
    window.location.href="Products.aspx?FirstMenuKey="+firstMenuKey +"&SecondMenuKey="+secondMenuKey; 
}

// add by AIC11/Vivian.Wei on 20090918 start
function IconRedirect(firstMenuKey,secondMenuKey,lightKey)
{
    window.location.href="ProductDetail.aspx?FirstMenuKey="+firstMenuKey +"&SecondMenuKey="+secondMenuKey+"&lightKey="+lightKey; 
}
// add by AIC11/Vivian.Wei on 20090918 end
function SetAboutUsCss(HeadImage,BodyImage,html)
{
    EndRequestHandler(html);
    document.getElementById("topAboutUs").style.backgroundImage =HeadImage;
    document.getElementById("contentAboutUs").style.backgroundImage =BodyImage;
}


function SetNewsCss(html)
{
    EndRequestHandler(html);
}

function MouseOverHref(obj)
{
    obj.style.color='#ff7e55';
}

function MouseOutHref(obj)
{
    obj.style.color='#ffc6b4';
}

function MouseOutNewsHref(obj)
{
 obj.style.color='#ffc6b4';
   
}
function MouseClickHref(obj)
{
    obj.style.color='#FFC6B4';
}

function GetHtml(html) 
{
     $("#LoadArticleHtml").load(html); 
   
}

        
function LanguageMouseOver(obj)
{
    obj.style.color='#ff7e55';
    
}
function LanguageMouseOut(obj)
{
    obj.style.color='#646464';
    
}

function LanguageSelected(obj)
{
    obj.style.color='#ffc6b4';
    
}
function SetDefautlCss(BodyImage,footImage)
{
   // document.getElementById("contentMain").style.backgroundImage =BodyImage;//设置Default页面content背景图片
    if($.browser.msie)
    {
        document.getElementById("contentMain").style.cursor='hand';
     }
     else
     {
         document.getElementById("contentMain").style.cursor='pointer';
     }
    document.getElementById("footMain").style.backgroundImage =footImage;
}

function preloadimg(url,obj){
var img=new Image();
obj.innerHTML="<p style=\" background-image:url('Image/loading.gif'); background-position:center; background-repeat:no-repeat;width:200px;height:200px;text-align:center;font-size:12px;color:#999999;line-height:26px;\">图片加载中...</p>";
//prompt('undefined',obj.innerHTML);
img.onload=function()
{
    obj.innerHTML="";
    obj.style.width=String(img.width)+"px";
    if($.browser.msie)
    {
        obj.style.cursor='hand';
     }
     else
     {
         obj.style.cursor='pointer';
     }
    //ipt.style.width=String(img.width-40)+"px";
    obj.appendChild(img);
   };
img.onerror=function(){obj.innerHTML="图片加载失败！"};
img.src=url; //img.src一定要写在img.onload之后，否则在IE中会出现问题
}

function show(imgUrl,divId)
{
    //alert('dddd');
    if(imgUrl!=" " && divId!=" ")
    {
        var div=document.getElementById(divId);
       // preloadimg(imgUrl,div);
    }
}


function initPage(loading,imgUrl,imgDiv)   
{   
  //alert('ddd');
    var objLoading = document.getElementById(loading);   
    if (objLoading != null)   
    {   
        objLoading.style.display = "none";   
    }   
    show(imgUrl,imgDiv);
} 

function saveemail()
{
 var email =document.getElementById("QisdesignFooter_inputMail").value;
// alert("email is "+ email);
 PageMethods.Subscribe(email,success,fail);
  
 }
 
 function success(result)
 {   
   alert(document.getElementById("QisdesignFooter_successmessage").value);
 }
  function fail(result)
 {
   alert(result.get_message());
 }

function CheckMail(nullmessage,errormessage)
     {
        var email = document.getElementById("QisdesignFooter_inputMail").value;
		if(email =="")
		{
			alert(document.getElementById(nullmessage).value);
			return false;
		}
		if(email != "") {
			if(!/(\S)+[@]{1}(\S)+[.]{1}(\w)+/.test(email))
			{
			    alert(document.getElementById(errormessage).value);
				var iemail = document.getElementById("QisdesignFooter_inputMail");
				iemail.focus();
				return false;
				
			}				
			saveemail();
		}
     }
    
    function mailBlur(inputmessage)
	{ 
	    if(document.getElementById("QisdesignFooter_inputMail").value=="")
		{		  
		   document.getElementById("QisdesignFooter_inputMail").value=document.getElementById(inputmessage).value;
		 }
	}


function bodyZoom()
{
//    if (984<= screen.width && 768 < screen.height &&  screen.width < 1200  && screen.height < 985)
//    {
//       if($.browser.msie||$.browser.safari)
//        {
//            document.body.style.zoom=1;
//        }
//         if($.browser.mozilla)
//        {

//              document.body.style.MozTransform= 'scale(1,1)';
////              document.body.style.MozTransformOrigin='0% 0%';
////          document.body.style.fullzoom=2;
////          Components.classes["@mozilla.org/appshell/window-mediator;1"].
////             getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser").
////             getBrowser().mCurrentBrowser.markupDocumentViewer.fullZoom = 2;
//        }

//    }
//    
//    if(1200<=screen.width && screen.width <1280 && 985<= screen.height && screen.height<1024)
//    {
//        if($.browser.msie)
//        {
//            document.body.style.zoom=1+20/100;
//        }
//         if($.browser.safari)
//        {
//           
//            document.body.style.zoom=1+20/100;
//        }
//        if($.browser.mozilla)
//        {
//           
//             
//             document.body.style.MozTransform= 'scale(1.2,1.2)';//拉伸效果
//              document.body.style.MozTransformOrigin='52% 0%';//移位效果
//        }
//    }
//    if (screen.width>=1280 & screen.height>=1024)
//    {
//        if($.browser.msie)
//        {
//           
//            document.body.style.zoom=1+28/100;
//        }
//         if($.browser.safari)
//        {
//           
//            document.body.style.zoom=1+28/100;
//        }
//        if($.browser.mozilla)
//        {
//           
//             
//             document.body.style.MozTransform= 'scale(1.28,1.28)';//拉伸效果
//              document.body.style.MozTransformOrigin='48% 0%';//移位效果
////             Components.classes["@mozilla.org/appshell/window-mediator;1"].
////             getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser").
////             getBrowser().mCurrentBrowser.markupDocumentViewer.fullZoom = 3;
////             document.body.style.fullzoom=1+28/100;

//        }
//    }
           
}

function SetSalesPointCss(html)
{
    EndRequestHandler(html);
    //document.getElementById("topAboutUs").style.backgroundImage =HeadImage;
    //document.getElementById("contentAboutUs").style.backgroundImage =BodyImage;
}

function ChangeMapColor(img,imgId)
{
    document.getElementById(imgId).src=img;
}

//Add by Terry liu 20110126,给页面加滚动条
function GetScrollBar(classname)
{
    $(classname).jscroll({ W:"7px"//设置滚动条宽度
    ,BgUrl:"url(Image/s_bg.gif)"//设置滚动条背景图片地址
    ,Bg:"right 0 repeat-y"//设置滚动条背景图片position,颜色等
    ,Bar:{Bd:{Out:"#000000",Hover:"#000000"}//设置滚动滚轴边框颜色：鼠标离开(默认)，经过
    ,Bg:{Out:"-45px 0 repeat-y",Hover:"-50px 0 repeat-y",Focus:"-55px 0 repeat-y"}}//设置滚动条滚轴背景：鼠标离开(默认)，经过，点击
    ,Btn:{btn:false//是否显示上下按钮 false为不显示
        ,uBg:{Out:"0 0",Hover:"-15px 0",Focus:"-30px 0"}//设置上按钮背景：鼠标离开(默认)，经过，点击
        ,dBg:{Out:"0 -15px",Hover:"-15px -15px",Focus:"-30px -15px"}}//设置下按钮背景：鼠标离开(默认)，经过，点击
    ,Fn:function(){}//滚动时候触发的方法
                      });
}
//end add


//----------------------added by Thinking 2011-7-7---------------------------
////商店类型，鼠标移入样式
//function MouseShopTypeOver(obj)
//{
//    obj.style.color="#ff7e55";
//}

////商店类型，鼠标移开样式
//function MouseShopTypeOut(obj)
//{
//    if(obj.style.marginLeft=="6px" || (obj.className=="menuShopSelected" && obj.style.marginLeft!="0px"))
//    {
//        obj.style.color="#c2eaf2";
//    }
//    else
//    {
//        obj.style.color="#646464";
//    }
//}

//商店类型，鼠标点击样式
function MouseShopTypeClick(strID)
{
    //-------Retail Shop-------
    if(strID=="_retail")
    {
        //控制商店类型的样式
        if(document.getElementById("_retail")!=null)
        {
            document.getElementById("_retail").className="menuShopSelected";
        }
        if(document.getElementById("_distributor")!=null)
        {
            document.getElementById("_distributor").className="menuShopUnSelected";
        }
        if(document.getElementById("_agent")!=null)
        {
            document.getElementById("_agent").className="menuShopUnSelected";
        }
        
        //显示Retail Shop商店信息
        if(document.getElementById("_retailDetail")!=null)
        {
            document.getElementById("_retailDetail").className="detailShopSpace_show";
        }
        
        //隐藏Distributor & Agent商店信息 
        if(document.getElementById("_distributorDetail")!=null)
        {
            document.getElementById("_distributorDetail").className="detailShopSpace_hidden";
        }
        if(document.getElementById("_agentDetail")!=null)
        {
            document.getElementById("_agentDetail").className="detailShopSpace_hidden";
        }
    }
    
    //-------Distributor-------
    if(strID=="_distributor")
    {
        //控制商店类型的样式
        if(document.getElementById("_distributor")!=null)
        {
            document.getElementById("_distributor").className="menuShopSelected";
        }
        if(document.getElementById("_retail")!=null)
        {
            document.getElementById("_retail").className="menuShopUnSelected";
        }
        if(document.getElementById("_agent")!=null)
        {
            document.getElementById("_agent").className="menuShopUnSelected";
        }
        
        //显示Distributor商店信息
        if(document.getElementById("_distributorDetail")!=null)
        {
            document.getElementById("_distributorDetail").className="detailShopSpace_show";
        }
        
        //隐藏Retail Shop & Agent商店信息 
        if(document.getElementById("_retailDetail")!=null)
        {
            document.getElementById("_retailDetail").className="detailShopSpace_hidden";
        }
        if(document.getElementById("_agentDetail")!=null)
        {
            document.getElementById("_agentDetail").className="detailShopSpace_hidden";
        }
    }
    
    //-------Agent-------
    if(strID=="_agent")
    {
        //控制商店类型的样式
        if(document.getElementById("_agent")!=null)
        {
            document.getElementById("_agent").className="menuShopSelected";
        }
        if(document.getElementById("_retail")!=null)
        {
            document.getElementById("_retail").className="menuShopUnSelected";
        }
        if(document.getElementById("_distributor")!=null)
        {
            document.getElementById("_distributor").className="menuShopUnSelected";
        }
        
        //显示Agent商店信息
        if(document.getElementById("_agentDetail")!=null)
        {
            document.getElementById("_agentDetail").className="detailShopSpace_show";
        }
        
        //隐藏Distributor & Retail Shop商店信息 
        if(document.getElementById("_distributorDetail")!=null)
        {
            document.getElementById("_distributorDetail").className="detailShopSpace_hidden";
        }
        if(document.getElementById("_retailDetail")!=null)
        {
            document.getElementById("_retailDetail").className="detailShopSpace_hidden";
        }
    }
}











