
var search_bg_targeted = -1;
var g_strRNO = "";
var g_strDate = "";

function getAbsoluteTop(oNode) { // 절대 높이 계산
	var oCurrentNode=oNode;
	var iTop=0;
	while(oCurrentNode.tagName!="BODY") {
		
		iTop+=oCurrentNode.offsetTop;
		
		//alert(oCurrentNode.tagName);
		//alert(oCurrentNode.innerHTML);
		oCurrentNode=oCurrentNode.offsetParent;
		
	}
	return iTop;
}

function getAbsoluteLeft(oNode) { // 절대 좌측 계산
	var oCurrentNode=oNode;
	var iLeft=0;
	while(oCurrentNode.tagName!="BODY"){
		iLeft+=oCurrentNode.offsetLeft;
		oCurrentNode=oCurrentNode.offsetParent;
	}
	return iLeft;
}

function isIE() {
	if (navigator.userAgent.indexOf("MSIE") >= 0) {
		return true;
	} else {
		return false;
	}
}

function search_strip(a) {
	if (a) {
		if ((a == "K" && document.INGREDIENT_FORM.I_TITLE.value != "") || (a == "M")) {
			document.INGREDIENT_FORM.I_TITLE.style.backgroundImage = '';
			search_bg_targeted = -1;
		}
	} else {
		document.INGREDIENT_FORM.I_TITLE.style.backgroundImage = '';
		search_bg_targeted = -1;
	}
}



function SchSug_setcoor(id,url,width) {
	url = url+"?id="+id;
	document.write("<div id=SchSug style='position:absolute;z-index:1000'>");
	document.write("<iframe id=hFrame name=hFrame src='"+url+"' style='width:"+width+"px;display:none' frameborder=0 scrolling=no></iframe>");
	document.write("</div>");
	var obj = document.getElementById("SchSug");
	obj.style.top = getAbsoluteTop(document.getElementById(id)) + document.getElementById(id).offsetHeight;
	obj.style.left = getAbsoluteLeft(document.getElementById(id));
	
}

function ShowAlphaDiv()
{
	// background alpha 처리
	
	var alphaDiv = $('alpha_div');
	var alphaDiv_opacity = 30;
    var alphaDiv_color = '#000';

    alphaDiv.style.background = alphaDiv_color;
    SetBgOpacity(alphaDiv,alphaDiv_opacity); 
    alphaDiv.style.display='block';
    alphaDiv.style.height= document.body.scrollHeight;
    
    //document.body.style.overflow = "hidden";
	
}

function HideAlphaDiv()
{
    var alphaDiv=$('alpha_div');
    if(alphaDiv)alphaDiv.style.display='none';
    
    //document.body.style.overflow = "scroll";	
}

function SetBgOpacity(obj,value)
{
	if(typeof(obj)=='string') obj=document.getElementById(obj);
	obj.style.opacity = (value / 100);
	obj.style.MozOpacity = (value / 100);
	obj.style.KhtmlOpacity = (value / 100);
	obj.style.filter = "alpha(opacity=" + value + ")";
}

function SetCenterPos(obj, width, height) {

	var pageWidth = document.body.clientWidth;
    var pageHeight =  document.body.clientHeight;

	obj.style.left = pageWidth/2 - width/2;
	
	/*
	if(Browser.isIE) {
		obj.style.left = pageWidth/2 - width/2;
	} else {
		obj.style.left = pageWidth/2 - width/2 - 3;
	}
	*/
	
	obj.style.top = document.body.scrollTop + pageHeight/2 - height/2;
	obj.style.width = width;
	obj.style.height = height;
}


function ShowLoginForm()
{
	
	var strParam = "cmd=get_login_form";
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		ShowAlphaDiv();
	
		var div = $('popup_div');
		SetCenterPos(div, 300, 200);
	
		var popup_div = $('popup_div');
		if(popup_div) {
			popup_div.style.display = '';
			popup_div.innerHTML = res.responseText;
		}
	}
}

