 /******************************************************************************
 Copyright (c) 2007 Samsung Electronics. All Rights Reserved.
 Project: Samsung.com Site Renewal(2009.05~09)

 File Name : s3_util.js
 Description : SUPPORT3에서 사용하고자 하는 공통 JS

 Author : deuksoo.bang
 Since : 2009.08.04
 
 Modification Information
 Mod Date        Modifier         Description
 ----------      --------         ---------------------------
 2009.08.04      deuksoo.bang     create
******************************************************************************/

var S3Util = function(){}; 

/**
 * 팝업창
 */
S3Util.OpenWindow = function(url,intWidth,intHeight,resizeable,scrollbars,status,target,posX,posY)  {
	var defaultPosX = (screen.availWidth/2)-(intWidth/2);
	var defaultPosY = (screen.availHeight/2)-(intHeight/2);
	var winoption = "";
	
	if (resizeable) resizeable = 'yes'; else resizable = 'no';
	if (scrollbars) scrollbars = 'yes'; else scrollbars = 'no';	//no auto
	if (status) status = 'yes'; else status = 'no';
	
	if (!target) target = 'winPoP';
	if (!posX) posX = defaultPosX;
	if (!posY) posY = defaultPosY;
	
	winoption = "toolbar=no,location=no,directories=no,width="+intWidth;
	winoption = winoption + ",height="+intHeight+",left="+posX+",top="+posY;
	winoption = winoption + ",resizable="+resizeable+",scrollbars="+scrollbars;
	winoption = winoption + ",status=" + status;
	//alert(winoption);
	winObj = window.open(url, target, winoption);
	
	return winObj;
};

S3Util._preLayer = new Array();
S3Util._preLayer_idx = 0;

/**
 * div를 display:block; 한다.
 * @param id	jquery selector
 */
S3Util.showLayer = function(id) {
	S3Util._preLayer[S3Util._preLayer_idx++] = id;
	
	$(id).show();
	
	if(id != '#download_erms_popup'){	
		$('#layout_backgroud').show();	
	}	
};
	
/**
 * div를 display:none; 한다.
 */
S3Util.hideLayer = function(id) {
	//$(S3Util._preLayer).each(function(idx,item) {alert(item); $(item).hide();});
	$(S3Util._preLayer).each(function(idx,item) {$(item).hide();});	
	$('#layout_backgroud').hide();
	
	S3Util._preLayer_idx = 0;
	S3Util._preLayer.length = 0;
	//$(id).hide();
};

S3Util.toConvertJavascript = function(str) {
	//str.replace(/\'/gi, '');
};

/**
 * 문자열 empty 체크
 */
S3Util.empty = function(str,defaultStr) {
	if(str == 'undefined' || str == null || str=='')
		return defaultStr;
	else
		return str;
};


/**
 * iframe Resizing
 * @param {Object} iframeObj	iframe Object
 */
S3Util.resizeFrame = function(iframeObj) {
    var innerBody = iframeObj.contentWindow.document.body;
    var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
    var innerWidth = innerBody.scrollWidth + (innerBody.offsetWidth - innerBody.clientWidth);
	
	//default size
	//if(innerWidth<500) innerWidth = 500;
	
    iframeObj.style.height = innerHeight;
    iframeObj.style.width = innerWidth;     
}


/**
* ie6에서 png처리함수  :: javascript.js
*/
function setPng24(obj) {
    obj.width=obj.height=1;
    obj.className=obj.className.replace(/\bpng24\b/i,'');
    obj.style.filter =
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
    obj.src='';
    return '';
}