﻿//LIVE SOURCE SERVER
var pLsAddr     = "202.172.171.153";
var pLsFPort    = "1755";

var webRoot         = "";
var webRoot2        = "www";
var domain          = document.location.host;

var imgSurl = "img.seebox.sg/sgp";
var hostDomain = "sg";

if(webRoot == "dev") {
	var activeXServerURL	= "http://www.seemedia.co.kr/products/seebox/lu3_dev/xml/sgp/";
	var pLsAddr_Remote  = "";
} else {
	var activeXServerURL	= "http://img.seebox." + hostDomain + "/kor/products/lu3/xml/sgp/";
	var pLsAddr_Remote  = "";
}
var activeXInstallURL	= "Handle=\"%u\", CfgXML=\""+activeXServerURL+"SeeBox_Main.xml\", SharedXML=\""+activeXServerURL+"SharedLib_Main.xml\"";


//WEBSERVICE
var ProxyURL        = "/include/soapClientProxy.sb";
var WebServiceRoot  = "http://"+webRoot+"webservice.seebox.com";

var codeWSDLPATH        = WebServiceRoot + "/SEEBOXWWW/SB_Code.asmx";
var programWSDLPATH     = WebServiceRoot + "/SEEBOXWWW/SB_Program.asmx";
var channelWSDLPATH     = WebServiceRoot + "/SEEBOXWWW/SB_Channel.asmx";
var studioWSDLPath      = WebServiceRoot + "/SEEBOXWWW/sb_studio.asmx";
var memberWSDLPath      = WebServiceRoot + "/SEEBOXWWW/sb_member.asmx";
var bookmarkManWSDLPath = WebServiceRoot + "/SEEBOXWWW/sb_bookmarkman.asmx";
var bookmarkProgramWSDLPath = WebServiceRoot + "/SEEBOXWWW/sb_bookmarkprogram.asmx";
var folderWSDLPATH      = WebServiceRoot + "/SEEBOXWWW/sb_studiofolder.asmx";
var replyWSDLPATH       = WebServiceRoot + "/SEEBOXWWW/sb_reply.asmx";
var recommandWSDLPATH   = WebServiceRoot + "/SEEBOXWWW/sb_recommend.asmx";
var feelWSDLPath        = WebServiceRoot + "/SEEBOXWWW/sb_feeltag.asmx";
var tagWSDLPath         = WebServiceRoot + "/SEEBOXWWW/sb_tag.asmx";
var boardWSDLPATH       = WebServiceRoot + "/SEEBOXWWW/sb_board.asmx";

//var liveSWSDLPATH       = WebServiceRoot + "/SEEBOXWWW/live/SB_LiveServerInfo.asmx"
var liveMemberWSDLPATH  = WebServiceRoot + "/SEEBOXWWW/sb_livejoinmember.asmx"
var liveWSDLPATH        = WebServiceRoot + "/SEEBOXWWW/sb_live.asmx"
var liveWSIDLPATH       = WebServiceRoot + "/SEEBOXWWW/live/SB_Live2.asmx";

//by kss
var slipWSDLPATH        = WebServiceRoot + "/SEEBOXWWW/sb_slip.asmx";
var myboxprWSDLPATH 	= WebServiceRoot + "/SEEBOXWWW/sb_myboxpr.asmx";
var doumiWSDLPATH   	= WebServiceRoot + "/SEEBOXWWW/sb_doumi.asmx";
var transWSDLPATH   	= WebServiceRoot + "/SEEBOXWWW/sb_trans.asmx";