function ShowFindForm()
{
	
	var strParam = "cmd=get_find_form";
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		ShowAlphaDiv();
	
		var div = $('popup_div');
		SetCenterPos(div, 300, 200);
	
		var popup_div = $('popup_div');
		if(popup_div) {
			popup_div.style.display = '';
			popup_div.innerHTML = res.responseText;
		}
	}
}

function ShowJoinForm()
{
	
	var strParam = "cmd=get_join_form";
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		ShowAlphaDiv();
	
		var div = $('popup_div');
		SetCenterPos(div, 400, 300);
	
		var popup_div = $('popup_div');
		if(popup_div) {
			popup_div.style.display = '';
			popup_div.innerHTML = res.responseText;
		}
	}
}

function ShowEditForm()
{
	
	var strParam = "cmd=get_edit_form";
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		ShowAlphaDiv();
	
		var div = $('popup_div');
		SetCenterPos(div, 500, 400);
	
		var popup_div = $('popup_div');
		if(popup_div) {
			popup_div.style.display = '';
			popup_div.innerHTML = res.responseText;
		}
	}
}

function ShowDownload()
{
	
	var strParam = "cmd=get_download_form";
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		ShowAlphaDiv();
	
		var div = $('popup_div');
		SetCenterPos(div, 700, 500);
	
		var popup_div = $('popup_div');
		if(popup_div) {
			popup_div.style.display = '';
			popup_div.innerHTML = res.responseText;
		}
	}
}

function TogglePassForm()
{
	var form = document.edit_form;
	if(form.PASS_YN.checked == true) {
		$('TR_PASS1').style.display = '';
		$('TR_PASS2').style.display = '';
	} else {
		$('TR_PASS1').style.display = 'none';
		$('TR_PASS2').style.display = 'none';
	}
	
}

function EditInfo()
{
	var form = document.edit_form;
	
	if(form.U_NICK.value == "") {
		alert('닉네임을 입력하세요');
		form.U_NICK.focus();
		return;
	}
	
	var pass_yn = 'N';
	if(form.PASS_YN.checked == true) {
		
		pass_yn = 'Y';
		
		if(form.U_PASS.value == "") {
			alert('비밀번호를 등록하세요.');
			form.U_PASS.focus();
			return;
		}
		
		if(form.U_PASS2.value == "") {
			alert('비밀번호를 등록하세요.');
			form.U_PASS2.focus();
			return;
		}
		
		if(form.U_PASS.value != form.U_PASS2.value) {
			alert('비밀번호가 일치하지 않습니다.');
			form.U_PASS2.focus();
			return;
		}
	}
	
	form.target = "hiddenFrame";
	form.action = "/ko/mgr_user.php";
	form.submit();
	
		
	
}

function gfIsEmail(s)
{
  return s.search(/^\s*[\w\~\-\.]+\@[\w\~\-]+(\.[\w\~\-]+)+\s*$/g)>=0;
}

function JoinMember()
{
	var form = document.join_form;
	var strEmail = form.U_EMAIL.value;
	
	if(strEmail == "") {
		alert('이메일 주소를 입력하세요');
		form.U_EMAIL.focus();
		return;
	}
	
	if (!gfIsEmail(strEmail) )
	{
		alert('올바른 이메일주소를 입력하세요.');	
		form.U_EMAIL.focus();
		return;		
	}
	
	if(form.U_PASS1.value == "") {
		alert('비밀번호를 등록하세요.');
		form.U_PASS1.focus();
		return;
	}
	
	if(form.U_PASS2.value == "") {
		alert('비밀번호를 등록하세요.');
		form.U_PASS2.focus();
		return;
	}
	
	if(form.U_PASS1.value != form.U_PASS2.value) {
		alert('비밀번호가 일치하지 않습니다.');
		form.U_PASS2.focus();
		return;
	}
	
	if(form.U_NICK.value == "") {
		alert('닉네임을 입력하세요');
		form.U_NICK.focus();
		return;
	}
		
	var strParam = "cmd=join_member&U_EMAIL="+form.U_EMAIL.value+
	"&U_PASS="+form.U_PASS1.value+
	"&U_NICK="+encodeURIComponent(form.U_NICK.value);
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		//alert(res.responseText);
		var out = JSON.parse(res.responseText);
		if(out.code == 1) {
			HidePopup();
			alert('회원등록이 완료 되었습니다. 토크박스에 간단한 인사말을 남겨주시길 부탁드려요 ^o^ ');
			document.location.href='/ko/talkbox.php?TT_NO=1';
		} else {
		
			if(out.reason == 'DUP') {
				alert('중복된 이메일 주소입니다.');
				form.U_EMAIL.focus();
			} else {
				alert('회원가입이 실패하였습니다.');
			}
		}
	}
}

