/* quick Floating Bannser */
$(document).ready(function(){
	var currentPosition = parseInt($("#quickArea").css("top"));
	$(window).scroll(function() {
		var position = $(window).scrollTop(); // 현재 스크롤바의 위치값을 반환합니다.
		if(position > currentPosition){
			var setPosition = 100;
		}else{
			var setPosition = currentPosition-position;
		}
			$("#quickArea").stop().animate({"top":position+setPosition+"px"},1000);
	});
});

function openRule1(){
	winOpen('/popup/popup_rule1.jsp','popRule1','height=540, width=650, scrollbars=no');
}
function openRule2(){
	winOpen('/popup/popup_rule2.jsp','popRule2','height=540, width=650, scrollbars=no');
}
function openRule3(){
	winOpen('/popup/popup_rule3.jsp','popRule3','height=380, width=500, scrollbars=no');
}
function openEmail(){
	winOpen('https://www.daewonpharm.com/popup/popup_email.jsp','popEmail','width=500, height=440, top=0 left=0');	
}
function openEmailTo(email){
	winOpen('https://www.daewonpharm.com/popup/popup_email.jsp?tomail='+email,'popEmail','width=500, height=440, top=0 left=0');	
}
function winOpen(url, nm, pt){
	window.open(url, nm, pt);
}


function getCookie(name) {
        var nameOfCookie = name + "=";
        var x = 0
        while ( x <= document.cookie.length ) {
                var y = (x+nameOfCookie.length);
                if ( document.cookie.substring( x, y ) == nameOfCookie ) {
                        if ( (endOfCookie=document.cookie.indexOf( ";",y )) == -1 )
                                endOfCookie = document.cookie.length;
                        return unescape( document.cookie.substring(y, endOfCookie ) );
                }
                x = document.cookie.indexOf( " ", x ) + 1;
                if ( x == 0 )
                        break;
        }
        return "";
}

function setCookie( name, value, expiredays ) {
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function popCookieWin( url , cName, scrl) {
	if (getCookie( cName ) != "done") {
		noticeWindow =  MM_openBrWindow(url, cName , 'height=200,width=200,scrollbars='+scrl );
	}
}
