// ¿ÀºêÁ§Æ®,¿µ»ó °ü·Ã ½ºÅ©¸³Æ®
// Ãß°¡ÀÏ : 2006-11-20
// Ãß°¡ÀÚ : ÃÖÁö¿¬
function mf(s,d,w,h,t){
	return "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width="+w+" height="+h+" id="+d+"><param name=wmode value="+t+"><param name=movie value="+s+"><param name=quality value=high><embed src="+s+" quality=high wmode="+t+" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" width="+w+" height="+h+"></embed></object>";
}
function documentwrite(src){
	document.write(src);
}

function viewMovie(obj,w,h)
{ 
 
	  var obj_url = obj.getAttribute("url");

	  var div_id = 'mplay';
	  var media_url = w+'*'+h+'*'+obj_url;
	  var serialized_data = 'media_url='+media_url;

	  //À§Ä¡¿¡ ¸Â°Ô ¼öÁ¤
	  var link = '/ajax/getHscdnMediaURL.html' ; 

	 new Ajax.Request(
	link,
	{
			method    : "GET",
			parameters: serialized_data,
			onComplete: showResponse
	});

	function showResponse(htmlHttp)
	{

		if(htmlHttp.responseXML)
		{
	
			var xmlDoc	= htmlHttp.responseXML;
			var lists	= xmlDoc.getElementsByTagName("response")[0];

			if(lists)
			{

				var rtn_html = lists.getElementsByTagName("rtn_html")[0].firstChild.nodeValue;

				var outhtml = "";
				outhtml +=  rtn_html;
	
				$(div_id).update(outhtml);
			}
		}
	}
	 
 
}


	

//È¯°æ¿¡ ¸Â°Ô º¯¼ö¸¦ ¼öÁ¤ÇÏ¼Å¾ß ÇÕ´Ï´Ù.
function writePlayer_tmp (mmsURL,w,h) {
	try {
		//CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6´Â ¹Ìµð¾î ÇÃ·¹ÀÌ¾î 7.0 ÀÌ»óÀ» Áö¿øÇÑ´Ù.(url »ç¿ë)
		//CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95´Â ¹Ìµð¾î ÇÃ·¹ÀÌ¾î 6.4À» Áö¿øÇÑ´Ù. (filename »ç¿ë)
		document.write('<OBJECT ID="MediaPlayer" height='+h+' width='+w+' CLASSID=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95>');
		document.write('<param name="AUTOSTART" value="true">');
		document.write('<PARAM NAME="ShowCaptioning" VALUE="false">');
		document.write('<PARAM NAME="ShowControls" VALUE="true">');
		document.write('<PARAM NAME="ShowAudioControls" VALUE="true">');
		document.write('<PARAM NAME="ShowDisplay" VALUE="false">');
		document.write('<PARAM NAME="ShowPositionControls" VALUE="false">');
		document.write('<PARAM NAME="ShowStatusBar" VALUE="false">');
		document.write('<PARAM NAME="ShowTracker" VALUE="true">');
	    document.write('<param name="filename" value="' + mmsURL+ '">');
	 	document.write('<param name="PlayCount" value="1">');			
		document.write('</OBJECT>');
	} catch(E){}
}