function Login()
{
	var form = document.login_form;
	
	if(form.U_EMAIL.value == "") {
		alert('이메일 주소를 입력하세요');
		form.U_EMAIL.focus();
		return;
	}
	
	if(form.U_PASS.value == "") {
		alert('비밀번호를 등록하세요.');
		form.U_PASS.focus();
		return;
	}
	
	var save_yn = 'N';
	var save_cb = form.SAVE_ID_YN;
	if(save_cb.checked == true) {
		save_yn = 'Y';
	} else {
		save_yn = 'N';
	}
		
	var strParam = "cmd=login&U_EMAIL="+form.U_EMAIL.value+"&U_PASS="+form.U_PASS.value+"&SAVE_ID_YN="+save_yn;
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		//alert(res.responseText);
		var out = JSON.parse(res.responseText);
		if(out.code == 1) {
			HidePopup();
			Refresh();
		} else {
		
			if(out.reason == 'NOT_MATCH') {
				alert('이메일과 비밀번호가 맞지않습니다.');
				form.U_PASS.focus();
			} else if(out.reason == 'NO_REG') {
				alert('등록되지 않은 이메일주소입니다.');
				form.U_EMAIL.focus();
			} else {
				alert('로그인이 실패하였습니다.');
			}
		}
	}
}

function ShowLogoutForm()
{
	
	var strParam = "cmd=get_logout_form";
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		ShowAlphaDiv();
	
		var div = $('popup_div');
		SetCenterPos(div, 300, 200);
	
		var popup_div = $('popup_div');
		if(popup_div) {
			popup_div.style.display = '';
			popup_div.innerHTML = res.responseText;
		}
	}
}

function Logout()
{
	var form = document.logout_form;
	var clear_cookie = 'N';
	var arrRadio = form.CLEAR_COOKIE;
	if(arrRadio[0].checked == true) {
		 clear_cookie = 'N';
	} else {
		 clear_cookie = 'Y';
	}
	var strParam = "cmd=logout&clear_cookie="+clear_cookie;
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		//alert(res.responseText);
		var out = JSON.parse(res.responseText);
		if(out.code == 1) {
			Refresh();
		} else {
			alert('로그아웃 처리가 실패 하였습니다.');
		}
	}
}

function FindPass()
{
	var form = document.find_form;
	
	if(form.U_EMAIL.value == "") {
		alert('이메일 주소를 입력하세요');
		form.U_EMAIL.focus();
		return;
	}
	
	if(form.U_NICK.value == "") {
		alert('닉네임을 등록하세요.');
		form.U_NICK.focus();
		return;
	}
	
	
		
	var strParam = "cmd=find_pass&U_EMAIL="+form.U_EMAIL.value+"&U_NICK="+encodeURIComponent(form.U_NICK.value);
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		//alert(res.responseText);
		var out = JSON.parse(res.responseText);
		if(out.code == 1) {
			alert('입력하신 이메일로 새로운 비밀번호가 전송되었습니다. 정보수정에서 다시 설정하시기 바랍니다.');
			HidePopup();
			Refresh();
		} else {
		
			if(out.reason == 'NOT_MATCH') {
				alert('이메일과 닉네임이 서로 일치하지 않습니다.');
				form.U_NICK.focus();
			} else if(out.reason == 'NO_REG') {
				alert('등록되지 않은 이메일주소입니다.');
				form.U_EMAIL.focus();
			} else {
				alert('비밀번호 재발송이 실패하였습니다.');
			}
		}
	}
}

