/**曾**/
var PageNodeControl = {

	
}

var Url = {
	go:function(url){
		window.location.href = url;
	},
	addBookmark:function(title){//加入收藏夹
		if (window.sidebar){ 
		  window.sidebar.addPanel(title, window.location.href,""); 
		}else if( document.all ){
		  window.external.addFavorite( window.location.href, title);
		}else if( window.opera && window.print ){
			return true;
	  	}
	},
	
	setHomePage:function(url){//设为首页
		var objs = document.getElementsByTagName("body");
		iehomepage = objs[0];
		iehomepage.style.behavior='url(#default#homepage)';if(!(iehomepage.isHomePage(url)))iehomepage.setHomePage(url);
	},
	copy:function(url){
		window.clipboardData.setData("Text",url ); 
	}
}


var Img ={
	maxWidth:0,
	maxHeight:0,
	width:0,
	height:0,
	controlMaxSize:function (imgObj,w,h){
		 this.maxWidth = w;
		 this.maxHeight = h;
		 var image=new Image();
	     image.src=imgObj.src;
	     if(image.width>0 && image.height>0){
	              if(image.width/image.height>= this.maxWidth/this.maxHeight){
	              		if(image.width>this.maxWidth){
	              				imgObj.width=this.maxWidth;
	              				imgObj.height=(image.height*this.maxWidth)/image.width;
								this.width = this.maxWidth;
								this.height = (image.height*this.maxWidth)/image.width;
	              		}else{
	              				imgObj.width=image.width;
	              				imgObj.height=image.height;
								this.width = image.width;
								this.height = image.height;
	              		}        
	              } else{
	              		if(image.height>this.maxHeight){
	              		     imgObj.height=this.maxHeight;          
	              		     imgObj.width=(image.width*this.maxHeight)/image.height;   
							 this.width = image.width;
							 this.height = image.height;
	              		}else{
	              		     imgObj.width=image.width;                 
	              		     imgObj.height=image.height;
							 this.width = image.width;
							 this.height = image.height;
	              		}         
	             }     
	    }
	}
}


var Cookies = {
	setCookies:function(name, value){
		    var Days = 30; 
    		var exp  = new Date();
    		exp.setTime(exp.getTime() + Days*24*60*60*1000);
    		document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
	},
	
	getCookies:function(name){
		var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
     	if(arr != null) return unescape(arr[2]); return null;
	},
	
	clearCookies:function(name) {
  		var exp = new Date();
    	exp.setTime(exp.getTime() - 1);
    	var cval=getCookie(name);
    	if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
	}
}


var Checkbox = {
	select:function(name,val){
	    var el = document.getElementsByName(name);
	    var len = el.length;
	    for(var i=0; i<len; i++){
	    	if((el[i].type=="checkbox") && (el[i].name==name)&&(el[i].value==val)){
	    		el[i].checked = true;         
	    	}     
	    }
	},
	selectAll:function(name){
		    var el = document.getElementsByName(name);
		    var len = el.length;
		    for(var i=0; i<len; i++){
		    	if((el[i].type=="checkbox") && (el[i].name==name)){
		    		el[i].checked = true;         
		    	}     
		    }
	},
	getAllObj:function(name){
			var el = document.getElementsByName(name);
			var groupTypeId = new Array();  
		    var len = el.length;
		    for(var i=0; i<len; i++){
		    	if((el[i].type=="checkbox") && (el[i].name==name)&&el[i].checked == true){
		    		groupAry = boxes[i].value;       
		    	}     
		    }
	
	},
	cancelAll:function(name){
		    var el = document.getElementsByName(name);
		    var len = el.length;
		    for(var i=0; i<len; i++){
		    	if((el[i].type=="checkbox") && (el[i].name==name)){
		    		el[i].checked = false;
		    	}
		    }
	},
	selectGhost:function(name){
		    var el = document.getElementsByName(name);
		    var len = el.length;
		    for(var i=0; i<len; i++){
		    	if((el[i].type=="checkbox") && (el[i].name==name)){
		    		if(el[i].checked){
		    			el[i].checked = false;
		    		}else{
		    			el[i].checked = true;
		    		}
		    	}     
		    }
	}
}
var Css = {
	loadCss:function(href,name){
		var tagList = document.getElementsByTagName("link");
		var exist = "0";
		for(var i=0;i<tagList.length;i++){
			var taghref = tagList[i].href;
			if(taghref.indexOf(name)!=-1){
				exist="1";
			}
		}
		if(exist=="0"){
			var l = document.createElement("link");
			    l.setAttribute("type", "text/css");
			    l.setAttribute("rel", "stylesheet");
			    l.setAttribute("href",href);
		    document.getElementsByTagName("head")[0].appendChild(l);
		}
	}
}


var Select = {
	selectItemVal:function(objSelect,val){
		for (var i = 0; i < objSelect.options.length; i++) {        
            if (objSelect.options[i].value == val) {        
                objSelect.options[i].selected  = true;        
                break;        
            }        
        }
	}
}

var TagAttribute = {
	setAttribute:function(obj,name,value){
		obj.setAttribute(name,value);
	},
	removeAttribute:function(obj,name){
		obj.removeAttribute(name);
	}
}










