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/Skin/ShowMovie.aspx?id='+strTemp,'newwindow', 'height=530, width=560, 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/Supply/Favorite/AddSupplyFavorite.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(!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.all["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专用-------------------------------
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://files.mainone.com/'+skinID+'/swf/index.swf?companyid='+companyID+'&xmlPath=http://files.mainone.com/XMLInfo/'+companyID+'/&flashPath=http://files.mainone.com/'+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://files.mainone.com/'+skinID+'/swf/SDDetail.swf?SDID='+SDID+'&ComID='+companyID+'&xmlPath=http://files.mainone.com/XMLInfo/&comURL='+strComURL+'&contactPath=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 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://files.mainone.com/'+skinID+'/swf/ProductDetail.swf?productID='+productID+'&xmlPath=http://files.mainone.com/XMLInfo/'+companyID+'/product/&comURL='+strComURL+'&contactPath=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 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://files.mainone.com/'+skinID+'/swf/JobDetail.swf?JobID='+JobID+'&xmlPath=http://files.mainone.com/XMLInfo/'+companyID+'/&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"); 
}