﻿/**
 * @file   modules/board/js/board.js
 * @author zero (zero@nzeo.com)
 * @brief  board module javascript
 **/

/* write after */
function completeDocumentInserted(ret_obj) {
    var error = ret_obj['error'];
    var message = ret_obj['message'];
    var mid = ret_obj['mid'];
    var document_srl = ret_obj['document_srl'];
    var category_srl = ret_obj['category_srl'];

    //alert(message);

    var url = current_url.setQuery('mid',mid).setQuery('document_srl',document_srl).setQuery('act','');
    if(category_srl) url = url.setQuery('category',category_srl);
    location.href = url;
}

/* delete */
function completeDeleteDocument(ret_obj) {
    var error = ret_obj['error'];
    var message = ret_obj['message'];
    var mid = ret_obj['mid'];
    var page = ret_obj['page'];

    var url = current_url.setQuery('mid',mid).setQuery('act','').setQuery('document_srl','');
    if(page) url = url.setQuery('page',page);

    //alert(message);

    location.href = url;
}

/*search */
function completeSearch(fo_obj, params) {
    fo_obj.submit();
}

function completeVote(ret_obj) {
    var error = ret_obj['error'];
    var message = ret_obj['message'];
    alert(message);
    location.href = location.href;
}

// page reload
function completeReload(ret_obj) {
    var error = ret_obj['error'];
    var message = ret_obj['message'];

    location.href = location.href;
}

/* comment after */
function completeInsertComment(ret_obj) {
    var error = ret_obj['error'];
    var message = ret_obj['message'];
    var mid = ret_obj['mid'];
    var document_srl = ret_obj['document_srl'];
    var comment_srl = ret_obj['comment_srl'];

    var url = current_url.setQuery('mid',mid).setQuery('document_srl',document_srl).setQuery('act','');
    if(comment_srl) url = url.setQuery('rnd',comment_srl)+"#comment_"+comment_srl;

    //alert(message);

    location.href = url;
}

/* delete comment*/
function completeDeleteComment(ret_obj) {
    var error = ret_obj['error'];
    var message = ret_obj['message'];
    var mid = ret_obj['mid'];
    var document_srl = ret_obj['document_srl'];
    var page = ret_obj['page'];

    var url = current_url.setQuery('mid',mid).setQuery('document_srl',document_srl).setQuery('act','');
    if(page) url = url.setQuery('page',page);

    //alert(message);

    location.href = url;
}

/* delete track back */
function completeDeleteTrackback(ret_obj) {
    var error = ret_obj['error'];
    var message = ret_obj['message'];
    var mid = ret_obj['mid'];
    var document_srl = ret_obj['document_srl'];
    var page = ret_obj['page'];

    var url = current_url.setQuery('mid',mid).setQuery('document_srl',document_srl).setQuery('act','');
    if(page) url = url.setQuery('page',page);

    //alert(message);

    location.href = url;
}

/* category move */
function doChangeCategory() {
    var sel_obj = xGetElementById("board_category");
    var sel_idx = sel_obj.selectedIndex;
    var category_srl = sel_obj.options[sel_idx].value;
    location.href = current_url.setQuery('category',category_srl);
}

/* scrap */
function doScrap(document_srl) {
    var params = new Array();
    params["document_srl"] = document_srl;
    exec_xml("member","procMemberScrapDocument", params, null);
}

/* pop up */
var winname_1;
var openF = 0;
function popup(fileName, intWidth, intHeight, intLeft, intTop, vScrollbars, vResizable, vStatus){
        today = new Date();
        winName = today.getTime();

        var fileName, intWidth, intHeight;
        var screenWidth = screen.availwidth;
        var screenHeight = screen.availheight;

        if(intWidth >= screenWidth){
                intWidth = screenWidth - 40;
                vScrollbars = 1;
        }
        if(intHeight >= screenHeight){
                intHeight = screenHeight - 40;
                intWidth = intWidth + 20;
                vScrollbars = 1;
        }
        if(intLeft == 'auto' || intTop == 'auto'){
                var intLeft = (screenWidth - intWidth) / 2;
                var intTop = (screenHeight - intHeight) / 2;
        }
        var features = eval("'width=" + intWidth + ",height=" + intHeight + ",left=" + intLeft + ",top=" + intTop + ",scrollbars=" + vScrollbars + ",resizable=" + vResizable + ",status=" + vStatus + "'");
        if(openF == 1){
                if(winname_1.closed){
                        winname_1 = window.open(fileName,winName,features);
                }else{
                        winname_1.close();
                        winname_1 = window.open(fileName,winName,features);
                }
        }else{
                winname_1 = window.open(fileName,winName,features);
                openF = 1;
        }
        winname_1.focus();
}

/* faq layer hide */
function show(div) {
	var obj = getRef(div);
	if(obj !=null)
	{obj.style.display = 'block'; }
}

function hide(div) {
	var obj = getRef(div);
	if(obj !=null)
	{obj.style.display = 'none';}
}

function JsOpenCatalogue(){
	window.open('/webcatalog.asp', 'WinCatalogue', 'resizable=no,scrollbars=no,x=100,y=100,width=750,height=650');
}

/* faq togle menu*/
function toggle_menu(contents) {
if(contents.style.display == "none") {
contents.style.display = "";
} else {
contents.style.display = "none";
} 
}
function movePage(val) {
	var form = document.Frm;
	form.vSort.value = val;
	form.submit();
}

