﻿// swingJsBase
//var msg,form,mainDiv,loading,processing;
//      this.onload=function() {
//          //全局变量初始化
//          form=document.forms[0];
//          mainDiv=$("main");
//          if(mainDiv)loading=mainDiv.down(0);
//          processing=$("processing");
//          //前台全局始化
//          if(typeof(pageInitialize)!="undefined")pageInitialize();
//          
//           //信息提示初始化
//          if(!(msg=$("ctl00_msg")))msg=$("ctl00_ctl00_msg");
//          msg.onpropertychange=obj.onShowMsg.bindAsEventListener(msg);
//          if(msg.innerHTML.length>2)msg.innerText=msg.innerText; 
//          
//          //processing初始化
//           var handle = {
//                onCreate: function() {
//                Element.show(processing); 
//                },

//            onComplete: function() {
//            if (Ajax.activeRequestCount == 0) {
//                Element.hide(processing);
//            }
//           }
//        };
//        Ajax.Responders.register(handle);
//     };
//    
  
//     
//     var  obj = {
//                onShowMsg: function(event) {
//                if(event.propertyName==="innerText"){
//	                 new Effect.Parallel(
//	                                        [
//                                              new Effect.Highlight(this,
//                                                                {
//                                                                    duration:5.0
//                                                                }
//                                                                 ),
//                                               new Effect.Opacity(this,
//                                                                    {   duration:5.0,
//                                                                        from:1.0,to:0.0,
//                                                                        transition:Effect.Transitions.sinoidal
//                                                                    }
//                                                                  )
//                                            ],
//                                            {
//                                                duration:5.0
//                                            }
//                                        );
//                  }
//	        }
//      }
//    
      function complete(response) {
            response.responseText.evalScripts();
            Form.enable(document.forms[0]);
      }

function Action(){};
Action.swapMenu=function(divId){
                     var li = Element.extend(event.srcElement).up(0);
                     li.className="current";
                     var showId=null;
                     if(li.previous(0))
                     {
                        li.previous(0).clearAttributes();
                        Element.show(divId+"2");
                        showId=divId+"2";
                        Element.hide(divId+"1");
                     }
                     else
                     {
                        li.next(0).clearAttributes();
                        Element.hide(divId+"2");
                        Element.show(divId+"1");
                         showId=divId+"1"
                     }
                     Format.zoomImagesByNum($(showId).getElementsBySelector('img'),140);
                   };
Action.swapManyMenu=function(a){
                     
                         var li = Element.up(a,0);
                         var lis=li.up(0).immediateDescendants(); 
                         var current=lis.find(function(item){return item.className=='current'});
                         if(li!=current) {
                             current.removeClassName('current'); 
                             li.className='current';
                             current=$('div_'+li.id); 
                             current.up(0).getElementsByClassName('inner').each(function(item){if(item.id.indexOf(li.id)<1)item.hide();});
                             current.show(); 
                          } 
                   };
Action.checkAll=function(all){
                    var checkBoxs=$A(document.getElementsByName("checkBox"));
                    if(checkBoxs!=null)
                        checkBoxs.each(function(item){
                                   item.checked=all.checked;
                                    });
                    };
Action.checkAllForPart=function(all,par){
                    var checkBoxs=$A(Form.getInputs(form,'checkbox',par));
                    if(checkBoxs!=null)
                        checkBoxs.each(function(item){
                                   item.checked=all.checked;
                                    });
                    };
Action.copy=function(stringValue) {
    msg.innerText=self.clipboardData.setData("Text",stringValue)?"地址已经复制，请直接粘贴发给MSN/QQ好友。":"复制地址失败！";
}


                    
Action.copy=function(stringValue) {
    msg.innerText=self.clipboardData.setData("Text",stringValue)?"地址已经复制，请直接粘贴发给MSN/QQ好友。":"复制地址失败！";
}

Date.prototype.format = function(format)
{
        var o = {
            "M+" : this.getMonth()+1, //month
            "d+" : this.getDate(),    //day
            "h+" : this.getHours(),   //hour
            "m+" : this.getMinutes(), //minute
            "s+" : this.getSeconds(), //second
            "q+" : Math.floor((this.getMonth()+3)/3),  //quarter
            "S" : this.getMilliseconds() //millisecond
            }
        if(/(y+)/.test(format)) format=format.replace(RegExp.$1,
        (this.getFullYear()+"").substr(4 - RegExp.$1.length));
        for(var k in o)if(new RegExp("("+ k +")").test(format))
        format = format.replace(RegExp.$1,
        RegExp.$1.length==1 ? o[k] :
        ("00"+ o[k]).substr((""+ o[k]).length));
return format;
}

function Format(){};

//判断正整数 //
Format.isInt=function(str) {
    var re = /^[1-9]+[0-9]*]*$/;      
    return re.test(str)
} 
//缩小相框中的图片
Format.zoomImages=function(images) {
        images.each(function(img) {
                        if(img.height>84||img.width>84) {
                            if(img.height>img.width) 
                                img.height=84;
                            else
                                img.width=84;
                        }
                        else if(img.height==0) {
                            if(img.height>84||img.width>84) {
                                if(img.height>img.width) 
                                    img.height=84;
                                else
                                    img.width=84;
                            }
                        }
                     }); 
} 

//缩小相框中的图片
Format.zoomImagesByNum=function(images,num) {
        images.each(function(img) {
                        if(img.height>num||img.width>num) {
                            if(img.height>img.width) 
                                img.height=num;
                            else
                                img.width=num;
                        }
                        else if(img.height==0) {
                            if(img.height>num||img.width>num) {
                                if(img.height>img.width) 
                                    img.height=num;
                                else
                                    img.width=num;
                            }
                        }
                     }); 
}

     


