$(document).ready(function(){
         
     var tbs=$("td[class='pic']").find("table");
     var tb1=tbs.eq(0);
     tb1.removeClass("fg_Business_tb");
     tb1.addClass("fg_Business_tb_on");
     
     var td1=tb1.find("td[class='fg_Business_td']");
     td1.removeClass("fg_Business_td");
     td1.addClass("fg_Business_td_on");
    
    
     var span1=td1.find("span[class='fg_Business_span']");
     span1.removeClass("fg_Business_span");
     span1.addClass("fg_Business_span_on");
     

    
 

    $("li[class='title']").mouseover(function(){
        //$(this).css("background-image","url('/images/bg_s.gif')");
        $(this).css("color","#be2c22");
        $(this).find("div").fadeIn(0)
        
		 })
		 
    $("li[class='title']").mouseleave(function(){
        //$(this).css("background-image","");
        $(this).css("color","#000000");
        $(this).find("div").fadeOut(0);
		 })
		 
		 
     $("li[class='title_big']").mouseover(function(){
        //$(this).css("background-image","url('/images/bg_l.gif')");
        $(this).css("color","#be2c22");
        $(this).find("div").fadeIn(0)
		 })
		 
    $("li[class='title_big']").mouseleave(function(){
        //$(this).css("background-image","");
        $(this).css("color","#000000");
        $(this).find("div").fadeOut(0)
		 })
		 
		 
		 
		
		
	$(".Sec_Title_Style").mouseover(function(){
        $(this).parent().parent().css("background","#727272");
        $(this).parent().parent().find("span").css("color","#ffffff")
		 }) 
		 
    $(".Sec_Title_Style").mouseleave(function(){
        $(this).parent().parent().css("background","#f3f3f3");
        $(this).parent().parent().find("span").css("color","#000000")
	    })
    
		 
    
    
     $("td[class='mouse_pic_out_show']").mouseover(function(){
        $(this).removeClass("mouse_pic_out_show");
		$(this).addClass("mouse_pic_over_show");
		 })
		 
	 $("td[class='mouse_pic_out_show']").mouseout(function(){
	      $(this).removeClass("mouse_pic_over_show");
		  $(this).addClass("mouse_pic_out_show");
		 })
		
		
    	
	$("table[class='fg_Business_tb']").find("span:eq(0)").mouseover(function(){
	    $(this).css("text-decoration","underline")
	})
	
    $("table[class='fg_Business_tb']").find("span:eq(0)").mouseout(function(){
	    $(this).css("text-decoration","none")
	})


	
	 $("table[class='fg_Business_tb']").click(function(){

	      $(this).removeClass("fg_Business_tb");
		  $(this).addClass("fg_Business_tb_on");
		  
		  var tds=$(this).find("td[class='fg_Business_td']")
		  tds.removeClass("fg_Business_td");
		  tds.addClass("fg_Business_td_on");
          
		  var spans=tds.find("span[class='fg_Business_span']")
		  spans.removeClass("fg_Business_span");
		  spans.addClass("fg_Business_span_on");
		  
		  
		  var imgID=tds.eq(0).find("input[type='hidden']:eq(0)").attr("value")
		  var lkSrc=tds.eq(0).find("input[type='hidden']:eq(1)").attr("value")
		  if(imgID==undefined){
		        return;
		  }
		  $("#bigPic_center").fadeOut(0);
		  $("#bigPic_center").attr("src",imgID);
		  $("#bigPic_center").click(function(){
		    window.location.href=lkSrc;
		  })
		  $("#bigPic_center").fadeIn(0);
		  
		 })  
		 
	
	

    $("table[class='fg_Business_tb']").mouseleave(function(){
        
	      $(this).removeClass("fg_Business_tb_on");
		  $(this).addClass("fg_Business_tb");
		  var tds=$(this).find("td[class='fg_Business_td_on']")
		  tds.removeClass("fg_Business_td_on");
		  tds.addClass("fg_Business_td");
		  
		  var spans=tds.find("span[class='fg_Business_span_on']")
		  spans.removeClass("fg_Business_span_on");
		  spans.addClass("fg_Business_span");
		 })  
		 
	
    $("#bigPic_center").mouseover(function(){
        clearInterval(AutoPlayObj);
    });
    
    $("#bigPic_center").mouseout(function(){
        AutoPlay();
    })
    
    
    
    
    $("#image_Cont").mouseover(function(){
        clearInterval(AutoPlayObj);
    });
    
    $("#image_Cont").mouseout(function(){
        AutoPlay();
    })
    

     $("#rightMove").mouseup(function(){
        ISL_GoDown();
        ISL_StopDown();
    })
    
    
     $("#leftMove").mouseup(function(){
        ISL_GoUp();
        ISL_StopUp();
    })
    
     $(".Left_Sec_Title_Style_big").click(function(){
       $(".Left_Sec_Title_Style_big").not($(this)).siblings().css("display","none");
       $(this).siblings().toggle();
    })
    
    
    
      $(".Sec_Title_Style_big").click(function(){
       var str=$(this).siblings().eq(0).find("a").attr("href");
       window.location.href=str;
    })
    
   
      
});

