var dialogW = 474;
var dialogH = 145;
//Ó¦Æ¸Ö°Î»
function applyJobs(comId,posId)
{
	var url="/Common.shtml?url=PersonAddToReceive&comId="+comId+"&posId="+posId;
	showApplyDialog(url,dialogW,dialogH,false);
    //window.open (url,"companysend","left=80,top=80,width=600,height=480,resizable=yes,status=yes,scrollbars=yes");
}

//Ó¦Æ¸Ñ¡ÖÐËùÓÐÖ°Î»
function applyAllJobs()
{
    var m=document.queryForm;
	var comId = "";
	var posId = "";
    if(isCheck(m.selID))
	{
        var ids = getCheckboxValue(m.selID);
		var allId = ids.split(",");
		for(var i=0;i<allId.length;i++){
			var comIDs = allId[i].split(":");
			comId += ","+comIDs[0];
			posId += ","+comIDs[1];
		}
		var url="/Common.shtml?url=PersonAddToReceive&comId="+comId.substring(1)+"&posId="+posId.substring(1);
		showApplyDialog(url,dialogW,dialogH,false);
	//window.open (url,"companysend","left=80,top=80,width=600,height=480,resizable=yes,status=yes,scrollbars=yes");
	}
	else
	{
		//alert("ÇëÖÁÉÙÑ¡ÖÐÒ»¸öÖ°Î»£¡");
		showJob5156TipDialog("ÇëÖÁÉÙÑ¡ÖÐÒ»¸öÖ°Î»£¡",null,false);
	}
}


//¸øÆóÒµÁôÑÔ
function msgToCom(comId,posId)
{
   var url="/Common.shtml?url=EmailExchangesEvent&opt=personaddByPosView&comId="+comId+"&posId="+posId;
	showApplyDialog(url,500,440,false);
}

//ÍøÓÑÌô´í
function feedBackComInfo(comId){
	var url = "/Common.shtml?url=PersonFeedBack&operate=FeedBackComInfo&comid="+comId;
	showApplyDialog(url,500,440,false);
}

//ÊÕ²ØÖ°Î»
function collectionJobs(comId,posId)
{
	var url="/Common.shtml?url=PersonAddToFavouriate&comId="+comId+"&posId="+posId;
    showApplyDialog(url,dialogW,dialogH,false);
	//window.open (url,"companysend","left=80,top=80,width=600,height=480,resizable=yes,status=yes,scrollbars=yes");
}

//ÊÕ²ØÑ¡ÖÐËùÓÐÖ°Î»
function collectionAllJobs()
{
	var m=document.queryForm;
	var comId = "";
	var posId = "";
    if(isCheck(m.selID))
	{
        var ids = getCheckboxValue(m.selID);
		var allId = ids.split(",");
		for(var i=0;i<allId.length;i++){
			var comIDs = allId[i].split(":");
			comId += ","+comIDs[0];
			posId += ","+comIDs[1];
		}
		var url="/Common.shtml?url=PersonAddToFavouriate&comId="+comId.substring(1)+"&posId="+posId.substring(1);
        showApplyDialog(url,dialogW,dialogH,false);
	//window.open (url,"companysend","left=80,top=80,width=600,height=480,resizable=yes,status=yes,scrollbars=yes");
    }
	else
	{
		//alert("ÇëÖÁÉÙÑ¡ÖÐÒ»¸öÖ°Î»!");
		showJob5156TipDialog("ÇëÖÁÉÙÑ¡ÖÐÒ»¸öÖ°Î»£¡",null,false);
	}
}

//°ÑÖ°Î»ÍÆ¼ö¸øºÃÓÑ
function commendToFriend(comId,posId,flag)
{
    
    url = "/city/zhongshan/commendPosToFriend_3.jsp?comId="+comId+"&posId="+posId;
    showApplyDialog(url,474,312,false);
	//window.open (url,"companysend","left=80,top=80,width=600,height=600,resizable=yes,status=yes,scrollbars=yes");
}

//°ÑÑ¡ÖÐËùÓÐÖ°Î»ÍÆ¼ö¸øºÃÓÑ
function commendAllToFriend()
{
	var m=document.queryForm;
	var comId = "";
	var posId = "";
    if(isCheck(m.selID))
	{
        var ids = getCheckboxValue(m.selID);
		var allId = ids.split(",");
		for(var i=0;i<allId.length;i++){
			var comIDs = allId[i].split(":");
			comId += ","+comIDs[0];
			posId += ","+comIDs[1];
		}
		var url="/city/zhongshan/commendPosToFriend_3.jsp?comId="+comId.substring(1)+"&posId="+posId.substring(1);
        showApplyDialog(url,474,312,false);
    }
	else
	{
		showJob5156TipDialog("ÇëÖÁÉÙÑ¡ÖÐÒ»¸öÖ°Î»£¡",null,false);
	}
}

