function getParameter(str){
	var dec = decodeURIComponent;
	var par = new Array, itm;
	if(typeof(str) == 'undefined') return par;
	if(str.indexOf('?', 0) > -1) str = str.split('?')[1];
	str = str.split('&');
	for(var i = 0; str.length > i; i++){
		itm = str[i].split("=");
		if(itm[0] != ''){
			par[itm[0]] = typeof(itm[1]) == 'undefined' ? true : dec(itm[1]);
		}
	}
	return par;
}


RTHotelCommon = function() {
	this.imgList = new Array
}

RTHotelCommon.prototype = {
	createImage : function(url) {
		var image = new Image();
		image.src = url;
		this.imgList.push(image);
	},
	
	allViewChange : function(pName, num) {
		if(num != undefined){
//		for (var i = 0; i < this.imgList.length; i++){
			$(pName).find("img").css({width:this.imgList[num].width, height:this.imgList[num].height});
//		}
		}
	},
	
	sizeChange : function(imgWidth, imgHeight) {
		if(this.imgList != undefined) {
			for(var i = 0; i < this.imgList.length; i++) {
				if (imgHeight > 0) {
					if (this.imgList[i].height > imgHeight) {
						this.imgList[i].width  = (Math.floor(this.imgList[i].width  * (imgHeight/this.imgList[i].height)));
						this.imgList[i].height = (Math.floor(this.imgList[i].height * (imgHeight/this.imgList[i].height)));
					}
				}
				if (imgWidth > 0) {
					if (this.imgList[i].width > imgWidth) {
						this.imgList[i].height = (Math.floor(this.imgList[i].height * (imgWidth/this.imgList[i].width)));
						this.imgList[i].width  = (Math.floor(this.imgList[i].width  * (imgWidth/this.imgList[i].width)));
					}
				}
			}
		}
	},
	
	getWidth : function(num) {
		return this.imgList[num].width;
	},
	
	getHeight : function(num) {
		return this.imgList[num].height;
	},
	
	isComplete : function(num) {
		return this.imgList[num].complete;
	},
	
	isAllComplete : function() {
		var comp = 0;
		for(var i = 0; i < this.imgList.length; i++) {
			if(this.imgList[i].complete == true) {
				comp++;
			}
		}
		if(comp == this.imgList.length) {
			return true;
		} else {
			return false;
		}
	}
}

function addEvent(elm,listener,fn){
	try{
		elm.addEventListener(listener,fn,false);
	}catch(e){
		elm.attachEvent("on"+listener,fn);
	}
}

