
	String.prototype.trim = function(){
	    return this.replace(/(^\s*)|(\s*$)/gi, "");
	}

	String.prototype.replaceAll = function(str1, str2){
	    var temp_str = "";

	    if (this.trim() != "" && str1 != str2){
	        temp_str = this.trim();

	        while (temp_str.indexOf(str1) > -1){
	            temp_str = temp_str.replace(str1, str2);
	        }
	    }

	    return temp_str;
	}

	//Header Menu Show
	function showMenu(id) {
		switch(id){
		case 'glb' : $('#h_glb').addClass("gnb_glb_on");
			break;
		case 'lang' : $('#h_lang').addClass("gnb_lang_on");
			break;
		case 'aff' : $('#f_aff').addClass("aff_on");
			break;
		default : $('#h_'+id).addClass("lnb_"+id+"_on"); break;
		}
	}

	//Header Menu Hide
	function hideMenu(id) {
		switch(id){
		case 'glb' : $('#h_glb').removeClass("gnb_glb_on");
			break;
		case 'lang' : $('#h_lang').removeClass("gnb_lang_on");
			break;
		case 'aff' : $('#f_aff').removeClass("aff_on");
		default : $('#h_'+id).removeClass("lnb_"+id+"_on"); break;

		}
	}
	function spotOption() {
		if($('#wrap').attr('class').indexOf('spot_collapse') > 0){
			$('#wrap').removeClass("spot_collapse");
		}else{
			$('#wrap').addClass("spot_collapse");
		}
	}

	// 메인페이지 롤링
	function rolling(options) {
		var self = this;
		this.object = document.getElementById(options.rollId);
		this.object.onmouseover = function() { self.stop(); };
		this.object.onmouseout = function() { self.play(); };
		this.delay = options.delay || 1000;
		this.speed = options.speed || 50;
		this.step = options.step || 1;
		this.mover = options.mover || false;
		this.elChildHeight = options.childHeight;
		this.elHeight = this.object.offsetHeight;
		this.elPosition = 0;
		this.object.appendChild(this.object.cloneNode(true));
		this.control = setTimeout(function() {self.play()}, this.delay);
	}
	rolling.prototype = {
		play:function() {
			var self = this, time;
			this.elPosition = this.elPosition>(this.mover?this.elHeight:0) ? this.elPosition-this.elHeight : this.elPosition+1;
			this.object.style.top = (this.mover ? -this.elPosition : this.elPosition) + "px";
			this.control = setTimeout(function() {self.play()}, this.elPosition%(this.elChildHeight*this.step)==0?this.delay:this.speed);
		},
		stop:function() {
			clearTimeout(this.control);
		}
	}
	var roll1 = null, roll2 = null;

	function changeDate(date) {
		if($("#from_date").val().replaceAll(".","") > $("#to_date").val().replaceAll(".","")){
			alert('Search term is incorrect.');
			$("#"+selectId).val(oldselectData);
			return;
		}
	}

	try { document.execCommand('BackgroundImageCache', false, true);} catch(e) {}