var visitHistoryWSDLPATH = WebServiceRoot + "/SEEBOXWWW/sb_visithistory.asmx"
var guestBookWSDLPATH   = WebServiceRoot + "/SEEBOXWWW/sb_guestbook.asmx"
var seestudioWSDLPATH   = WebServiceRoot + "/SEEBOXWWW/sb_reservation.asmx";
var castboardWSDLPATH   = WebServiceRoot + "/SEEBOXWWW/sb_castboard.asmx";
var castboardCategoryWSDLPATH = WebServiceRoot + "/SEEBOXWWW/sb_castboardcategory.asmx";
var displayWSDLPATH     = WebServiceRoot + "/SEEBOXWWW/sb_programdisplay.asmx";
var reportPWSDLPATH     = WebServiceRoot + "/SEEBOXWWW/sb_badreportprogram.asmx";
var reportRWSDLPATH     = WebServiceRoot + "/SEEBOXWWW/sb_badreportreply.asmx";
var reportSWSDLPATH     = WebServiceRoot + "/SEEBOXWWW/sb_badreportslip.asmx";
var reportLWSDLPATH     = WebServiceRoot + "/SEEBOXWWW/sb_badreportlive.asmx";	//불량방송신고
var reportCWSDLPATH     = WebServiceRoot + "/SEEBOXWWW/sb_badreportchat.asmx";	//불량대화자신고
var eventJWSDLPATH      = WebServiceRoot + "/SEEBOXWWW/sb_eventjoin.asmx";
var coopWSDLPATH        = WebServiceRoot + "/SEEBOXWWW/sb_coopmember.asmx";
var mailWSDLPATH        = WebServiceRoot + "/SEEBOXWWW/sb_mailrecommend.asmx";

var eventWSDLPATH       = WebServiceRoot + "/SEEBOXWWW/sb_event.asmx";
var testWSDLPATH        = WebServiceRoot + "/AjaxLibrary/Service.asmx";


var programReplyInfoIndex = 1;
function goStudio(StudioID, newWindow, folderIDX){
    var url = "http://" + webRoot + "my.seebox." + hostDomain + "/" + StudioID;
    //if(folderIDX) url = url + "/program.sb?folderIndex=" + folderIDX;
    if(newWindow==1) {
        var oWin = window.open(url, 'studio');
        oWin.focus();
    } else {
        document.location.href = url;
    }
}
function Play_Flash(widht,height,filename){
	var flash_tag="";
	flash_tag += "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+widht+"' height='"+height+"'>";
	flash_tag += "<param name='movie' value='http://"+webRoot+"www.seebox." + hostDomain + "/swf/play_button.swf?Img="+ filename +"'>";
	flash_tag += "<param name='quality' value='high'>";
	flash_tag += "<EMBED src='http://"+webRoot+"www.seebox." + hostDomain + "/swf/play_button.swf?Img=" + filename + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+widht+"' height='"+height+"'></EMBED>";
	flash_tag += "</OBJECT>";

	var flayer=document.getElementById("Flash_layer");
	flayer.innerHTML=flash_tag;
}
function goHome(){
    document.location.href = "http://"+webRoot2+".seebox." + hostDomain + "/";
}
function goFAQ(fcode,subcode,findex,nw){
	if(!fcode) return;
	if(!subcode) subcode = "";
	if(!findex) findex = "";
	var url = "http://"+webRoot2+".seebox." + hostDomain + "/help/" + ((findex)? "help_faqdetail.sb" : "help_faq.sb") + "?faqCode="+fcode+"&faqSubCode="+subcode+"&faqIndex="+findex;
	if (nw=='new'){
	    window.open(url,"_blank");
	}else{
	    document.location.href = url;
	}
}

//쪽지보내기
function openSlipSend(studioID, nickname){
	if(!getCookie("userEmail")) {
	    alert(viewMsg(4060));
		return false;
	}
	var NICKnID = escape(nickname);
	window.open("http://"+webRoot+"my.seebox." + hostDomain + "/slipsend_pop.sb?toMember="+studioID+"&toNickandID="+NICKnID,"openSlipSend","width=535,height=480");
	if($('quickMemberMenuLayer')) $('quickMemberMenuLayer').style.display='none';
}