function ShowEmailForm()
{
	
	var strParam = "cmd=get_email_form";
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		ShowAlphaDiv();
	
		var div = $('popup_div');
		SetCenterPos(div, 400, 300);
	
		var popup_div = $('popup_div');
		if(popup_div) {
			popup_div.style.display = '';
			popup_div.innerHTML = res.responseText;
		}
	}
}

function ShowRecommendForm()
{
	
	var strParam = "cmd=get_recommend_form";
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		ShowAlphaDiv();
	
		var div = $('popup_div');
		SetCenterPos(div, 500, 240);
	
		var popup_div = $('popup_div');
		if(popup_div) {
			popup_div.style.display = '';
			popup_div.innerHTML = res.responseText;
		}
	}
}

function ShowIntroBox()
{
	
	var strParam = "cmd=get_intro_box";
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		ShowAlphaDiv();
	
		var div = $('popup_div');
		SetCenterPos(div, 700, 500);
	
		var popup_div = $('popup_div');
		if(popup_div) {
			popup_div.style.display = '';
			popup_div.innerHTML = res.responseText;
		}
	}
}

function RecommendRecipe()
{
	var form = document.recommend_form;
	
	if(form.R_POST_URL.value == "" || form.R_POST_URL.value == "http://") {
		alert('레시피 주소를 입력하세요');
		form.R_POST_URL.focus();
		return;
	}
	
		
	var strParam = "cmd=recommend_recipe&R_POST_URL="+encodeURIComponent(form.R_POST_URL.value)+"&R_EMAIL="+form.R_EMAIL.value;
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		//alert(res.responseText);
		var out = JSON.parse(res.responseText);
		if(out.code == 1) {
			alert('추천 되었습니다. 감사합니다.');
			HidePopup();
		} else {
			alert('추천 입력이 실패하였습니다. 같은 현상이 반복되면 ohmychef@naver.com으로 신고해주시면 감사드리겠습니다.');
		}
	}
}

function NextComment() 
{
	var obj = $('COMMENT_'+g_nCmtIdx);
	if(obj) {
		obj.style.display = "none";
	}
	
	g_nCmtIdx++;
	
	if(g_nCmtIdx >= g_nCmtCnt) {
		g_nCmtIdx = 0;
	}
	
	obj = $('COMMENT_'+g_nCmtIdx);
	if(obj) {
		obj.style.display = "block";
	}
}

function add_ingredient2(title) 
{
	if(!confirm('가지고 있는 재료로 추가하시겠습니까')) {
		return;
	}
	
	var form = document.navigation;
	form.mode.value = 'ingredient';
	//form.S_NO.value = '';
	//form.I_NO_STR.value = '';
	
	var strParam = "cmd=add_my_ingredient&MI_TITLE="+encodeURIComponent(title);
	var strUrl = '/ko/mgr_ingredient.php?'+strParam;
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		var out = JSON.parse(res.responseText);
		if(out.code == 1) {
			
			//alert('추가 되었습니다.');
			Refresh();
	
		} else {
			if(out.reason == 'UNREG_INGREDIENT') {
				alert('등록되지 않은 재료명입니다.');
			} else {
				alert('이미 등록한 재료입니다.');
			}
		}
	}
}


function ShowMyMenu(dd)
{
	g_strDate = dd;
	var strParam = "cmd=get_my_menu&DATE="+dd;
	var strUrl = '/ko/mgr_mymenu.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		ShowAlphaDiv();
	
		var div = $('popup_div');
		SetCenterPos(div, 700, 500);
	
		var popup_div = $('popup_div');
		if(popup_div) {
			popup_div.style.display = '';
			popup_div.innerHTML = res.responseText;
		}
	}
}