function selectChange(obj){
    if(obj.value!=""){
        window.open(obj.value)
    }
}



function checkSub(){
    if($("#TrainTb").find("tr").length==1){
        alert("教育（培训经历至少填写一行）！");
        return false;
    }
    
    if($("#workTb").find("tr").length==1){
        alert("工作（实习经历至少填写一行）！");
        return false;
    }
    
    var txts=$("#upInfo").find(".MustFill");
    txts.blur(function(){
        $(this).css("background","");
    });
    for(i=0;i<txts.length;i++){
        if(txts.eq(i).val()==""){
            txts.eq(i).css("background","yellow");
            alert("必填项不能为空！");
            txts.eq(i).focus();
            return false;
        }
    }
    
   var areas=$("#upInfo").find("textarea[className='MustFillTotal']");
        areas.blur(function(){
        areas.eq(i).css("background","");
    });
    for(i=0;i<areas.length;i++){
        if(areas.eq(i).val().length<=50){
            alert("填写字数不少于50！");
            areas.eq(i).css("background","yellow");
            areas.eq(i).focus();
            return false;
        }
    }

    $("input[id*='TrainHd']").eq(0).val($("#TrainTb").parent().html().replace(/</g ,"&lt;").replace(/>/g,"&gt;"));
    $("input[id*='workHd']").eq(0).val($("#workTb").parent().html().replace(/</g ,"&lt;").replace(/>/g,"&gt;"));
    saveResume();
}


