/**
 * @file name     : /_include/js/detail.js
 * @author        : Watcharin P.
 * @last modified : 2009-11-23 18:48
 */

// Notify delete

var notifywin = '';
function openNotifyWindow(board_id) {
	var sUrl = BASE_URL + 'form.php?mode=notify_delete&id=' + board_id;
	
	if (!notifywin.closed && notifywin.location) {
        notifywin.location.href = sUrl;
    } else {   
        notifywin = window.open(sUrl, 'notifydelete', 'status=yes,scrollbars=yes,resizable=yes,width=660,height=265');
    }
	
    if (window.focus) notifywin.focus();
}

// Send to friends

var sendtofriendswin = '';
function openSendToFriendsWindow(board_id) {
	var sUrl = BASE_URL + 'form.php?mode=sendtofriends&id=' + board_id;
	
	if (!sendtofriendswin.closed && sendtofriendswin.location) {
        sendtofriendswin.location.href = sUrl;
    } else {
        sendtofriendswin = window.open(sUrl, 'sendtofriends', 'status=yes,scrollbars=yes,resizable=yes,width=660,height=400');
    }
	
    if (window.focus) sendtofriendswin.focus();
}

// Print

var printwin = '';
function openPrintWindow(board_id) {
	var sUrl = BASE_URL + 'print.php?id=' + board_id;
	
	if (!printwin.closed && printwin.location) {
        printwin.location.href = sUrl;
    } else {
        printwin = window.open(sUrl, 'print');
    }
	
    if (window.focus) printwin.focus();
}

// Board edit

var boardeditwin = '';
function openBoardEditWindow(board_id) {
	var sUrl = BASE_URL + 'post/edit.php?id=' + board_id;
	
	if (!boardeditwin.closed && boardeditwin.location) {   
		boardeditwin.location.href = sUrl;
	} else {   
		boardeditwin = window.open(sUrl, 'boardedit', 'width=' + screen.Width + 'px,height=' + screen.Height + 'px,menubar=0,location=0,status=1,scrollbars=1,resizable=1,scrolling=1');
	}
	
	if (window.focus) {
		boardeditwin.focus();
	}
}

// Update expire

var updateexpirewin = '';
function openUpdateExpireWindow(board_id) {
	var sUrl = BASE_URL + 'form.php?mode=update_expire&id=' + board_id;
	
	if (!updateexpirewin.closed && updateexpirewin.location) {   
        updateexpirewin.location.href = sUrl;
    } else {   
        updateexpirewin = window.open(sUrl, 'updateexpire', 'status=yes,scrollbars=yes,resizable=yes,width=610,height=170');
    }
	
    if (window.focus) updateexpirewin.focus();
}

// Update position

var updatepositionwin = '';
function openUpdatePositionWindow(board_id) {
	var sUrl = BASE_URL + 'form.php?mode=update_position&id=' + board_id;
	
	if (!updatepositionwin.closed && updatepositionwin.location) {   
        updatepositionwin.location.href = sUrl;
    } else {   
        updatepositionwin = window.open(sUrl, 'updateposition', 'status=yes,scrollbars=yes,resizable=yes,width=610,height=125');
    }
	
    if (window.focus) updatepositionwin.focus();
}

// Board delete

var boarddeletewin = '';
function openBoardDeleteWindow(board_id) {
	var sUrl = BASE_URL + 'form.php?mode=board_delete&id=' + board_id;
	
	if (!boarddeletewin.closed && boarddeletewin.location) {   
        boarddeletewin.location.href = sUrl;
    } else {   
        boarddeletewin = window.open(sUrl, 'boarddelete', 'status=yes,scrollbars=yes,resizable=yes,width=610,height=103');    
    }
	
    if (window.focus) boarddeletewin.focus();
}

// Board picture

var boardpicturewin = '';
function openBoardPictureWindow(board_id, items) {
	var sUrl = BASE_URL + 'viewimage.php?id=' + board_id + '&item=' + items;
		
	if (!boardpicturewin.closed && boardpicturewin.location) {   
        boardpicturewin.location.href = sUrl;
    } else {   
        boardpicturewin = window.open(sUrl, 'boardpicture', 'menubar=no,toolbar=no,location=no,scrollbars=no,status=no,resizable=yes,width=' + (screen.availWidth*0.3) + ',height=' + (screen.availHeight*0.3));    
    }
	
    if (window.focus) boardpicturewin.focus();
}
