//************************************************************************************
// Description : È¸¿øÅëÇÕ ¾È³» ÆË¾÷
// Parameter: 
// Return: 
// Usage: 
//************************************************************************************

	var window_mode = "div";
	
	function readCookie(name) {
		str = document.cookie;
		start = str.indexOf(name);
		
		if(start == -1) {
			return "";
		}
		
		start = start + name.length + 1;
		end = str.indexOf(";", start);
		
		if(end == -1) {
			end = str.length;
		}
		
		str = str.substring(start, end);
		
		return unescape(str);
	}
	
	/**
	 * ·¹ÀÌ¾î ÆË¾÷
	 * @param left
	 * @param top
	 * @param width
	 * @param height
	 * @param src
	 * @param name : Ã¢ÀÌ¸§ (cookie ¿¡¼­ »ç¿ë)
	 * @param border
	 * @param modal : modal ¿©ºÎ
	 * @param close : Ã¢´Ý±â ¹öÆ° ¿©ºÎ
	 * 
	 * example
	 * 
	 */
	function activatePop(left, top, width, height, src, name, border, modal, close) {
		
		$(document).ready(function() {
			//alert("readCookie="+readCookie(name));
			if(readCookie(name) != "checked") {
				
				if(window_mode == "popup") {
					
					left = 0;
					top = 0;
					close = "";
					modal = "";
				    var mx = screen.height / 2;
				    moveTo(mx,100);
				    resizeTo(parseInt(width) + 40 ,parseInt(height) + 60);
				    
				}
				
				if($("#divPop").length > 0)
					$("#divPop").remove();
				
				if(left == "center")
					left = parseInt((parseInt($(document.body).attr("scrollWidth")) - width) / 2);

				if(top == "center")
					top = parseInt((parseInt($(document.body).attr("scrollHeight")) - height) / 2);
				
				if(modal == "modal")
					setModalBackGround();
				
				var closeHtml = "";
				if(close == "close")
					closeHtml = "<p style='position: absolute; right: -16px; top: -16px;'><img id='btnClose' style='cursor:pointer;' alt='close' src='/sec/main/common/img/btn_layTip_close.png'></p>"; 
				
				var html  = "<div id='divPop' style='z-index:999; border: "+border+"; position: absolute; left: "+left+"px; top: "+top+"px; width: "+width+"px; height: "+height+"px;'>";
				html     += "<iframe id='ifrmPop' width='"+ width +"px' height='"+ height +"px' frameBorder='0px' scrolling='no' src='"+src+"'></iframe>";
				html     += closeHtml;
				html     += "</div>";				
				
				$(document.body).append(html);
			}
		});
		
		$(function(){
			$("#btnClose").click(function() {
				if(window_mode == "popup") {
					self.close();
				}else {
					deActivatePop();
				}
				
			});
		});
		
	}
	
	function deActivatePop(){
		if(window_mode == "popup") {
			self.close();
		}else {
			$("#divPop").remove();
			removeModalBackGround();
		}
	}

	function removeModalBackGround() {
		if($("#divModalBackGround").length > 0)
			$("#divModalBackGround").remove();		
	}

	try{
		if (get_site_code() != getCookie('prof_country')) {
			deleteCookie('prof_id', '/', 'samsung.com');
			deleteCookie('prof_country', '/', 'samsung.com');
		}
		
	} catch (e) {}


	var siteUrl = document.URL;
		
	if (siteUrl.indexOf("redirect=Y") > 0) {
		activatePop("center", "150", "587", "642", "/sec/member_popup.html", "PG-401", "", "", "close");
	}