function saveResume(){
    var tb=document.getElementById("upInfo")
    var picStr="Default.gif"
    if(document.getElementById("downDoc").innerText!=""){
        picStr=document.getElementById("downDoc").innerText;
    }
    var str="<table align=\"center\" cellspacing =\"0\" cellpadding =\"0\" style=\"border-collapse:collapse;width:660px;table-layout:fixed;font-size:12px;\">"
    str+="<tr>";
    str+="<td style =\"width:66px;background-color:#f4f4f4;border:solid 1px #b9d8f3;\">姓名</td><td style =\"width:200px;border:solid 1px #b9d8f3;text-indent:5px;\">"+tb.rows[0].cells[1].childNodes[0].value+"</td>"
    str+="<td style =\"width:66px;background-color:#f4f4f4;border:solid 1px #b9d8f3;\">性别</td><td style =\"width:200px;border:solid 1px #b9d8f3;text-indent:5px;\">"+ tb.rows[0].cells[3].childNodes[0].options[tb.rows[0].cells[3].childNodes[0].selectedIndex].text+"</td>"
    str+="<td align=\"center\" rowspan=\"7\" style =\"border:solid 1px #b9d8f3;\"><img src=\"http://www.kedachina.com.cn/manaUploads/CN/JL/"+picStr+"\" style =\"width :114px; height :156px;\"/></td>"
    str+="</tr>"
    
    str+="<tr>";
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">民族</td><td style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+tb.rows[1].cells[1].childNodes[0].value+"</td>"
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">籍贯</td><td style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+ tb.rows[1].cells[3].childNodes[0].value+"</td>"
    str+="</tr>"
    
    
    str+="<tr>";
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">出生日期</td><td style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+tb.rows[2].cells[1].childNodes[0].value+"</td>"
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">身高</td><td style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+ tb.rows[2].cells[3].childNodes[0].value+"</td>"
    str+="</tr>"
    
    
    str+="<tr>";
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">体重</td><td style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+tb.rows[3].cells[1].childNodes[0].value+"</td>"
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">婚否</td><td style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+ tb.rows[3].cells[3].childNodes[0].options[tb.rows[3].cells[3].childNodes[0].selectedIndex].text+"</td>"
    str+="</tr>"
    
    
    
    str+="<tr>";
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">学历</td><td style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+tb.rows[4].cells[1].childNodes[0].value+"</td>"
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">专业</td><td style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+ tb.rows[4].cells[3].childNodes[0].value+"</td>"
    str+="</tr>"
    
    
    
    str+="<tr>";
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">外语水平</td><td style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+tb.rows[5].cells[1].childNodes[0].value+"</td>"
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">电话</td><td style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+ tb.rows[5].cells[3].childNodes[0].value+"</td>"
    str+="</tr>"


    str+="<tr>";
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">电子邮箱</td><td style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+tb.rows[6].cells[1].childNodes[0].value+"</td>"
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">应聘职位</td><td style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+ tb.rows[6].cells[3].childNodes[0].value+"</td>"
    str+="</tr>"
    //--------------------------------------------------------------------------------------
    
    str+="<tr>";
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">期望薪资</td><td style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+tb.rows[7].cells[1].childNodes[0].value+"</td>"
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">到岗时间</td><td colspan=\"2\" style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+ tb.rows[7].cells[3].childNodes[0].value+"</td>"
    str+="</tr>"
    
    str+="<tr>";
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">身份证号</td><td colspan=\"4\" style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+tb.rows[8].cells[1].childNodes[0].value+"</td>"
    str+="</tr>"
    
    str+="<tr>";
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">户籍所在地</td><td colspan=\"4\" style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+tb.rows[9].cells[1].childNodes[0].value+"</td>"
    str+="</tr>"
    
    str+="<tr>";
    str+="<td style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">目前居住地</td><td colspan=\"4\" style =\"border:solid 1px #b9d8f3;text-indent:5px;\">"+tb.rows[10].cells[1].childNodes[0].value+"</td>"
    str+="</tr>"
    
   //----------------------------------------------------------------------------------------
   str+="<tr>";
    str+="<td colspan=\"5\" style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">教育（培训）经历</td>"
    str+="</tr>"
    
    str+="<tr>";
    str+="<td colspan=\"5\" style =\"border:solid 1px #b9d8f3;\">"+tb.rows[13].cells[0].innerHTML+"</td>"
    str+="</tr>"
    
    
    str+="<tr>";
    str+="<td colspan=\"5\" style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">工作（实习）经历</td>"
    str+="</tr>"
    
    
    str+="<tr>";
    str+="<td colspan=\"5\" style =\"border:solid 1px #b9d8f3;\">"+tb.rows[15].cells[0].innerHTML+"</td>"
    str+="</tr>"
    
    
    str+="<tr>";
    str+="<td colspan=\"5\" style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">工作内容及技能描述</td>"
    str+="</tr>"
    
    
    str+="<tr>";
    str+="<td valign=\"top\" colspan=\"5\" style =\"height:60px;border:solid 1px #b9d8f3;\">"+tb.rows[17].cells[0].childNodes[0].value+"</td>"
    str+="</tr>"
    
    
    str+="<tr>";
    str+="<td colspan=\"5\" style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">受过奖励</td>"
    str+="</tr>"
    
    
    str+="<tr>";
    str+="<td valign=\"top\" colspan=\"5\" style =\"height:60px;border:solid 1px #b9d8f3;\">"+tb.rows[19].cells[0].childNodes[0].value+"</td>"
    str+="</tr>"
    
    
    str+="<tr>";
    str+="<td colspan=\"5\" style =\"background-color:#f4f4f4;border:solid 1px #b9d8f3;\">自我评价</td>"
    str+="</tr>"
    
    
    str+="<tr>";
    str+="<td valign=\"top\" colspan=\"5\" style =\"height:60px;border:solid 1px #b9d8f3;\">"+tb.rows[21].cells[0].childNodes[0].value+"</td>"
    str+="</tr>"
    
    str+="</table>"

   $("input[id*='Totalvalue']").eq(0).val(str.replace(/</g ,"&lt;").replace(/>/g,"&gt;"))
}

function preView(){
    saveResume();
    window.open("ResumeView.aspx","_blank")
}

function getResumeView(){
    var str=window.opener.$("input[id*='Totalvalue']").eq(0).val().replace(/&lt;/gi ,"<").replace(/&gt;/gi ,">");
    document.all("Resume").innerHTML=str;
    $("input").attr("readOnly","readOnly")
    $("input:checkbox").remove();
}

