var hWin;

function CreateWindow(img_id){
	openUrl = "/rakugaki/pre_rakugaki_trial.php?IMID=" + img_id;
	openWindow(openUrl, 600, 550);
}

function MailWindow(img_id){
	openUrl = "/trial/myphotomail.php?IMID=" + img_id;
	openWindow(openUrl, 510, 578, "MAIL");
}

function DmailWindow(img_id){
	if(!img_id)	img_id = "";
	openUrl = "/trial/form_seltmpl.php?IMID=" + img_id;
	openWindow(openUrl, 700, 570, "DMAIL");
}

function ContribWindow(img_id){
	openUrl = "/trial/myphoto_contrib.php?IMID=" + img_id;
	openWindow(openUrl, 510, 676, "CONTRIB");
}

function PrinoteWindow(){
	alert("お試し版では利用できません。")
}

function NewbieWindow(){
	openUrl = "/help/newbie/";
	extParam = "scrollbars=yes,resizable=yes";
	openWindow(openUrl, 620, 560, "NEWBIE", extParam);
}

function AddressWindow(){
	alert("お試し版では利用できません。");
}

// --- For Debug

function CreateDebugWindow(photo_no_m){
	openUrl = "/rakugaki/rakugaki2.php?IMID=" + photo_no_m;
	extParam = "scrollbars=yes";
	openWindow(openUrl, 800, 600, "", extParam);
}


// ================ Common Routine ================

function openWindow(openUrl, nClientWidth, nClientHeight, WinName, extParam){
	if(extParam) extParam = ","+extParam;
	if(!WinName) WinName = "";
	pos_x = (screen.width - nClientWidth) / 2;
	pos_y = (screen.height - nClientHeight) / 2;
	if(pos_y < 100) pos_y /=2;
	hWin = window.open(openUrl,WinName,
					 'width=' + nClientWidth +
					 ',height=' + nClientHeight +
					 ',top='+ pos_y +
					 ',left='+ pos_x +
					 extParam
					 );
	hWin.focus();
}

