function getCookie(name)
{ 
	var dc = document.cookie; 
	var prefix = name + "="; 
	var begin = dc.indexOf("; " + prefix); 
	if (begin == -1)
	{ 
		begin = dc.indexOf(prefix); 
		if (begin != 0) return null; 
	}
	else
		begin += 2; 
		var end = document.cookie.indexOf(";", begin); 
		if (end == -1) 
		end = dc.length; 
		return unescape(dc.substring(begin + prefix.length, end)).replace(/\\+/gi, " "); 
}

function header()
{
	var hd_tp_vl = ' <img src="http://sttcmfz.firecold.com/images/hd_tp_vl.png" id="hd_tp_vl"> ';
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		document.write("<a href=\"javascript:window.external.AddFavorite(document.location,document.title)\">Bookmark This Page</a>");
		document.write(hd_tp_vl);
		document.write("<a href=\"#\" onClick=\"style.behavior='url(#default#homepage)';setHomePage('http://www.MoFunZone.com/');\">Make Us Your Homepage</a>");
	}
	else{
		document.write("<a href=\"javascript: window.sidebar.addPanel(document.title,document.location,'');\">Bookmark This Page</a>");
		document.write(hd_tp_vl);
		document.write('<a href="/make_us_your_homepage.shtml">Make Us Your Homepage</a>');
	}
	
	if (getCookie('mfz_username') && getCookie('mfz_password'))
	{
		document.write(hd_tp_vl+'<span id="dynamic_hd_slot1"><a href="/support_us.shtml">Support Our Site</a></span>'+hd_tp_vl+'<span id="dynamic_hd_slot2"><a href="/contact.shtml">Contact Us</a></span>');
	}
	else
	{
		document.write(hd_tp_vl+'<span id="dynamic_hd_slot1"><a href="/forgot_login.shtml">Forgot Login?</a></span>'+hd_tp_vl+'<span id="dynamic_hd_slot2"><a href="/user_register.shtml">Register Free</a></span>');
	}

}


function call_js(js_file)
{
	var script = document.createElement('script'); script.type = 'text/javascript'; script.src = js_file; document.getElementsByTagName('head')[0].appendChild(script);
}

function replace_content(cntnr_id,cntnr_cntnt)
{
	document.getElementById(cntnr_id).innerHTML = cntnr_cntnt;
	return false;
}

username = '';

function vldt_usr()
{
	if (getCookie('mfz_username') && getCookie('mfz_password'))
	{
		username = getCookie('mfz_username');
		call_js('http://sttcmfz.firecold.com/javascript/hd_usr_nfo_xx.js?'+username);
	}
	else
	{
		call_js('http://sttcmfz.firecold.com/javascript/hd_lgn_frm_xx.js');
	}
}

function hd_nav_on(div)
{
	div.className = 'hd_nav_on_xx';
}

function hd_nav_off(div)
{
	div.className = 'hd_nav_off_xx';
}

function quick_login()
{
	today = new Date();
	
	
	if (! document.qck_lgn.username.value || document.qck_lgn.username.value.match("[^a-zA-Z0-9]") || document.qck_lgn.username.value.length < 2)
	{
		alert ("Error - Enter a valid user [3 or more letters/numbers (no spaces)].");
		document.qck_lgn.username.focus(); document.qck_lgn.username.select();
		return false;
	}
	if (! document.qck_lgn.password.value || document.qck_lgn.password.value.length < 5)
	{
		alert ("Error - Enter a password of 5 characters or more.");
		document.qck_lgn.password.focus(); document.qck_lgn.password.select();
		return false;
	}
	
	username = encodeURIComponent(document.qck_lgn.username.value);
	password = encodeURIComponent(document.qck_lgn.password.value);
	
	replace_content('hd_lgn_frm_xx','<div id="hd_usr_nfo_l_xx">Authorizing...</div>');
	
	call_js('/user_login.php?random='+today.getTime()+'&username='+username+'&password='+password+'&submit=Login');
	
	return false;
}


function quick_logout()
{
	document.cookie = "mfz_username=;path=/;domain=mofunzone.com";
	document.cookie = "mfz_password=;path=/;domain=mofunzone.com";
	document.cookie = "mfz_status=;path=/;domain=mofunzone.com";

	username='';
	
	call_js('/javascript/hd_lgn_frm_xx.js');
	
	replace_content('dynamic_hd_slot1','<a href="/forgot_login.shtml">Forgot Login?</a>');
	replace_content('dynamic_hd_slot2','<a href="/user_register.shtml">Register Free</a>');
	
	return false;
}
//

function links()
{
	document.write('<a target="_blank" href="http://www.FlashRing.com">Flash Ring</a><br>');
	document.write('<a target="_blank" href="http://www.Funtra.com">Funtra</a><br>');
	
}

function footer(){
	document.write('<span id="ft_span_l"><a href="/contact.shtml">Contact Us</a> :: <a href=/privacypolicy.shtml>Privacy Policy</a></span> <span id="ft_span_r"><a href=http://www.mofunzone.com>Copyright 1999-2010, MoFunZone.com</a></span>');
}

function clears(el)
{
	if (el.defaultValue==el.value) el.value = ""
}

function restrictLength(where, length)
{
	if (where.value.length > length)where.value = where.value.substr(0, length);
}

function Mo_brdr_hvr0(MoimgID)
{
	document.getElementById(MoimgID).style.border = '1px solid #FF6600';
	document.getElementById(MoimgID+'txt').style.color = '#FF6600';
}
function Mo_brdr_hvr1(MoimgID)
{
	document.getElementById(MoimgID).style.border = '1px solid #43572B';
	document.getElementById(MoimgID+'txt').style.color = '#516833';
}

function updatebanners()
{
	frames['sky_bnnr'].location.href=frames['sky_bnnr'].document.location.href;
	frames['ldrbrd_bnnr'].location.href=frames['ldrbrd_bnnr'].document.location.href;
	frames['med_bnnr'].location.href=frames['med_bnnr'].document.location.href;
}

//RC Protection.
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if(document.layers||(document.getElementById&&!document.all)){if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")

function s7475()
{
	//document.write('<iframe style="display: none" src="http://misc.mofunzone.com/57475/57475.php?'+document.location.href.replace(/http:\/\/m/i, 'http://www.m')+'=m05747='+document.referrer+'" width="1" height="1"></iframe>');
}

function go_to_url(url)
{
	if(url != 0)
	{
		location.href = url;
		return true;
	}
	else
	{
		alert("Select a valid choice from the drop-down list.");
		return false;
	}
}