
document.write("<iframe id='ActionFrame' name='ActionFrame' src='about:blank' width='10' height='10' style='display:none;'></iframe>");
document.write("<form id='ActionForm' method='post' target='aActionFrame' style='display:none'></form>");
function AddCompanyFavorite(id)
{
    document.getElementById("ActionFrame").src="http://biz.mainone.com/AddCompanyFavorite.aspx?CompanyID=" + id ;    
}

function ShowToMail(subject,content)
{
    var form = document.getElementById("ActionForm");    
    form.action = "http://biz.mainone.com/DLG/ToMail.aspx";
    form.target = "ToMailWin";
    
    while(form.childNodes.length>0)
    {
        form.removeChild(form.childNodes[0]);
    }
        
    var objSubject = document.createElement("input");                
    objSubject.name = "subject";        
    objSubject.type = "hidden";
    objSubject.id = "subject";
    
    objSubject.value = subject;    
    form.appendChild(objSubject);
    
    
    var objcontent = document.createElement("input");                
    objcontent.type = "hidden";
    objcontent.id = "content";
    objcontent.name = "content";    
    objcontent.value = subject;    
    form.appendChild(objcontent);
    
    var popupWin = window.open("","ToMailWin","height=500,width=500,top=100,left=300,location=no,menubar=no,resizable=no,status=no,titlebar=no,toolbar=no,scrollbars=yes");
	        
    form.submit();
}
function OnVideoClick(strTemp)
{
   //加载Movie
    window.open('http://biz.mainone.com/ProductFlat/ShowVideo.aspx?CompanyID='+strTemp,'newwindow', 'height=420, width=440, top=70, left=120, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');		
   // alert(str);
}
function AddProductFavorite(id)
{
    document.getElementById("ActionFrame").src="http://biz.mainone.com/Product/AddProductFavorite.aspx?ProductID=" + id ;
}
function AddSupplyFavorite(id)
{
    document.getElementById("ActionFrame").src="http://biz.mainone.com/Trade/Favorite/AddTradeFavorite.aspx?SupplyID=" + id ;
}
function AddJobFavorite(id)
{
    // alert(id+"AddJobFavorite");
    
    window.open("http://job.mainone.com/FavoriteJobAdd.aspx?JobId="+id,'ToMailWin','height=300,width=600,top=200,left=300,location=no,menubar=no,resizable=no,status=no,titlebar=no,toolbar=no,scrollbars=no');
}

function ApplyJob(id)
{
   //alert(id+"ApplyJob");
    
    window.open("http://job.mainone.com/ResumeSelect.aspx?JobId="+id,'ToMailWin','height=300,width=600,top=200,left=300,location=no,menubar=no,resizable=no,status=no,titlebar=no,toolbar=no,scrollbars=no');
}
if(!String.trim)
{
    String.prototype.trim = function ()
    {	
	    return this.replace(/(^\s*)|(\s*$)/g,"");		
    }
}

if(!String.equal)
{
    String.prototype.equal = function(str)
    {
        var x = this.trim().toUpperCase();
        var y = str.trim().toUpperCase();
        return x == y;        
    }
}
function textCounter(field,ShowObj, maxlimit) 
{ 
    if (field.value.length > maxlimit) 
		field.value = field.value.substring(0, maxlimit); 
	else 
		document.getElementById(ShowObj).value = maxlimit - field.value.length;
}

