﻿/* 
 * 
 */
$(function() {

    /* A function to execute after the DOM is ready. */

});

/* 사이트 공통적인 함수는 여기에 작성하세요. */

// 2011-04-21 로그인 여부 확인
 

 
// 2011-04-26 테/실/로컬 사이트 주소 판별
function GetServerHostName() {

    var result = false;
    
    $.ajax({
        async: false,
        type: "POST",
        url: "/Common/WebMethods.aspx/GetServerHostName",
        data: {},
        contentType: "application/json; charset=utf-8",
        dataType: "text",
        success: function(data) {
            var p_data = jQuery.parseJSON(data);
            result = p_data.d.toLowerCase();

        },
        error: function(request, error) {
            result = false;
            //alert(request.statusText);
            //alert(request.responseText);
        }
    }); // ajax
    
    return result;
}

// 2011-04-26 테/실/로컬 사이트 SSL 판별
function GetServerHTTPSName() {

    var result = false;
    
    $.ajax({
        async: false,
        type: "POST",
        url: "/Common/WebMethods.aspx/GetServerHTTPSName",
        data: {},
        contentType: "application/json; charset=utf-8",
        dataType: "text",
        success: function(data) {
            var p_data = jQuery.parseJSON(data);
            result = p_data.d.toLowerCase();

        },
        error: function(request, error) {
            result = false;
            //alert(request.statusText);
            //alert(request.responseT);
        }
    }); // ajax
    
    return result;
}

function SWFLoader() {
	this.id = "";
	this.title = undefined;
	this.wmode = "window";
	this.flashvars = "";
	this.classId = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
	this.codeBase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0';
	this.pluginSpage = 'http://www.macromedia.com/go/getflashplayer';
	this.embedType = 'application/x-shockwave-flash';
}
SWFLoader.prototype.setting = function(obj){
	for(var property in obj){
		this[property] = obj[property];
	}
	if(this.alternate && document.getElementById(this.alternate)){
		var node = document.getElementById(this.alternate);
		node.style.display = "none";
		var tmp = node.cloneNode(true);
		tmp = node.innerHTML;
		this.alternate = tmp;
	}
	this.parameter = "";
	this.parameter += "<param name='allowScriptAccess' value='always' />";
	this.parameter += "<param name='allowFullScreen' value='false' />";
	this.parameter += "<param name='movie' value='"+this.url+this.flashvars+"' />";
	this.parameter += "<param name='wmode' value='"+ this.wmode +"' />";
	this.parameter += "<param name='quality' value='best'/>";
	this.parameter += "<param name='base' value='.'>";
	this.parameter += "<param name='scale' value='noscale'/>";
	this.parameter += "<param name='expressinstall' value='Scripts/expressInstall.swf' />";
}
SWFLoader.prototype.addParameter = function(name, value){
	this.parameter += "<param name='"+name+"' value='"+value+"'/>";
}
SWFLoader.prototype.show = function(){
	var str = "";
	var title = (this.title) ? ' title="'+this.title+'"' : "";
	str += '<object id="'+this.id+'" width="'+this.width+'%" height="'+this.height+'" classid="'+this.classId+'" codebase="'+this.codeBase+'"'+ title+'>';
		str += this.parameter;
		str += '<!--[if !IE]>-->';
		str += '<object type="application/x-shockwave-flash" data="'+this.url+this.flashvars+'" width="'+this.width+'%" height="'+this.height+'" name="'+this.id+'"'+ title +'>';
		str += this.parameter;
		str += '<!--<![endif]-->';
			str += this.alternate // 대체택스트
		str += '<!--[if !IE]>-->';
		str += '</object>';
		str += '<!--<![endif]-->';
	str += '</object>';
	document.write(str);
}

 

 

//윈도우 오픈
function Wopen(theURL,winName,width,height,top,left) {
  var opt = "width="+width+"px,height="+height+"px,top="+top+"px,left="+left+"px,scrollbars=yes,resizable=no,fullscreen=no,menubar=no,status=no,toolbar=no,titlebar=no"
  window.open(theURL,winName,opt);
}

//이미지 리플레이스
function replaceImg(vid, img1, img2) {
    document.getElementById(vid).src = document.getElementById(vid).src.replace(img1,img2);
}



//프린트
function print_info(layerid) {

    if (layerid == null) {
        document.getElementById("hidPrint").value = document.getElementById("contents").innerHTML;
    }
    else {
        document.getElementById("hidPrint").value = document.getElementById(layerid).innerHTML;
    }

    window.open("/common/cmn_print.aspx", "print_open", "width=800,height=700,top=0,left=0,noresizable,toolbar=no,status=no,scrollbars=yes,directory=no");
}