//²é¿´Ñ¡ÔñµÄËùÓÐÖ°Î»
function LookAllPosition()
{
	var m=document.queryForm;
	var posId = "";
    if(isCheck(m.selID))
	{
		var ids = getCheckboxValue(m.selID);
		var allId = ids.split(",");
		for(var i=0;i<allId.length;i++){
			var comIDs = allId[i].split(":");
			posId += ","+comIDs[1];
		}
        var url="/Common.shtml?url=LookSelPosition&flag=all&posId="+posId.substring(1);
		m.target="_blank";
		m.action = url;		
		m.submit();
		m.target="_self";
		m.action="";
	}
	else
	{
		//alert("ÇëÖÁÉÙÑ¡ÖÐÒ»¸öÖ°Î»!");
		showJob5156TipDialog("ÇëÖÁÉÙÑ¡ÖÐÒ»¸öÖ°Î»£¡",null,false);
	}
}
//°ÑÎÄÕÂÍÆ¼ö¸øºÃÓÑ
function commendArtileToFriend(title,id)
{
    var url="/Common.shtml?url=RecommendMagazine&title="+title+"&id="+id;
    showApplyDialog(url,474,312,false);
	//window.open (url,"companysend","left=80,top=80,width=600,height=600,resizable=yes,status=yes,scrollbars=yes");
}

//ÐÞ¸Ä¸öÈËÕÊºÅ
function updateUserName()
{
    var url="/process/person/updateUserName.jsp?1=1";
    //showApplyDialog(url,400,250,true);
	window.open (url,"companysend","left=80,top=80,width=400,height=250,resizable=yes,status=yes,scrollbars=yes");
}

//ÐÞ¸Ä¸öÈËÃÜÂë
function updatePassword()
{
    var url="/process/person/updatePassword.jsp?1=1";
    //showApplyDialog(url,400,250,true);
	window.open (url,"companysend","left=80,top=80,width=400,height=250,resizable=yes,status=yes,scrollbars=yes");
}

//Í¼Æ¬×Ô¶¯¸üÐÂ´óÐ¡
function CheckImg(ImgD) 
{ 
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.width>0 && image.height>0){
	   if(image.width>300){
			ImgD.width=300;
	   }else{ 
			ImgD.width=image.width;
	   }
	}
}

function openBigImg(img) 
{ 
	window.open(img.src);
}

//<img src="images/toplogo.gif" onload="javascript:DrawImage(this,100,100)">
function DrawImage(ImgD,iwidth,iheight){
    //²ÎÊý(Í¼Æ¬,ÔÊÐíµÄ¿í¶È,ÔÊÐíµÄ¸ß¶È)
    var image=new Image();
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= iwidth/iheight){
        if(image.width>iwidth){  
        ImgD.width=iwidth;
        ImgD.height=(image.height*iwidth)/image.width;
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
        }
        ImgD.alt=image.width+"¡Á"+image.height;
        }
    else{
        if(image.height>iheight){  
        ImgD.height=iheight;
        ImgD.width=(image.width*iheight)/image.height;        
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
        }
        ImgD.alt=image.width+"¡Á"+image.height;
        }
    }
} 

/* ²ãµÄµ­Èëµ­³öÐ§¹û
var intDelay=50; //ÉèÖÃ²Ëµ¥ÏÔÊ¾ËÙ¶È£¬Ô½´óÔ½Âý£¬²»³¬¹ý100ÎªºÃ 
var intInterval=5; //Ã¿´Î¸ü¸ÄµÄÍ¸Ã÷¶È£¬×îºÃÐ¡ÓÚ10
function GradientShow() //ÊµÏÖµ­ÈëµÄº¯Êý 
{
	systemDialogApply.filters.alpha.opacity+=intInterval;
	if(systemDialogApply.filters.alpha.opacity<100)
	{
		setTimeout("GradientShow()",intDelay);
	}
}

function GradientClose() //ÊµÏÖµ­³öµÄº¯Êý 
{ 
	systemDialogApply.filters.alpha.opacity-=intInterval; 
	if (systemDialogApply.filters.alpha.opacity>0) { 
		setTimeout("GradientClose()",intDelay); 
	} 
	else { 
		systemDialogApply.style.visibility="hidden"; //µ±¿´²»µ½²Ëµ¥²ãºó»¹ÐèÒª°ÑÕâ¸ö²ãÒþ²ØÆðÀ´ 
	} 
}
*/

//¸ÄÓÃ²ã·½Ê½
var layerContents = "";
	layerContents +="<div id=\"screenFrontDivApply\" style=\"position:absolute;visibility:hidden;width:100%;height:100%;background: #efefef;filter:alpha(opacity=50);opacity:0.50\"></div>";
	layerContents +="<div id='systemDialogApply'  style=\"position:absolute;visibility:hidden;\"><iframe scrolling=\"no\" width=\"474\" frameborder=\"0\" name=\"dialogframeApply\" src=\"\" id=\"dialogframeApply\"></iframe></div>";

document.write(layerContents);

function getObjs(objname){
	var obj;
	if (document.layers){
		obj = document.layers[objname];
    }
    else if (document.all){
		obj = document.all[objname];
    }
    else if (document.getElementById){
        obj = document.getElementById(objname);
    }
	return obj;
}