// Ä¿¹Â´ÏÆ¼(ÂÊÁö) °ü·Ã ½ºÅ©¸³Æ®
// Ãß°¡ÀÏ : 2006-11-20
// Ãß°¡ÀÚ : ÀÓ±Ô¿ÏÆÀÀå
function revcheck(theform) {
	for( var i=0; i<document.rfrm.elements.length; i++) {
		var ele = document.rfrm.elements[i];
		if(ele.name == 'rf[]')
			ele.checked = document.rfrm.total.checked;
	}
	return;
}
function del(){
	var sCount = 0;

	for (var i=0; i<rfrm.length;i++) {
		if (rfrm[i].type == "checkbox" && rfrm[i].name != "total"  && rfrm[i].checked == true) {
			sCount++;
		}
	}
	if (sCount == 0){
		if (1 == 0) {
			alert(" »èÁ¦ÇÒ ÂÊÁö°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.");
			return;
		}
		else {
			alert(" »èÁ¦ÇÒ ÂÊÁö¸¦ ¸ÕÀú ¼±ÅÃÇÏ¼¼¿ä.");
			return;
		}
     }
	else {
			if (!confirm("¼±ÅÃÇÏ½Å ÂÊÁö¸¦ »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?"))
			 return;
	}
	rfrm.p.value = 'delete';
	rfrm.submit();
}
function save(){
	var sCount = 0;

	for (var i=0; i<rfrm.length;i++) {
		if (rfrm[i].type == "checkbox" && rfrm[i].name != "total"  && rfrm[i].checked == true) {
			sCount++;
		}
	}
	if (sCount == 0){
		if (1 == 0) {
			alert(" º¸°üÇÒ ÂÊÁö°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.");
			return;
		}
		else {
			alert(" º¸°üÇÒÇÒ ÂÊÁö¸¦ ¸ÕÀú ¼±ÅÃÇÏ¼¼¿ä.");
			return;
		}
     }
	else {
			if (!confirm("¼±ÅÃÇÏ½Å ÂÊÁö¸¦ º¸°üÇÏ½Ã°Ú½À´Ï±î?"))
			 return;
	}
	rfrm.p.value = 'save';
	rfrm.submit();
}

function search(){
	var frm = document.srch;
	var b = frm.bage.options[frm.bage.selectedIndex].value;
	var e = frm.eage.options[frm.eage.selectedIndex].value;
	if(!frm.srch_word.value){
		alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.');
		frm.srch_word.focus();
		return false;
	}
	if(frm.age_ok.checked == true){
		if( b && e){
			var c = e - b ;
			if( c >= 6 || c < 0 ){
				alert('³ªÀÌÂ÷ÀÌ¸¦ 5¼¼ ÀÌÇÏ·Î ¼³Á¤ÇØ ÁÖ½Ê½Ã¿À.');
				return false;
			}
		}
		if(b == e){
			var x = confirm('°Ë»öÇÏ´Â ³ªÀÌ°¡ '+b+'¼¼ ~ '+e+'¼¼°¡ ¸ÂÀ¸½Ê´Ï±î?');
			if(!x){
				return false;
			}
		}
	}
	return true;
}

function my_memo(){
	var url = '/pop/memo/address.html';
	var name = 'memo_address';
	var Sw = screen.availWidth;
	var Sh = screen.availHeight;
	var Pw = 360;
	var Ph = 360;
	var pw_left = (Sw - Pw) / 2;
	var pw_top = (Sh - Ph) / 2;
	popup(url,name,pw_left,pw_top,Pw,Ph,0,0,0,0,0);
}

function my_blog(){
	var url = '/pop/memo/blog.html';
	var name = 'blog_address';
	var Sw = screen.availWidth;
	var Sh = screen.availHeight;
	var Pw = 360;
	var Ph = 360;
	var pw_left = (Sw - Pw) / 2;
	var pw_top = (Sh - Ph) / 2;
	popup(url,name,pw_left,pw_top,Pw,Ph,0,0,0,0,0);
}

function my_blog2(){
	var x = confirm('ºí·Î±×°¡ Á¸Àç ÇÏÁö ¾Ê½À´Ï´Ù. ºí·Î±×¸¦ °³¼³ÇÏ½Ã°Ú½À´Ï±î?');		
	if(x) {
		location.href = 'http://blog.godpeople.com/?GO=step01';
	}	
}

function my_pray(){
	var url = '/pop/memo/pray.html';
	var name = 'pray_address';
	var Sw = screen.availWidth;
	var Sh = screen.availHeight;
	var Pw = 360;
	var Ph = 360;
	var pw_left = (Sw - Pw) / 2;
	var pw_top = (Sh - Ph) / 2;
	popup(url,name,pw_left,pw_top,Pw,Ph,0,0,0,0,0);
}

function my_pray2(){
	var x = confirm('±âµµÈ¨ÇÇ°¡ Á¸Àç ÇÏÁö ¾Ê½À´Ï´Ù. ±âµµÈ¨ÇÇ¸¦ °³¼³ÇÏ½Ã°Ú½À´Ï±î?');		
	if(x) {
		location.href = 'http://pray.godpeople.com/?GO=pray_make';
	}	
}