function RequiredFieldValidator(input,msg)
{
    if(input.value.trim() == "")
    {
        input.focus();
        input.select();
        alert(msg);
        return false;
    }
    return true;
}
function RegularExpressionValidator(input,reg,msg)
{
    if(input.value.trim()!="")
    {    
		var rx = new RegExp(reg);
        var matches = rx.exec(input.value);    
        if(matches==null || matches[0] != input.value)    
		{			
            input.focus();
            input.select();
            alert(msg);
            return false;
        }
    }
    return true;
}
function OnContactFormSubmit()
{
    var companyName = document.getElementById("txtCompanyName");
    var contact = document.getElementById("txtContact");
    var telCountry = document.getElementById("txtTelCountry");
    var telZone = document.getElementById("txtTelZone");
    var telephone = document.getElementById("txtTelephone");
    var email = document.getElementById("txtEmail");
    var desc = document.getElementById("txtDescription");
    var code = document.getElementById("TxtCode");   
    
    if(!RequiredFieldValidator(companyName,"请输入公司名称！"))    
        return false;
    if(!RequiredFieldValidator(contact,"请输入联系人！"))    
        return false;
    if(!RequiredFieldValidator(telephone,"请输入联系电话！"))    
        return false;
    if(!RegularExpressionValidator(telCountry,/\+\d{2,6}/,"请正确输入联系电话国家区号，正确格式如“中国”为“+86”！"))
        return false;
    if(!RegularExpressionValidator(telZone,/\d{2,4}/,"联系电话城市号码为2-4位数字！"))
        return false;
    if(!RegularExpressionValidator(telephone,/(\d{6,13}(-\d{2,4})?,)?\d{6,13}(-\d{2,4})?/,"请输入正确的联系电话:电话为6-13位数字;分机号为2-4位数字;电话与分机间用\"-\"分隔；多个电话号码用\",\"分隔；最多2个电话号码！"))
        return false;
	if(!RequiredFieldValidator(email,"请输入E-mail地址！"))
        return false;  
	if(!RegularExpressionValidator(email,/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/,"请输入正确的E-mail地址！"))
        return false;
    if(!RequiredFieldValidator(desc,"请输入详细内容！"))
        return false;        
    if(!RequiredFieldValidator(code,"请输入验证码！"))
        return false;    
 
}
//显示大图
function showBigPic(strURL){
	var mImg=document.getElementById("image_m").src;
	if(mImg.indexOf("nopic.jpg")==-1){
		window.open(strURL+"?pic="+ escape(mImg.replace("_s","")));      
	}
}
function FlashshowBigPic(strURL,strPicURL){
	window.open(strURL+"?pic="+ escape(strPicURL));      
}

