var PageNodeControl = {

	
}

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) {
		if(name!=null){
	  		var exp = new Date();
	    	exp.setTime(exp.getTime() - 1);
	    	var cval=getCookie(name);
	    	if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
		}
	},
	delCookie:function(cname){
		var cookarr=document.cookie.toString().split(";");
		var date=new Date()
		var timeout=parseFloat(date.getTime())-(30*24*60*60*1000);
		for (var i=0;i<cookarr.length;i++){
			var cookarrsub=cookarr[i].split("=");
			if (cname==cookarrsub[0]){
				document.cookie=cookarrsub[0]+"="+cookarrsub[1]+";expires="+timeout.toString();
			}
		}
	}
}