function revcheck_address(theform) {
	for( var i=0; i<theform.elements.length; i++) {
		var ele = theform.elements[i];
		if(ele.name == 'address[]')
			ele.checked = true;
	}
	return;
}

function revcheck_blog(theform) {
	for( var i=0; i<theform.elements.length; i++) {
		var ele = theform.elements[i];
		if(ele.name == 'blog[]')
			ele.checked = true;
	}
	return;
}

function check(theform,mode) {
	for( var i=0; i<theform.elements.length; i++) {
		var ele = theform.elements[i];
		if(ele.name == mode)
			ele.checked = true;
	}
	return;
}

function cancel(theform,mode) {
	for( var i=0; i<theform.elements.length; i++) {
		var ele = theform.elements[i];
		if(ele.name == mode)
			ele.checked = false;
	}
	return;
}

function LimitChar(tFrm,cNum)
{
	if (tFrm.body.value.length > cNum){
		alert(cNum + "ÀÚ±îÁö¸¸ ÀÔ·ÂÇÏ¼¼¿ä.");
		tFrm.body.value = tFrm.body.value.substring(0, cNum);
	}
	limitct.innerText = tFrm.body.value.length;
}

function LimitSend(tfm)
{
	var ruid = tfm.receive_userid.value;
	var s = ruid.split(";");
	var s_len = s.length - 1 ;
	if(s_len > 0){
		if(s_len > 100){
			alert('ÃÖ´ë '+cNum+'¸í(¼±ÅÃÇÑ »ç¶÷ : '+s_len+'¸í)±îÁö¸¸ Àü¼ÛÀÌ °¡´ÉÇÕ´Ï´Ù.');
			var new_s = '';
			for(i=0;i<100;i++){
				new_s = s[i]+";";
			}
			tfm.receive_userid.value = new_s ;
		}
	}else{
		s_len = 1;
	}
	limitru.innerText = s_len;
}

function meConfig(f){
	f.submit();
}