//즐겨찾기
function addFavorite(studioID) {
	var myEmail = getCookie("userEmail");
	if(!myEmail) {
		alert(viewMsg(4060));
		return false;
	}
	if(getCookie("studioID")==studioID){
			alert(viewMsg(1034));
	}else{
		var params = { userEmail:myEmail, studioID: studioID};
		var myAjax = new Ajax.Request(ProxyURL,{method:'post',protocol: 'soap',WSDLPath:bookmarkManWSDLPath,procedureName:"insert",onComplete:addFavoriteComplete,argument:params});
	}
	if($('quickMemberMenuLayer')) $('quickMemberMenuLayer').style.display='none';
}
function addFavoriteComplete(objHttp) {
	var isSuccess = $XV(objHttp.responseText, "insert");
	if(isSuccess == "0") {
		alert(viewMsg(1035));
	} else {
		alert(viewMsg(1036));
	}
}

//주소복사
function popCopyURL(cpUrl) {
    if(!cpUrl) cpUrl = document.location.href;
    var url = "http://"+webRoot2+".seebox."+ hostDomain +"/pop_copy.sb?cpurl=" + encodeURIComponent(cpUrl);
    window.open(url, 'copy_pop', 'width=343, height=238');
}

//문장번역기
function popTrans() {
	if(getCookie("studioID")){
        var url = "http://"+webRoot2+".seebox."+hostDomain +"/pop_trans.sb";
        window.open(url, 'trans_pop', 'width=534, height=340');
	}else{
	    alert(viewMsg(4060));
        document.location.href="http://"+ webRoot2 + ".seebox."+ hostDomain +"/login.sb?url=" + escape(document.location.href)		
	}
}

