function open_window( filename, option, name )
{
	if( !name )
	{
		name = 'new'
	}


        win = window.open( filename, name, option );

        return win
}

function window_open( page, name, top, left, width, height )
{
	option = "'toolbar=no," +
		"location=no," +
		"directories=no," +
		"status=no," +
		"menubar=no," +
		"scrollbars=yes," +
		"resizable=yes," +
		"width=" + width + "," +
		"height=" + height + "," +
		"top=" + top + "," +
		"left=" + left + "'"

        window.open( page, name, option );
}

function open_poll_pop( mode, no )
{
	page = '/front/php/poll_r.php?mode=' + mode + '&no=' + no;
	window_open( page, 'poll', 100, 300, 466, 382 );
}

/*Left menu 반투명 레이어 구현*/
function Layer_overload(LayerName,Status) 
{
    if (navigator.appName == "Netscape")
    {
		LayerN = document.getElementById(LayerName).style;
		if (Status == 'show') LayerN.visibility = 'visible';
		if (Status == 'hide') LayerN.visibility = 'hidden';
    }	
    else
    {
		LayerN = document.all[LayerName].style;
		if (Status == 'show') LayerN.visibility = 'visible';
		if (Status == 'hide') LayerN.visibility = 'hidden';
    }
}

/*Left menu구현*/
var old='';

function menu(name)
{
	submenu=eval("submenu_"+name+".style");
	if(old!=submenu)
	{
		if(old!='')
		{
			old.display='none';
		}
		submenu.display='block';
		old=submenu;
	}
	else
	{
		submenu.display='none';
		old='';
	}
}


function Layer_rollover(img_name,img_url)
{
	var menu;	
	//tmp = new String( "document."+img_name );
	menu=eval("document."+img_name);		
	menu.src = img_url;
	return;
}

function image_zoom( product_no, main_cate_no, display_group )
{
	//href = '/front/php/image_zoom.php?img='+image+'&product_no='+document.frm.product_no.value;
	href = '/front/php/image_zoom.php?product_no='+product_no+'&main_cate_no='+main_cate_no+'&display_group='+display_group;
	option = 'toolbar=no,scrollbars=no,resizable=yes,width=800,height=640,left=0,top=0';
	win_name = 'image'

	window.open( href, win_name, option );
}


function scrollLayer(p_obj_name, p_gap_point) 
{ 
    var start_point, end_point, timer; 

    var obj_layer   = document.getElementById(p_obj_name);  // 레이어 오브젝트

    start_point = parseInt(obj_layer.style.top, 10); 

    if ( start_point < p_gap_point )    start_point = p_gap_point;

    end_point   = document.body.scrollTop + p_gap_point; 
    limit_point = parseInt(window.document.body.scrollHeight) - parseInt(obj_layer.offsetHeight) -10; 

    if ( end_point > limit_point )  end_point = limit_point; 

    if ( start_point != end_point ) 
    { 
        scroll_amount = Math.ceil( Math.abs( end_point - start_point ) / 15 ); 
        obj_layer.style.top = parseInt(start_point, 10) + ( ( end_point < start_point ) ? -scroll_amount : scroll_amount ); 
    } 

    timer = window.setTimeout ("scrollLayer('" + p_obj_name + "', " + p_gap_point + ");", 1); 
}







//점선없애기
function autoblur() {
        if(event.srcElement.tagName == "A") document.body.focus();
}
document.onfocusin = autoblur;

function changeBG(){
    var flag = '';
    var cookieVal = GetCookie('theamybgImg');

    if(arguments[0] == undefined) flag = cookieVal;
    else                          flag = arguments[0];

    if(flag == "1"){
        document.body.style.backgroundImage = "url(http://file.amy0301.cafe24.com/wallpaper/wallpaper1.jpg)";
    }else if(flag == '2') {
        document.body.style.backgroundImage = "url(http://file.amy0301.cafe24.com/wallpaper/wallpaper2.jpg)";
    }else if(flag == '3') {
        document.body.style.backgroundImage = "url(http://file.amy0301.cafe24.com/wallpaper/cloud.jpg)";
    }else if(flag == '4') {
        document.body.style.backgroundImage = "url(http://file.amy0301.cafe24.com/wallpaper/patten2.jpg)";
    }else if(flag == '5') {
        document.body.style.backgroundImage = "url(http://file.amy0301.cafe24.com/wallpaper/patten3.jpg)";
    }else if(flag == '6') {
        document.body.style.backgroundImage = "url(http://file.amy0301.cafe24.com/wallpaper/patten4.jpg)";
    }else if(flag == '7') {
        document.body.style.backgroundImage = "url(http://file.amy0301.cafe24.com/wallpaper/love.jpg)";
    }
//    alert (flag);
    SetCookie('theamybgImg', flag);
}

function SetCookie(cookieName,cookieVal){
  date=new Date();
  validity=10;
  date.setDate(date.getDate()+validity);
  document.cookie=cookieName+'='+escape(cookieVal)+'; expires='+date.toGMTString()+'; path=';
}


function GetCookie(cookieName){
  allCookies=document.cookie.split('; ');  // cookies are separated by semicolons
  for (i=0;i<allCookies.length;i++){
    cookieArray=allCookies[i].split('='); // a name/value pair (a crumb) is separated by an equal sign
    if (cookieName==cookieArray[0]) {
        return cookieArray[1];
    }
  }
}

//로딩과동시에 bg이미지를 확인한다
window.onload = changeBG


function action_handle(str){

}