function parentExists()
{
 return (parent.location == window.location)? false : true;
}

function go_pop(document_srl)
{
	var url = "/"+document_srl;
	//if(opener)

	if(parentExists())
		document.location.href = url;
	else 
	{
		var width = 1200;
		var height = 700;
		var left = parseInt((screen.availWidth/2) - (width/2));
		var top = parseInt((screen.availHeight/2) - (height/2));
		var windowFeatures = "menubar=0,scrollbars=yes,width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
		

		//window.open (url,"mywindow","menubar=1,resizable=1,width=1200,height=700,scrollbars=yes");
		window.open (url,"mywindow",windowFeatures);
	}
}
function wopen(url, name, w, h)
{
  // Fudge factors for window decoration space.
  // In my tests these work well on all platforms & browsers.
  w += 32;
  h += 96;
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;
  // IE5 and other old browsers might allow a window that is
  // partially offscreen or wider than the screen. Fix that.
  // (Newer browsers fix this for us, but let's be thorough.)
  if (wleft < 0) {
    w = screen.width;
    wleft = 0;
  }
  if (wtop < 0) {
    h = screen.height;
    wtop = 0;
  }
  var win = window.open(url,
    name,
    'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ', ' +
    'location=no, menubar=no, ' +
    'status=no, toolbar=no, scrollbars=no, resizable=no');
  // Just in case width and height are ignored
  win.resizeTo(w, h);
  // Just in case left and top are ignored
  win.moveTo(wleft, wtop);
  win.focus();
}


function afterSession(ret_obj)
{
    var error = ret_obj['error'];
    var message = ret_obj['message'];
    var session_srl = ret_obj['session_srl'];
	//alert(session_srl);
    if(session_srl == "")
    {
	    alert('error가 발생하였습니다.');
		return;
    }

	if(product_type ==1)
	{
		var url = "/photomon/8x8.php?member_srl="+member_srl+"&session_srl="+session_srl+"&book_type="+book_type;
	}
	else if(product_type ==2)
	{
		var url = "/photomon/a5.php?member_srl="+member_srl+"&session_srl="+session_srl+"&book_type="+book_type;;
	}


	//window.open (url,"mywindow","menubar=0,resizable=0,width=1000,height=1000,scrollbars=no");
	wopen(url,"mywindow",381,142);


	
}

function publish2(product_type_temp,book_type_temp)
{
	if(!member_srl)
	{
		alert('먼저 로그인 하세요');
		return;
	}

	if(!jQuery.browser.msie)
	{
		alert('Internet Explorer 에서만 동작합니다.');
		return;
	}

	product_type = product_type_temp;
	book_type = book_type_temp;

	var params = new Array();
	params['module_srl'] = book_module_srl;
	params['member_srl'] = member_srl;

	var response_tags = new Array('error','message','session_srl');
	exec_xml('doard', 'procDoardMakeSession', params, afterSession, response_tags);





}



function publish(product_type_temp)
{
	if(!member_srl)
	{
		alert('먼저 로그인 하세요');
		return;
	}

	if(!jQuery.browser.msie)
	{
		alert('Internet Explorer 에서만 동작합니다.');
		return;
	}

	product_type = product_type_temp;

	var params = new Array();
	params['module_srl'] = book_module_srl;
	params['member_srl'] = member_srl;

	var response_tags = new Array('error','message','session_srl');
	exec_xml('doard', 'procDoardMakeSession', params, afterSession, response_tags);





}


function manual(document_srl)
{
	alert('준비중입니다');

}