//(s) GNB
function goFindEmail(tar){
    var url = "http://"+webRoot2+".seebox."+ hostDomain +"/help/help_findemail.sb";
    if(tar=="opener") {
        if(opener) opener.location.href = url;
        else window.open(url,'','');
    } else if(tar=="blank") {
        var win = window.open(url,'SEEBOX','');
        win.focus();
    } else {
        document.location.href = url;
    }
}
function goFindPassword(tar){
    var url = "http://"+webRoot2+".seebox."+ hostDomain +"/help/help_findpassword.sb";
    if(tar=="opener") {
        if(opener) opener.location.href = url;
        else window.open(url,'','');
    } else if(tar=="blank") {
        var win = window.open(url,'SEEBOX','');
        win.focus();
    } else {
        document.location.href = url;
    }
}
function goJoinMember(tar){
    var url = "http://"+webRoot2+".seebox."+ hostDomain +"/join_member.sb";
    if(tar=="opener") {
        if(opener) opener.location.href = url;
        else window.open(url,'','');
    } else if(tar=="blank") {
        var win = window.open(url,'SEEBOX','');
        win.focus();
    } else {
        document.location.href = url;
    }
}
function goJoinMemberForeigner(tar){
    var url = "http://"+webRoot2+".seebox."+ hostDomain +"/join_register_foreigner.sb";
    if(tar=="opener") {
        if(opener) opener.location.href = url;
        else window.open(url,'','');
    } else if(tar=="blank") {
        var win = window.open(url,'SEEBOX','');
        win.focus();
    } else {
        document.location.href = url;
    }
}
function login(){
    if(document.location.href.indexOf("url=http") == -1){
        document.location.href="http://"+ webRoot2 + ".seebox."+ hostDomain +"/login.sb?url=" + escape(document.location.href)
    }else{
        document.location.href = document.location.href;
    }
}
function loginPop(){
    if(document.location.href.indexOf("url=http") == -1){
    	var url = "http://" + webRoot2 + ".seebox." + hostDomain + "/login_pop.sb?url=" + escape(document.location.href) + "&odo=" + escape(document.domain);
    }else{
        var url = document.location.href;
    }
    window.open(url, "loginPopWin", "width=536, height=333");
}
function goSlip(){
    document.location.href="http://"+ webRoot + "my.seebox."+ hostDomain +"/" + getCookie("studioID") + "/sliplistresv.sb";
}
function goMyBox_(){
	if(getCookie("studioID")){
		document.location.href="http://"+ webRoot + "my.seebox."+ hostDomain +"/" + getCookie("studioID");
	}else{
		document.location.href="http://"+ webRoot2 + ".seebox."+ hostDomain +"/login.sb?url=" + escape('http://'+webRoot+'my.seebox.sg');
	}
}
function goMyGuestBook(){
    document.location.href="http://"+ webRoot + "my.seebox."+ hostDomain +"/" + getCookie("studioID") + "/guestbook.sb?p=1";
}
function goVodReg(){
	//document.location.href="http://"+ webRoot2 + ".seebox."+ hostDomain +"/vodreg.sb"
	SBLAUNCHER.Check(null, "document.location.href='http://"+ webRoot2 + ".seebox."+ hostDomain +"/vodreg.sb'");
}
function goLive(){
    document.location.href="http://"+ webRoot + "live.seebox."+ hostDomain +"/"
}
function goSpotList(){
    document.location.href="http://"+ webRoot2 + ".seebox."+ hostDomain +"/spot_list.sb"
}
function goBestList(){
    document.location.href="http://"+ webRoot2 + ".seebox."+ hostDomain +"/best_list.sb"
}
function goNewList(){
    document.location.href="http://"+ webRoot2 + ".seebox."+ hostDomain +"/list.sb?l=new"
}
function goMyBoxPro(){
    document.location.href="http://"+ webRoot2 + ".seebox."+ hostDomain +"/talkbox/myboxpr.sb";
}
function goTalk(){
    document.location.href="http://"+ webRoot2 + ".seebox."+ hostDomain +"/talkbox/talkbox_list.sb";
}
function goLiveStudio(sid){
    if(sid) {
        document.location.href="http://"+ webRoot + "live.seebox."+ hostDomain +"/studio.sb?bj="+sid;
    } else {
        document.location.href="http://"+ webRoot + "live.seebox."+ hostDomain +"/studio.sb"
    }
}
function goReBroad(){
    document.location.href="http://"+ webRoot + "live.seebox."+ hostDomain +"/rebroadcast.sb"
}
function goSpTv(){
    document.location.href="http://"+ webRoot2 + ".seebox."+ hostDomain +"/sptv.sb";
}
function goEvent(){
	document.location.href="http://"+ webRoot2 + ".seebox."+ hostDomain +"/event/";
}
function goOpenStudio(wh, target){
	if(!wh) wh = "SEE";
	var url = "http://" + webRoot2 + ".seebox."+ hostDomain +"/openstudio/openstudio_" + wh.toLowerCase() + ".sb";
	if(target=="_blank") {
        var oWin = window.open(url, '');
        oWin.focus();
    } else {
		document.location.href = url;
	}
}
function checkLogin() {
	var userEmail = getCookie("userEmail");

	if(userEmail != null) {
		logOut();
		//goHome();
	} else {
		var vloginURL = escape(document.location.href);
		try {
			vloginURL = $F('url')? $F('url') : vloginURL;
		} catch(e) {}
		document.location.href =  homeUrl + "/login.sb?url=" + vloginURL;
	}
}
//(e) GNB



//FOOTER ASSOCIATION START
function company() {
    document.location.href = "http://"+webRoot2+".seebox."+ hostDomain +"/footer/company.sb";
}
function service_agreement() {
    document.location.href = "http://"+webRoot2+".seebox."+ hostDomain +"/footer/service_agreement.sb";
}
function service_secure() {
    document.location.href = "http://"+webRoot2+".seebox."+ hostDomain +"/footer/service_secure.sb";
}
function service_youth() {
    document.location.href = "http://"+webRoot2+".seebox."+ hostDomain +"/footer/service_youth.sb";
}
function service_response() {
    document.location.href = "http://"+webRoot2+".seebox."+ hostDomain +"/footer/service_response.sb";
}
function goCustomerCenter() {
    document.location.href = "http://"+webRoot2+".seebox."+ hostDomain +"/help/help_faq.sb?faqCode=146";
}
//FOOTER ASSOCIATION END