function invitation(x){
	var f = document.srch_snd;
	var uid_length = f.user_id.length;
	var uid ;
	if(uid_length > 1){
		//alert("¶óµð¿À¹öÆ° : "+uid_length+" °³");
		for(i=0;i<uid_length;i++){
			if(f.user_id[i].checked){
				uid = f.user_id[i].value ;
			}
		}
	}else{
		if(f.user_id.checked) uid = f.user_id.value;
	}
	if(!uid){ 
		alert('ÃÊ´ëÇÒ Ä£±¸¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
	}else{
		switch(x){
			case "cafe" :
			var url = 'http://memo.godpeople.com/pop/invitation_cafe.html?user_id='+uid;
			var name = 'mpop';
			var Sw = screen.availWidth;
			var Sh = screen.availHeight;
			var Pw = 360;
			var Ph = 440;
			var pw_left = (Sw - Pw) / 2;
			var pw_top = (Sh - Ph) / 2;
			popup(url,name,pw_left,pw_top,Pw,Ph,0,0,0,0,0);
			break;
			case "blog" :
			var url = 'http://memo.godpeople.com/pop/invitation_blog.html?user_id='+uid;
			var name = 'mpop';
			var Sw = screen.availWidth;
			var Sh = screen.availHeight;
			var Pw = 360;
			var Ph = 440;
			var pw_left = (Sw - Pw) / 2;
			var pw_top = (Sh - Ph) / 2;
			popup(url,name,pw_left,pw_top,Pw,Ph,0,0,0,0,0);
			break;
		}
	}
}

function isnoblogger(){
	var x = confirm("ºí·Î±×°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.\n\nºí·Î±×¸¦ °³¼³ÇÏ½Ã°Ú½À´Ï±î?");
	if(x){
		location.href = 'http://blog.godpeople.com/?GO=step01';
	}
}

function search_send(){
	var f = document.srch_snd;
	var uid_length = f.user_id.length;
	var uid;
	if(uid_length > 1){
	//alert("¶óµð¿À¹öÆ° : "+uid_length+" °³");
	for(i=0;i<uid_length;i++){
		if(f.user_id[i].checked){
			uid = f.user_id[i].value ;
		}
	}
	}else{
		if(f.user_id.checked) uid = f.user_id.value;
	}
	//alert("¼±ÅÃµÈ ¾ÆÀÌµð : "+uid);
	if(!uid){
		alert('ÂÊÁöº¸³¾ Ä£±¸¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
	}else{
		var url = 'http://memo.godpeople.com/pop/send.html?user_id='+uid ;
		var name = 'mpop';
		var Sw = screen.availWidth;
		var Sh = screen.availHeight;
		var Pw = 310;
		var Ph = 380;
		var pw_left = (Sw - Pw) / 2;
		var pw_top = (Sh - Ph) / 2;
		popup(url,name,pw_left,pw_top,Pw,Ph,0,0,0,0,0);
	}
}

function popup_send(uid){
	var url = 'http://memo.godpeople.com/pop/send.html?user_id='+uid ;
	var name = 'mpop';
	location.href = url;
}

function popup_save(mn){
	var url = 'http://memo.godpeople.com/pop/process.html?p=save&mn='+mn;
	var name = 'mpop';
	location.href = url;
}

function popup_delete(mn,mode){
	var url = 'http://memo.godpeople.com/pop/process.html?p=delete&mode='+mode+'&mn='+mn;
	var name = 'mpop';
	location.href = url;
}

function popup_blist(uid){
	var url = 'http://memo.godpeople.com/pop/process.html?p=blist&user_id='+uid;
	var name = 'mpop';
	location.href = url;
}

function popup_view(mn,mode){
	var url = 'http://memo.godpeople.com/pop/'+mode+'.html?mn='+mn;
	var name = 'mpop';
	location.href = url;
}

function memo_more(){
	opener.parent.location.href = 'http://www.godpeople.com/?GO=received';
	self.close();
}

function goBlogLink(user_id){
	parent.opener.location.href = 'http://blog.godpeople.com/'+user_id+'/';
	self.close();
}

function goCafeLink(cafe_id){
	parent.opener.location.href = 'http://cafe.godpeople.com/'+cafe_id+'/';
	self.close();
}

function goPoP(url,name,Pw,Ph){
	var Sw = screen.availWidth;
	var Sh = screen.availHeight;
	var pw_left = (Sw - Pw) / 2;
	var pw_top = (Sh - Ph) / 2;
	popup(url,name,pw_left,pw_top,Pw,Ph,0,0,0,0,0);
}

function popup(url, name, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
	toolbar_str = toolbar ? 'yes' : 'no';
	menubar_str = menubar ? 'yes' : 'no';
	statusbar_str = statusbar ? 'yes' : 'no';
	scrollbar_str = scrollbar ? 'yes' : 'no';
	resizable_str = resizable ? 'yes' : 'no';
	window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

function fPopWin(urlAddr,tgt,cntr,W,H,S) {
	if (cntr==1) { //¼¾ÅÍ¹è¿­
		var h_mg = 50; //¾Æ·¡ÂÊ ¸¶Áø
		var Cw = screen.availWidth;		var Ch = screen.availHeight;
		if (W) pw_w = W;						if (H) pw_h = H;
		if (pw_w>Cw) pw_w = Cw;				if (pw_h>Ch-h_mg) pw_h = Ch-h_mg;
		var L = (Cw - pw_w) / 2;			var T = (Ch - h_mg - pw_h) / 2;
	} else { //ÁÂ»ó¹è¿­
		var L = 0;								var T = 0;
	}
	var ie7_flag = false;
	ie7_flag = (window.navigator.userAgent.indexOf("MSIE 7") != -1);
	if ( ie7_flag ) H = H + 25 ;
	var wn = window.open(urlAddr, tgt, 'left='+L+',top='+T+',width='+W+',height='+H+',toolbar=no,resizable=no,scrollbars='+S);
	wn.focus();
}

function Msg(){
	alert('¼­ºñ½º Á¡°ËÁßÀÔ´Ï´Ù.');
}

function nation(f){
	var n = f.nation.options[f.nation.SelectedIndexes].value ;
	alert(n);
	if(n == '´ëÇÑ¹Î±¹'){
		f.crm.disabled = false ;
		f.crm.style.backgroundColor = '#ffffff';
	}else{
		f.crm.disabled = true ;
		f.crm.style.backgroundColor = '#efefef';	
	}
}

function SHLayer(layer){
//	alert(eval("document.all.D"+layer).style.display);
	if(eval("document.all.D"+layer).style.display == 'block'){
		eval("document.all.D"+layer).style.display = 'none';
		eval("document.all.D"+layer).innerHTML = "";
	}else if(eval("document.all.D"+layer).style.display == 'none'){
		eval("document.all.D"+layer).style.display = 'block';
	}
}

// ÇÁ·¹ÀÓ //
function SHFrame(layer){
	if(eval("document.all.D"+layer).style.display == 'block'){
		eval("document.all.D"+layer).style.display = 'none';
		eval("document.all.D"+layer).innerHTML = "";
	}else if(eval("document.all.D"+layer).style.display == 'none'){
		eval("document.all.D"+layer).style.display = 'block';
		contents_notice_iframe.location.href = 'http://www.godpeople.com/iframe/contents_notice.html?code='+layer;
	}
}


// ½ºÅ©·Ñ °ü·Ã ½ºÅ©¸³Æ®
// Ãß°¡ÀÏ : 2008-03-05
// Ãß°¡ÀÚ : ÃÖÁö¿¬´ë¸®
var sa = new Object();

sa.Scroll = function() {
	this.version = "0.2";
	this.name = "sascroll";
	this.divId = "";
	this.item = new Array();
	this.itemcount = 0;
	this.currentspeed = 0;
	this.scrollspeed = 10;
	this.pausedelay = 1000;
	this.pausemouseover = true;
	this.stop = false;
	this.height = 100;
	this.width = 400;
	this.stopHeight=0;
	this.i=0;
	this.reloadData = 0;
}

sa.Scroll.prototype = {
	add : function (text) {
		this.item[this.itemcount] = text;
		this.itemcount = this.itemcount + 1;
	},
	setDivId : function(name) {
		this.divId = name
	},
	start : function () {
		if ( this.itemcount == 1 ) {
			this.add(this.item[0]);
		}
		this.display();
		this.currentspeed = this.scrollspeed;
		this.stop = true;
		setTimeout(this.name+'.scroll()',this.currentspeed);
		window.setTimeout(this.name+".stop = false", this.pausedelay);
	},
	
	display : function () {
		var htmlCode;
		htmlCode = '<div id="'+this.name+'" style="height:'+this.height+'px; width:'+this.width+'px; position:relative; overflow:hidden; padding:0 0 0 0; " OnMouseOver="'+this.name+'.onmouseover(); " OnMouseOut="'+this.name+'.onmouseout(); ">';
		for(var i = 0; i < this.itemcount; i++) {
			htmlCode += '<div id="'+this.name+'item'+i+'"style="left:0px; width:'+this.width+'; position:absolute; top:'+(this.height*i)+'px;padding:0 0 0 0;">';
			htmlCode += this.item[i];
			htmlCode += '</div>';
		}
		htmlCode += '</div>';
		document.getElementById(this.divId).innerHTML=htmlCode;
		
	},
	
	scroll : function () {
		this.currentspeed = this.scrollspeed;
		if ( !this.stop ) {
			for (var i = 0; i < this.itemcount; i++) {
				obj = document.getElementById(this.name+'item'+i).style;
				obj.top = parseInt(obj.top) - 1;
				if ( parseInt(obj.top) <= this.height * (-1) ) obj.top = this.height * (this.itemcount-1);
				if ( parseInt(obj.top) == 0 ) {
					this.currentspeed = this.pausedelay;
					this.i = i;
				}
			}
		}
		
		window.setTimeout(this.name+".scroll()",this.currentspeed);
	}
}

sa.Ranking = function(scrollWidth, divid, scrollname){
	this.sascroll = new sa.Scroll();
	this.sascroll.name = "";
	this.sascroll.name = scrollname;
	this.sascroll.height = 16;
	this.sascroll.width = scrollWidth;
	this.sascroll.scrollspeed = 68;
	this.sascroll.pausedelay = 2000;
	this.sascroll.pausemouseover = true;
	this.sascroll.divId = divid;
}

sa.Ranking.prototype = {
	init : function(){
		this.sascroll.setDivId(this.sascroll.divId);
		this.sascroll.onmouseover = function() {}
		this.sascroll.onmouseout = function() {}
	},
	add : function(text){
		this.sascroll.add(text);
	},
	start : function(){
		this.init();
		this.sascroll.start();
	}
}


