﻿function killErrors() { 
    return true; 
} 
window.onerror = killErrors; 

//  function name : fontZoom(targetElement,size)
//         author : aNd1coder
//    description : get the dom element'id
//    create date : 2008/09/17
//==================================================================
//arguments:
//          targetElement  --- dom element'id
//          size		   --- element' fontSize
//==================================================================
function fontZoom(targetElement,size){
        document.getElementById(targetElement).style.fontSize=size + "px";
}

function addFav() {
    window.external.AddFavorite('http://localhost:3300/Default.aspx', ' ');
}

function addHome() {
    document.body.style.behavior = 'url(#default#homepage)';
    document.body.setHomePage('http://localhost:3300/Default.aspx');
}

//  function name : PicsSwitch(width,height,txtHeight,piclist,linklist,txtlist)
//         author : aNd1coder
//    description : for previewing pictures 
//    create date : 2008/09/18
//=============================================================================
//arguments:
//          width  --- flash width
//          height --- flash height
//          txtHeight    --- picture text height
//          piclist    --- pictures list   (format:p1|p2|p3);
//          linklist    --- picture links list  (format:l1|l2|l3)
//          txtlist   --- pictures texts list   (format:t1|t2|t3)
//=============================================================================
function PicsSwitch(width,height,txtHeight,piclist,linklist,txtlist,bgcolor){
    var focus_width=width;
    var focus_height=height;
    var text_height=txtHeight;
    var flash_url="flash/focus.swf";
    var swf_height = focus_height+text_height

    var pics= piclist;
    var links= linklist;
    var texts= txtlist;
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
    document.write('<param name="allowScriptAccess" value="sameDomain">');
    document.write('<param name="movie" value="'+flash_url+'">')
    document.write('<param name="quality" value="high">')
    document.write('<param name="bgcolor" value='+bgcolor+'>')
    document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
    document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
    document.write('<embed src="'+flash_url+'" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor='+bgcolor+' quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.write('</object>');
} 

//  function name : flash(url,w,h,wmode)
//         author : aNd1coder
//    description : html page inline-flash
//    create date : 2008/09/19
//=============================================================================
//arguments:
//          url    --- falsh location url
//          w      --- falsh width
//          h      --- falsh height
//          wmode  --- falsh mode eg:transparent or ""
//=============================================================================
function flash(_url,w,h,wmode){
    var url = "flash/" + _url;
    document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
    document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
    document.write(' WIDTH='+w+' HEIGHT='+h+'>');
    document.write(' <PARAM NAME=movie VALUE="'+url+'"> '); 
    document.write(' <PARAM NAME=quality VALUE=autohigh> ');
    document.write(' <PARAM NAME=wmode VALUE="transparent"> '); 
    document.write(' <EMBED SRC="'+url+'" QUALITY="autohigh" wmode="transparent" '); 
    document.write(' NAME=flashad swLiveConnect=TRUE WIDTH='+w+' HEIGHT='+h);
    document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
    document.write('</EMBED>');
    document.write('</OBJECT>');
}

//  function name : Thumbnail(ImgD,w,h)
//         author : aNd1coder
//    description : set the pictures height and width to prevent it to breaking the page
//    create date : 2008/09/18
//======================================================================================
//arguments:
//          ImgD  --- picture url
//             w  --- picture Thumb width
//             h  --- picture Thumb height
//======================================================================================
function Thumbnail(ImgD,w,h){
    var flag = false;
    var image = new Image();
    image.src = ImgD.src;
    if(image.width > 0 && image.height > 0){
        flag = true;
        if(image.width/image.height > w/h){
            if(image.width > w){
                ImgD.width = w;
                ImgD.height = (image.height*w)/image.width;
                ImgD.style.display = "block";
            }else{
                ImgD.width = image.width;
                ImgD.height = image.height;
                ImgD.style.display = "block";
            }
        }else{
            if(image.height > h){
                ImgD.height = h;
                ImgD.width = (image.width*h)/image.height;
                ImgD.style.display ="block";
            }else{
                ImgD.width = image.width;
                ImgD.height = image.height;
                ImgD.style.display = "block";
            }
         }
    }
}

//<div class="gl-tab-nav">

//<div class="menubox" id="nav">
//    <ul>
//        <li id="one1" onmouseover="setTab('one',1,2)" class="hover"><a href="index.aspx">首页</a></li>
//        <li id="one2" onmouseover="setTab('one',2,2)"><a href="index.aspx">企业咨询</a></li>
//    </ul>
//</div>

//<div class="contentbox">
//<div id="con_one_1" class="hover">
//    <ul>
//        <li>欢迎访问希派科技（香港）有限公司的网站...</li>
//    </ul>
//</div>
//<div id="con_one_2" class="hover">
//    <ul>
//        <li>欢迎访问希派科技（香港）有限公司的网站...</li>
//    </ul>
//</div>
//</div>

//</div>
function setTab(name,cursel,n){
    for(i=1;i<=n;i++){
        var menu=document.getElementById(name+i);
        var con=document.getElementById("con_"+name+"_"+i);
        menu.className=i==cursel?"highlight":"";
        con.style.display=i==cursel?"block":"none";
    }
}