function ShowRegMenu(no, dd)
{
	
	g_strRNO = no;
	g_strDate = dd;
	var strParam = "cmd=get_reg_form&R_NO="+no+"&DATE="+dd;
	var strUrl = '/ko/mgr_mymenu.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		ShowAlphaDiv();
	
		var div = $('popup_div');
		SetCenterPos(div, 500, 500);
	
		var popup_div = $('popup_div');
		if(popup_div) {
			popup_div.style.display = '';
			popup_div.innerHTML = res.responseText;
		}
	}
}

function AddMyMenu()
{
	var form = document.add_mymenu_form;
	var strTemp = "";
	var arrChkBox = form.DATE_TYPE;
	for(var i = 0; i < arrChkBox.length; i++) { 
		if(arrChkBox[i].checked == true) {
			if(strTemp == "") {
				strTemp = arrChkBox[i].value;
			} else {
				strTemp += ","+arrChkBox[i].value;
			}
		}
	}
	
	if(strTemp == "") {
		alert("식단을 등록할 요일을 선택하세요");
		return;
	}
	
	var strParam = "cmd=add_my_menu&R_NO="+g_strRNO+"&DATE_TYPE_STR="+strTemp;
	var strUrl = '/ko/mgr_mymenu.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		var out = JSON.parse(res.responseText);
		if(out.code == 1) {
			g_strRNO = "";
			if(confirm('등록되었습니다. 지금 등록된 식단표를 확인하시겠습니까?')) {
				ShowMyMenu(g_strDate);
			} else {
				HidePopup();
			}
			
			//Refresh();
		} else {
			alert('식단등록이 실패하였습니다.');
		}
	}
}

function HidePopup()
{
	HideAlphaDiv();
	var popup_div = $('popup_div');
	if(popup_div) {
		popup_div.innerHTML = "";
		popup_div.style.display = 'none';
		
	}
}

function del_my_menu(no) 
{

	if(!confirm('정말 삭제하시겠습니까?')) {
		return;
	}
		
	var strParam = "cmd=del_my_menu&MM_NO="+no;
	var strUrl = '/ko/mgr_mymenu.php?'+strParam;
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		var out = JSON.parse(res.responseText);
		
		if(out.code == 1) {
			alert('삭제 되었습니다.');
			
			if(g_strRNO != "") {
				ShowRegMenu(g_strRNO, g_strDate);
			} else {
				ShowMyMenu(g_strDate);
			}
			
			//Refresh();
		} else {
			alert('삭제가 실패하였습니다.');
		}
	}
	
	return;
}

function OnMyMenuOver(no) 
{
	var oDelBox = $('MYMENU_ICON_'+no);
	if(oDelBox) {
		oDelBox.src = "http://image.funion.net/common/button/btn_delbox.gif";
	}
}

function OnMyMenuOut(no) 
{
	var oDelBox = $('MYMENU_ICON_'+no);
	if(oDelBox) {
		oDelBox.src = "http://image.funion.net/common/img_empty.gif";
	}
}

function OnMyMenuClick(no) 
{
}


function PrintMenu(dd) 
{
	var strUrl = "/ko/pop_mymenu.php?DATE="+dd;
	window.open(strUrl, "주간식단표", "width=760,height=600,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no");
}

function ShowHelp()
{
	var strParam = "cmd=get_help";
	var strUrl = '/ko/mgr_user.php?'+strParam;
	
	new Ajax.Request(strUrl, {onSuccess:getResponse});
	
	function getResponse(res)
	{
		ShowAlphaDiv();
	
		var div = $('popup_div');
		SetCenterPos(div, 680, 500);
	
		var popup_div = $('popup_div');
		if(popup_div) {
			popup_div.style.display = '';
			popup_div.innerHTML = res.responseText;
		}
	}
}




/***********************************************
* Pausing up-down scroller- ⓒ Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}