function showApplyDialog(url,w,h,needScreenDiv){
	url = url + "&winFlag=true&math="+Math.random();
	try{
		if(needScreenDiv==false){
			var disFrontObj = getObjs("screenFrontDivApply");
			disFrontObj.style.left=0;
			disFrontObj.style.top=0;
			disFrontObj.style.height=document.body.scrollHeight;
			disFrontObj.style.width=document.body.scrollWidth;
			disFrontObj.style.visibility="visible";
		}

		var disObj = getObjs("systemDialogApply");
		disObj.innerHTML = "";
		var x = document.body.scrollLeft;	
	    var y = document.body.scrollTop;
        
         //»ñÈ¡ÆÁÄ»¿í¶È
		 //availWidth = parseInt(window.screen.availWidth);
	     //availHeight = parseInt(window.screen.availHeight);

         //»ñÈ¡¿É¼ûÇøÓò ¿í¶È ¸ß¶È
		 availWidth = parseInt(document.body.clientWidth);
	     availHeight = parseInt(document.body.clientHeight);

		  y = y + availHeight/4;
	      x = (availWidth - w)/2;

		//disObj.style.left=x+"px";
		//disObj.style.top=y+"px";
		GetCenterXY_ForLayer(disObj);

		disObj.innerHTML = "<iframe scrolling=\"no\" onload=\"this.height=dialogframeApply.document.body.scrollHeight\"  width=\"474\" frameborder=\"0\" name=\"dialogframeApply\" src=\"\" id=\"dialogframeApply\"></iframe>";
		var frameObj = getObjs("dialogframeApply");
		frameObj.width=w;
		//frameObj.height=h;
		//frameObj.height = window.frames["dialogframeApply"].document.body.scrollHeight+"px";
		frameObj.src=url;
		disObj.style.visibility="visible";
		/*²ãµÄµ­Èëµ­³öÐ§¹û
		if(disObj.style.visibility=="visible") 
		{ 
			disObj.style.visibility="hidden"; 
		} 
		else{ 
			disObj.filters.alpha.opacity=0; 
			disObj.style.visibility="visible"; 
			GradientShow(); //µ­Èëµ­³ö
		}
		*/

		//dialogW = w;
        //dialogH = h;

	}catch(e){
		url = url + "&winFlag=false&math="+Math.random();
        window.open (url,"companysend","left=80,top=80,width="+w+",height="+h+",resizable=yes,status=yes,scrollbars=yes");
	}
}

//ÖØÉè²ãµÄ´óÐ¡ºÍÎ»ÖÃ
function applyDialogReSize()
{
   try{
		var disFrontObj = getObjs("screenFrontDivApply");
		disFrontObj.style.left=0;
		disFrontObj.style.top=0;
		disFrontObj.style.height=document.body.scrollHeight;
		disFrontObj.style.width=document.body.scrollWidth;

		var disObj = getObjs("systemDialogApply");
		var x = document.body.scrollLeft;
	    var y = document.body.scrollTop;
        
         //»ñÈ¡ÆÁÄ»¿í¶È
		 //availWidth = parseInt(window.screen.availWidth);
	     //availHeight = parseInt(window.screen.availHeight);

         //»ñÈ¡¿É¼ûÇøÓò ¿í¶È ¸ß¶È
		 availWidth = parseInt(document.body.clientWidth);
	     availHeight = parseInt(document.body.clientHeight);

		  y = y + (availHeight-dialogH)/2;
	      x = (availWidth - dialogW)/2;

		//disObj.style.left=x+"px";
		//disObj.style.top=y+"px";

		GetCenterXY_ForLayer(disObj);

	}catch(e){
	}
}

function openCtSecurity()
{
	var sUrl = "/process/magazine/error_07.html";
	window.open(sUrl,'ÖÇÍ¨ÈË²Å','left=100,top=80,height=615,width=690,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no');
}

//½«Ðü¸¡²ãµÄÎ»ÖÃ¶¨Î»ÔÚbody¿É¼ûÇøÓòÖÐÑë
function GetCenterXY_ForLayer(objdiv){
	var objTop;
	var objLeft;
	if (document.documentElement  && document.documentElement.clientHeight)
	{ 
		var styleWidth=objdiv.style.width.substring(0,objdiv.style.width.length-2);
		var clientHeight=objdiv.clientHeight;
		styleWidth = 350;
		objLeft = parseInt(document.documentElement.scrollLeft+(document.documentElement.clientWidth - styleWidth)/2)+'px';
		var relTop=(document.documentElement.clientHeight-clientHeight)/2 > 0 ? (document.documentElement.clientHeight-clientHeight)/2:0;
		objTop = parseInt(document.documentElement.scrollTop+relTop)+'px';
	} 
	else if (document.body) 
	{ 
		var x = document.body.scrollLeft;	
	    var   y = document.body.scrollTop;
        //»ñÈ¡¿É¼ûÇøÓò ¿í¶È ¸ß¶È
		 availWidth = parseInt(document.body.clientWidth);
	     availHeight = parseInt(document.body.clientHeight);
	     tblWidth = 350;   
		 objTop = y + availHeight/4;
	     objLeft = (availWidth - tblWidth)/2;
	} 
	objdiv.style.top = objTop;
	objdiv.style.left = objLeft;
	return objdiv;
}