﻿function tabs(obj1, objControl1, obj2, objcontrol2, classin, classout) {

    $(document).ready(function() {

        $(objControl1).show();
        $(objcontrol2).hide();
        $(objControl1).show();
        $(objcontrol2).hide(); $(obj2).addClass(classout);
        $(obj1).css("cursor", "pointer");
        $(obj1).removeClass(classout);
        $(obj1).addClass(classin);
     });

 }

 function tabshow(obj1_qz, obj1_num, tabcount, cssin, cssout) {

     $(document).ready(function() {

         //  var aa = $(obj1).attr("id");
         for (var i = 1; i <= tabcount; i++) {

             $("#" + obj1_qz + i + "_").hide();
             $("#" + obj1_qz + i).removeClass(cssin);
             $("#" + obj1_qz + i).addClass(cssout);
         }

         $("#" + obj1_qz + obj1_num + "_").show();
         $("#" + obj1_qz + obj1_num).css("cursor", "pointer");
         $("#" + obj1_qz + obj1_num).removeClass(cssout);
         $("#" + obj1_qz + obj1_num).addClass(cssin);

     });

 }


 function imgsize(ImgD, FitWidth, FitHeight) {
     var image = new Image();
     image.src = ImgD.src;
     if (image.width > 0 && image.height > 0) {
         if (image.width / image.height >= FitWidth / FitHeight) {
             if (image.width > FitWidth) {
                 ImgD.width = FitWidth;
                 ImgD.height = (image.height * FitWidth) / image.width;
             } else {
                 ImgD.width = image.width;
                 ImgD.height = image.height;
             }
         } else {
             if (image.height > FitHeight) {
                 ImgD.height = FitHeight;
                 ImgD.width = (image.width * FitHeight) / image.height;
             } else {
                 ImgD.width = image.width;
                 ImgD.height = image.height;
             }
         }
     }
 }





 //openScript
 function openScript(url, width, height) {
     var Win = window.open(url, "openScript", 'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=no');
 }


 //自适应iframe高度
 function SetCwinHeight(objname) {
     var bobo = $E(objname);
     if (document.getElementById) {
         if (bobo && !window.opera) {
             if (bobo.contentDocument && bobo.contentDocument.body.offsetHeight) {
                 bobo.height = bobo.contentDocument.body.offsetHeight;
             } else if (bobo.Document && bobo.Document.body.scrollHeight) {
                 bobo.height = bobo.Document.body.scrollHeight;
             }
         }
     }
 }


 //选取所有
 function CheckAll(form) {
     for (var i = 0; i < form.elements.length; i++) {
         var e = form.elements[i];
         if (e.name != 'chkall') e.checked = form.chkall.checked;
     }
 }











 //////////////////////////////////// 切换块TAB
 function showcon(obj, ulid) {
     var o = document.getElementById(ulid);
     var c = o.childNodes;
     for (var i = 0; i < c.length; i++) {
         if (typeof c[i] != "HTMLLIElement") {
             if (c[i] == obj) {
                 c[i].className = "on";
                 var liid = c[i].id;
                 if (typeof liid != "undefined" && liid != "") {
                     //				  alert("selected:"+c[i].id);
                     var con = document.getElementById("con_" + c[i].id);
                     if (typeof con != "undefined" && con != "") {
                         con.style.display = "";
                     }
                 }
             } else {
                 c[i].className = "";
                 var liid = c[i].id;
                 if (typeof liid != "undefined" && liid != "") {
                     //				  alert(c[i].id);
                     var con = document.getElementById("con_" + c[i].id);
                     if (typeof con != "undefined" && con != "") {
                         con.style.display = "none";
                     }
                 }
             }
         }
     }
 }
 
 
 
 
 