function OpenWindow(vUrl, vX, vY){

window.open(vUrl, 'Win', 'resizable=no,scrollbars=no,x=300,y=300,width=' + vX + ',height=' +vY);
}

function OpenWindowScroll(vUrl, vX, vY){

window.open(vUrl, 'Win', 'resizable=no,scrollbars=yes,x=300,y=300,width=' + vX + ',height=' +vY);
}
 function popEvent(){
		window.open("/event/cash_event_step1.asp", "cashEvent", "width=570, height=350");
 }
 
 /** flash script */
function printFlash(src, width, height)
{
	if(!src || !width || !height)
	{
		return null;
	}

	var classid  = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";
	var codebase = "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0";
	var wmode    = "transparent";
	var quality  = "high";
	var plugin   = "http://www.macromedia.com/go/getflashplayer";
	var type     = "application/x-shockwave-flash";

	var html = "<object classid='" + classid + "' "
			 + "codebase='" + codebase + "' "
			 + "width='" + width + "' height='" + height + "'> "
			 + "<param name='wmode' value='" + wmode + "'>"
			 + "<param name='movie' value='" + src + "'>"
			 + "<param name='quality' value='" + quality + "'>"
			 + "<embed src='" + src + "' "
			 + "quality='" + quality + "' pluginspage='" + plugin + "' type='" + type + "' "
			 + "width='" + width + "' height='" + height + "'></embed></object>";

	printObject(html);
}

function go_home(){
        window.location="/index.php";
}
function go_login(){
        window.location="/login.php";
}
function go_testa(){
        window.location="/bbs/zboard.php?id=testa";
}
function go_horizontal(){
        window.location="/bbs/zboard.php?id=horizontal";
}
function go_vertical(){
        window.location="/bbs/zboard.php?id=vertical";
}
function go_image(){
        window.location="/bbs/zboard.php?id=image";
}
function go_scrolling(){
        window.location="/bbs/zboard.php?id=scrolling";
}
function go_templates(){
        window.location="/bbs/zboard.php?id=templates";
}
function go_gallery(){
        window.location="/bbs/zboard.php?id=gallery";
}
function go_icon(){
        window.location="/bbs/zboard.php?id=icon";
}
function go_xml(){
        window.location="/bbs/zboard.php?id=xml";
}
function go_webtemplate(){
        window.location="/bbs/zboard.php?id=webtemplate";
}
function go_mask(){
        window.location="/bbs/zboard.php?id=mask";
}
function go_motion(){
        window.location="/bbs/zboard.php?id=motion";
}
function go_text(){
        window.location="/bbs/zboard.php?id=text";
}
function go_movieclip(){
        window.location="/bbs/zboard.php?id=movieclip";
}
function go_external(){
        window.location="/bbs/zboard.php?id=external";
}
function go_ing(){
        window.location="/bbs/zboard.php?id=ing";
}
function go_download(){
        window.location="/bbs/zboard.php?id=download";
}
function go_finished(){
        window.location="/bbs/zboard.php?id=finished";
}
function go_revising(){
        window.location="/bbs/zboard.php?id=revising";
}
function go_lostid(){
        window.location="/bbs/lostid.php";
}
function go_member_join(){
        window.location="/bbs/member_join.php";
}
function go_lostid(){
        window.location="/bbs/lostid.php";
}
function go_member_modify(){
        window.location="/bbs/member_modify.php";
}
function go_1(){
        window.location="/form/?show=1";
}
function go_2(){
        window.location="/form/?show=2";
}
function go_contact(){
        window.location="/form/?show=3";
}
function go_qna(){
        window.location="/form/?show=9";
}
function go_support(){
        window.location="/form/?show=5";
}
function go_banner_order(){
        window.location="/form/?show=6";
}
function go_quote_banner(){
        window.location="/form/?show=7";
}
function go_quote_web(){
        window.location="/form/?show=8";
}
function go_revising(){
        window.location="/bbs/zboard.php?id=revising";
}
function go_10(){
        window.location="/form/?show=10";
}
function go_11(){
        window.location="/form/?show=11";
}
function go_art(){
        window.location="/form/?show=12";
}
function go_about(){
        window.location="/about.php";
}
function go_banner_price(){
        window.location="/banner_price.php";
}
function go_banner_size(){
        window.location="/banner_size.php";
}
function go_element_design(){
        window.location="/element_design.php";
}
function go_faq(){
        window.location="/faq.php";
}
function go_folio_animated(){
        window.location="/folio_animated.php";
}
function go_folio_flash(){
        window.location="/folio_flash.php";
}
function go_folio_static(){
        window.location="/folio_static.php";
}
function go_quote(){
        window.location="/quote.php";
}
function go_term(){
        window.location="/terms.php";
}
function go_navigation_edit(){
        window.location="/form/?show=4";
}
function go_recruit(){
        window.location="/recruit.php";
}
function go_security(){
        window.location="/security.php";
}
function go_sitemap(){
        window.location="/sitemap.php";
}
function go_web(){
        window.location="/web.php";
}
function go_premium(){
        window.location="/premium.php";
}
function go_banner_size(){
        window.location="/banner_size.php";
}
function go_instant_quote(){
        window.location="/pop_calculator.html";
}
function go_order_premium(){
        window.location="/order_premium.php";
}
