document.domain='gomtv.com';

getAjaxUpdater = function(url, str){
//	var pars = 'param='+str;
	var pars = "dummy=" + new Date().getTime();

	var myAjax = new Ajax.Updater(
		{success: 'slideContentPlace'},
		url,
		{
			method: 'get',
			parameters: pars,
			onFailure: reportError
		}
	);
}

reportError = function(request) {
	alert('Error on Ajax.Updater');
}

function Login(){
	var returl = document.URL;
	returl = escape(returl);
	document.location.href = 'http://private.gomtv.com/cgi-bin/login.cgi?returl=' + returl;
}

function adultLogin()
{
	var returl = document.URL;
	returl = escape(returl);
	document.location.href = 'http://private.gomtv.com/cgi-bin/adultCheck.cgi?returl=' + returl;
}
function LogOut(returl){
	RealLogOut(returl);
}

function RealLogOut(returl){
	if (!returl)
		var returl=document.URL;

	returl=escape( returl );
	var url='http://private.gomtv.com/cgi-bin/logout.cgi?returl='+returl;
	document.location.replace( url );
}

function alertLogin(){
	document.domain = 'gomtv.com';

	if (confirm('·Î±×ÀÎÀÌ ÇÊ¿äÇÕ´Ï´Ù\n·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î?'))
	{
		var returl = document.URL;
		returl = escape(returl);
		var baseUrl = 'http://private.gomtv.com/cgi-bin/login.cgi?returl=' + returl;
		document.location.href = baseUrl;
	}
}

//******************** text scroll *********************//
var roll_Class=function(){this.initialize.apply(this,arguments);}
roll_Class.prototype={

initialize:function(){

this.className=arguments[0]?arguments[0]:null;
this.foundit(arguments[1],'',false);
this.contents=new Array('0');
this.contents_delay=null;
this.nowdelay=null;
this.foundit(
this.roll.childNodes,this.foundvalue ,
function(rt,that){

if(that.constrain_size !== null) that.foundit(rt.childNodes,'IMG',function(rt,that){rt.style[(this.moving != 'left' ? 'width' : 'height')] = that.constrain_size;});
that.contents_delay=that.contents[that.contents.length]=that.contents_delay+-rt[(that.moving=='left'?'offsetWidth':'offsetHeight')];});

{
this.rollHeight=this.proll.style[(this.moving=='left'?'width':'height')]=Math.abs(this.contents[this.contents.length-1]);
this.roll.appendChild(this.roll.cloneNode(true));
};},


foundit:function(tg,n){

var temp=new Array();

	for(var v in tg)
		switch(typeof arguments[2]){
		case 'object':if(arguments[2].initialize(tg[v],n,this)==true) return; else break;
		case 'function':if(tg[v].nodeName==n) arguments[2](tg[v],this); break;
		case 'boolean':this[v]=tg[v]; break;
		default:if(tg[v].nodeName==n) return tg[v];
	}

return temp;},

inaction:function(time){

this.roll.style[this.moving]=time=time < 0 ?(this.fall==false && time <= -this.rollHeight?0:time):-this.rollHeight,null;
this.foundit(this.contents,time,{initialize:function(rt,vrt,that){if(Math.abs(rt - vrt) <(that.fast==false?that.tick:that.ftick)){that.roll.style[that.moving]=rt; that.nowdelay=that.fast==true?that.lengthen:that.delay; that.fast=false; return true;} else that.nowdelay=that.lengthen;}});
{var ticks=this.fast==true?this.ftick:this.tick;}
this.control=setTimeout(this.className+".inaction("+(parseInt(this.roll.style[this.moving])+(this.fall==true?ticks:-ticks))+");",this.nowdelay);},

stop:function(){

this.temp=parseInt(this.roll.style[this.moving]);
clearTimeout(this.control);}    };
//******************** text scroll *********************//

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

/* imgÀåºñ /js/common/utilEtc.js ¿¡ ÀÖ´Â ½ºÅ©¸³Æ® »ç¿ë
// ¹ÂÁ÷ ´Ù¿î·Îµå °ü·Ã ½ºÅ©¸³Æ®
var setMDownKey = function(systype,intid,fileid){
	if(navigator.userAgent.indexOf('Mac') != -1){
		alert('Á¢¼ÓÇÏ½Å OS¿¡¼­´Â ÇØ´ç ¼­ºñ½º¸¦ Áö¿øÇÏÁö ¾Ê½À´Ï´Ù.');
		return false;
	}
	var url = "http://www.gomtv.com/order/order.gom";
	var NumString = /[0-9]/g		 // ¼ýÀÚ
	if(fileid.match(NumString)){
		var param = "systype="+systype;
		param += "&intid="+intid;
		param += "&fileid="+fileid;
	}
	var path = url+"?ordertype=MvDownload&"+param;
	window.open( path,"cashBill", 'width=425,height=290,menubars=no,scrollbars=no');
	return false;
}

// mp3 ´Ù¿î·Îµå
var setMP3DownKey = function(songid){
	if(navigator.userAgent.indexOf('Mac') != -1){
		alert('Á¢¼ÓÇÏ½Å OS¿¡¼­´Â ÇØ´ç ¼­ºñ½º¸¦ Áö¿øÇÏÁö ¾Ê½À´Ï´Ù.');
		return false;
	}
	var url = "http://www.gomtv.com/order/order.gom";
	var param = "intsongid="+songid;
	var path = url+"?ordertype=Mp3Download&"+param;
	window.open( path,"cashBill", 'width=425,height=290,menubars=no,scrollbars=no');
	return false;
}
*/

var afterLogin = function(){
	window.location.reload();
}