function checkSubAsk(){
    var txts=$("#upInfo").find(".MustFill");
    txts.blur(function(){
        $(this).css("background","");
    });
    for(i=0;i<txts.length;i++){
        if(txts.eq(i).val()==""){
            txts.eq(i).css("background","yellow");
            alert("必填项不能为空！");
            txts.eq(i).focus();
            return false;
        }
    }
    
    
   var areas=$("#upInfo").find("textarea[className='MustFillTotal']");
        areas.blur(function(){
        areas.eq(i).css("background","");
    });
    for(i=0;i<areas.length;i++){
        if(areas.eq(i).val().length<=50){
            alert("填写字数不少于50！");
            areas.eq(i).css("background","yellow");
            areas.eq(i).focus();
            return false;
        }
    }
    var str="&lt;table style='border-collapse:collapse;'&gt;";
    $("#upInfo").find("tr:lt(6)").each(function(){
        str+="&lt;tr&gt;";
        $(this).find("td").each(function(){
            if($(this).find("input").val()!=undefined){
                str+="&lt;td width=700 style='border:solid 1px #c0c0c0' colspan="+$(this).attr("colspan")+"&gt;"+$(this).find("input").val()+"&lt;/td&gt;";
            }else if($(this).find("textarea").val()!=undefined){
                str+="&lt;td width=700 style='border:solid 1px #c0c0c0' colspan="+$(this).attr("colspan")+"&gt;"+$(this).find("textarea").val().replace(/ /g ,"&nbsp;").replace(/\n/g,"&lt;br&gt;")+"&lt;/td&gt;";
            }else if($(this).find("select").val()!=undefined){
                var sel=$(this).find("select option:selected")
                str+="&lt;td style='border:solid 1px #c0c0c0' colspan="+$(this).attr("colspan")+"&gt;"+sel.text()+"&lt;/td&gt;";
            }else{
                str+="&lt;td width=120 style='border:solid 1px #c0c0c0' colspan="+$(this).attr("colspan")+"&gt;"+$(this).text()+"&lt;/td&gt;";
            }
        })
        str+="&lt;/tr&gt;"
    })
    str+="&lt;/table&gt;"
    $("input[id*='Totalvalue']").eq(0).val(str);
}



function FileCheck(FileObj){
    FileObj=FileObj.previousSibling
	var AllowFileSize = 100;
	var ImgObj = new Image();
	ImgObj.dynsrc = FileObj.value;
	var FileSize = Math.round(ImgObj.fileSize/1024*100)/100/1000;
	if(AllowFileSize!=0 && FileSize>AllowFileSize){
		alert("上传文件不能超过100MB");
		return false;
	}
	
	return true;
} 


function ImgCheck(FileObj){
    FileObj=FileObj.previousSibling
    if(FileObj.value==""){
        alert("路径为空！");
        return false;
    }
	var AllowFileSize = 3;
	var ImgObj = new Image();
	try{
	    ImgObj.dynsrc = FileObj.value;
	}catch(e){
	    return true;
	}
	    
    
	var FileSize = Math.round(ImgObj.fileSize/1024*100)/100/1000;
	if(AllowFileSize!=0 && FileSize>AllowFileSize){
		alert("上传文件过大,最大上传为3M");
		return false;
	}
	
	return true;
} 

function ImgCheckApp(FileObj){
    if(!ImgCheck(FileObj)){
        return false;
    }else{
        $("input[id*='TrainHd']").eq(0).val($("#TrainTb").parent().html().replace(/</g ,"&lt;").replace(/>/g,"&gt;"))
        $("input[id*='workHd']").eq(0).val($("#workTb").parent().html().replace(/</g ,"&lt;").replace(/>/g,"&gt;"))
        return true;
    }
}





function AddRow(ObjStr){
    var tb=document.getElementById(ObjStr)
    var rowNum=tb.rows.length;
    tb.insertRow();
    for(i=0;i<7;i++){
        tb.rows(rowNum).insertCell();
        if(i==0){
            tb.rows(rowNum).cells(i).innerHTML="<input type='checkbox' style='border-style:none;'>"+rowNum;
            tb.rows(rowNum).cells(i).style.textAlign="center"
        }else{
            tb.rows(rowNum).cells(i).innerHTML="<input style='border-style:none;width:97%' class='MustFill'/>";
        }
       tb.rows(rowNum).cells(i).style.border="solid 1px #c0c0c0";
    }
}


function delRow(ObjStr){
    //给表格删除一行记录
    var tblObj;
    var rownum;
    var colnum;
    var mi;
    var ni;
    tblObj = document.all(ObjStr);
    rownum=tblObj.rows.length;
    var nnum=0;
    for(mi=0;mi<rownum;mi++){
	    if(tblObj.rows(mi).cells(0).childNodes(0).checked==true){
            tblObj.deleteRow(mi);
	        mi=mi-1;
	        rownum=rownum-1;
	        nnum=nnum+1;
    	
	    }
    }
    if(nnum==0){alert("请选择要删除的行!");return false;}
    //重新编号
    rownum=tblObj.rows.length;
    for(mi=1;mi<rownum;mi++){
	    tblObj.rows(mi).cells(0).innerHTML=tblObj.rows(mi).cells(0).childNodes(0).outerHTML+mi;
    }

}


var flag=false;
function DrawImage(ImgD,width,height)
{
    var image=new Image();
    var iwidth = width; //定义允许图片宽度
    var iheight = height; //定义允许图片高度
    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;
            }
        }
        else
        {
            if(image.height>iheight)
            {
                ImgD.height=iheight;
                ImgD.width=(image.width*iheight)/image.height;
            }
            else
            {
                ImgD.width=image.width;
                ImgD.height=image.height;
            }
        } 
    }
}