//供求大图
function showBigSupplyPic(strURL,img){
	if(img.indexOf("nopic.jpg")==-1){
		window.open(strURL+"?pic="+ escape(img));      
	}
}
function showWhiteBook(strID){
	if(strID!=""){
			var target="http://biz.mainone.com/Product/ShowWhiteBook.aspx?companyid="+strID;
			newwindow=window.open("","","scrollbars")
			if (document.all){
				//newwindow.moveTo(0,0)
				//newwindow.resizeTo(screen.width,screen.height)
				newwindow.moveTo( -4, -4 );
				newwindow.resizeTo( screen.width, screen.height );
				var nDiffHeight = newwindow.screenTop;
				newwindow.moveTo( -6, -nDiffHeight - 5 );
				newwindow.resizeTo( screen.width+ 12, screen.height + nDiffHeight + 35 );
				
			}
			newwindow.location=target;
	}
}
//--------flash专用(2008-10-9 为动态模板更改)------------------------------------------------------------------------------------------------------------------------------------------------------------
function createFlashIndex(skinID,companyID,intWidth,intHeight){
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" WIDTH='+intWidth+' HEIGHT='+intHeight+' align=center id="OBJECT4">');
 document.write('<PARAM NAME=movie VALUE="http://biz.mainone.com/Skin/'+skinID+'/swf/index.swf?companyid='+companyID+'&xmlPath=http://biz.mainone.com/Skin/XML/&flashPath=http://biz.mainone.com/Skin/'+skinID+'/swf/&bizCenterPath=http://biz.mainone.com/">');
 document.write('<param name=wmode value=transparent>');
 document.write('<PARAM NAME=quality VALUE=high>');
 document.write('<PARAM NAME=allowScriptAccess VALUE=always>');
 document.write('<EMBED  quality=high bgcolor=#FFFFFF  WIDTH='+intWidth+' HEIGHT='+intHeight+' 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 createFlashSDDetail(skinID,companyID,strComURL,SDID,intWidth,intHeight){
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" WIDTH="'+intWidth+'" HEIGHT="'+intHeight+'" align="center" id="SD">');
 document.write('<PARAM NAME=movie VALUE="http://biz.mainone.com/Skin/'+skinID+'/swf/SDDetail.swf?SDID='+SDID+'&ComID='+companyID+'&xmlPath=http://biz.mainone.com/Skin/XML/&contactPath=http://biz.mainone.com/&comURL='+strComURL+'">');
 document.write('<param name=wmode value=transparent>');
 document.write('<PARAM NAME=quality VALUE=high>');
 document.write('<PARAM NAME=allowScriptAccess VALUE=always>');
 document.write('<EMBED  quality=high bgcolor=#FFFFFF  WIDTH='+intWidth+' HEIGHT='+intHeight+' 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 createProductDetail(skinID,companyID,strComURL,productID,intWidth,intHeight){
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" WIDTH="'+intWidth+'" HEIGHT="'+intHeight+'" align="center" id="OBJECT1">');
 document.write('<PARAM NAME=movie VALUE="http://biz.mainone.com/Skin/'+skinID+'/swf/ProductDetail.swf?productID='+productID+'&ComID='+companyID+'&xmlPath=http://biz.mainone.com/Skin/XML/&bizCenterPath=http://biz.mainone.com/Skin/&comURL='+strComURL+'">');
 document.write('<param name=wmode value=transparent>');
 document.write('<PARAM NAME=quality VALUE=high>');
 document.write('<PARAM NAME=allowScriptAccess VALUE=always>');
 document.write('<EMBED  quality=high bgcolor=#FFFFFF  WIDTH='+intWidth+' HEIGHT='+intHeight+' 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 createJobDetail(skinID,companyID,strComURL,JobID,intWidth,intHeight){
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" WIDTH="'+intWidth+'" HEIGHT="'+intHeight+'" align="center" id="OBJECT2">');
 document.write('<PARAM NAME=movie VALUE="http://biz.mainone.com/Skin/'+skinID+'/swf/JobDetail.swf?JobID='+JobID+'&ComID='+companyID+'&xmlPath=http://biz.mainone.com/Skin/XML/&comURL='+strComURL+'">');
 document.write('<param name=wmode value=transparent>');
 document.write('<PARAM NAME=quality VALUE=high>');
 document.write('<PARAM NAME=allowScriptAccess VALUE=always>');
 document.write('<EMBED  quality=high bgcolor=#FFFFFF  WIDTH='+intWidth+' HEIGHT='+intHeight+' 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 goHome(){
    window.open("http://www.mainone.com");
}
function goBizcenter(){
    window.open("http://biz.mainone.com");
} 
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//----------------显示flash
function showSwf(strpath,intwidth,intheight,transpart,obj){
    var swfHTML="";
    var currentType=getCurrentPagetype();
    if(transpart=="1"){
    swfHTML="<embed allowScriptAccess='always' src='"+strpath+"?currentPageType="+currentType+"' allowfullscreen='true' wmode='transparent' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+intwidth+"' height='"+intheight+"'></embed>";
    }else{
        swfHTML="<embed allowScriptAccess='always' src='"+strpath+"?currentPageType="+currentType+"' allowfullscreen='true'  quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+intwidth+"' height='"+intheight+"'></embed>";
    }
    
    if(obj==null){
        document.write(swfHTML);
    }else{
        obj.innerHTML=swfHTML;
    }
}
//----------------------------------------------------------------------------------------------------------------------

function getCurrentPagetype(){
    
    var currentURL=location.href.toLowerCase();
    
   if(currentURL.indexOf("companydetail")>0){
        return "1"; //公司信息页
    }
    else if(currentURL.indexOf("customdetail")>0){
        return "2";//自定义
    }
    else if(currentURL.indexOf("product")>0  ){
        return "3";//产品
    }
    else if(currentURL.indexOf("trade")>0){
        return "4";//供求
    }
   else  if(currentURL.indexOf("archives")>0){
        return "5";//诚信
    }
    else if(currentURL.indexOf("news")>0){
        return "6";//新闻
       
    }else if(currentURL.indexOf("contact")>0){
        return "7";//联系我们
       
    }else if(currentURL.indexOf("job")>0){
        return "8";//招聘
    }
    return "0";  //首页
}

//------------------显示大图flash
function showPicSwf(strpath,intwidth,intheight,vars,scaleMode){
    var swfHTML="";
    scale="showall";
    if(scaleMode=="1") scale="Exactfit";
    swfHTML="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='"+intwidth+"' height='"+intheight+"' id='picControll' align='middle'>";
    swfHTML+="<param name='wmode' value='transparent' /><param name='scale' value='"+scale+"' /><param name='movie' value='"+strpath+"' /><param name='movie' value='"+strpath+"' /><param name='FlashVars' value='"+vars+"' /><param name='allowfullscreen' value='true' />";
    swfHTML+="<embed src='"+strpath+"' FlashVars='"+vars+"' allowfullscreen='true' scale='"+scale+"' wmode='transparent' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+intwidth+"' height='"+intheight+"'></embed></object>";

        document.write(swfHTML);

}

//------------设置层使两个层的高度相同
function setDivHeight(div1 ,div2){
  var   a=document.getElementById(div1);   
  var   b=document.getElementById(div2);   

  if(a==null || b==null) {
	return;
  }

  if(a.clientHeight<b.clientHeight)   
  {   
  a.style.height=b.clientHeight+"px";   
  }   
  else{   
  b.style.height=a.clientHeight+"px";   
  }   

}

     <!--
     function iframeAutoFit()
     {
        try
         {
             if(window!=parent)
             {
                 var a = parent.document.getElementById("main_frame");
                 parent.document.body.scroll = "yes";
                 parent.document.body.rightMargin="0";
                 parent.document.body.bottomMargin="0";
                     if(a.contentWindow==window)
                     {
                         var h1=0, h2=0;
                         if(document.documentElement&&document.documentElement.scrollHeight)
                         {
                             h1=document.documentElement.scrollHeight;
                         }
                         if(document.body) h2=document.body.scrollHeight;

                         var h=Math.max(h1, h2);
                         if(document.all) {h += 4;}
                         if(window.opera) {h += 1;}
                         a.parentNode.style.height = h +"px";
                         a.style.height = h+"px";
                         a.style.display = "block";
                     }
             }
        }
        catch (ex){}
     }
     if(window.attachEvent)
     {
         window.attachEvent("onload",   iframeAutoFit);
     }
     else if(window.addEventListener)
     {
         window.addEventListener('load',   iframeAutoFit,   false);
     }
     //-->

<!--
     function iframeAutoFit()
     {
         try
         {
             if(window!=parent)
             {
                 var a = parent.document.getElementById("main_frame");
                     if(a.contentWindow==window)
                     {
                         var h1=0, h2=0;
                         a.parentNode.style.height = a.offsetHeight +"px";
                         a.style.height = "10px";
                         if(document.documentElement&&document.documentElement.scrollHeight)
                         {
                             h1=document.documentElement.scrollHeight;
                         }
                         if(document.body) h2=document.body.scrollHeight;

                         var h=Math.max(h1, h2);
                         if(document.all) {h += 4;}
                         if(window.opera) {h += 1;}
                         a.style.height=a.parentNode.style.height = h +"px";
                     }
             }
         }
         catch (ex){}
     }
     if(window.attachEvent)
     {
         window.attachEvent("onload",   iframeAutoFit);
     }
     else if(window.addEventListener)
     {
         window.addEventListener('load',   iframeAutoFit,   false);
     }
     else
     {
	window.onload = iframeAutoFit;
      }
     //-->