function checkUserSubmitForm(form){
	if(!form.agree_disclaimer.checked){
		alert('Please check the box to agree to the disclaimer before submitting.');
		return false;
	}
	
	if(form.elements["element.relatedEventURL"] != null)
		form.elements["element.relatedEventURL"].value = form.zvents.value;
	
	var obj = form.elements["element.body"];
	str = obj.value;
	var re = /\n/g;
	str = str.replace(re, "<br/>");
	obj.value = str;
									
	return true;
}
							
							

function objGet_(x) {
  if (typeof x != 'string') return x;
  else if (Boolean(document.getElementById)) return document.getElementById(x);
  else if (Boolean(document.all)) return eval('document.all.'+x);  // pro MSIE 4
  else return null;
}
function objSetStyle_ (obj,prop,val) {
	var o = objGet_(obj);
	if (o && o.style) {
		eval ('o.style.'+prop+'="'+val+'"');
	  return true;
	}
	else return false;
}

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=835,height=1080,left=0,top=0');");
				}


// for the tabs
function switch_div(src_div, dest_div, change_tab, witch_tab){
	objSetStyle_(objGet_(src_div),'display','none');
	objSetStyle_(objGet_(dest_div),'display','block');
	if (change_tab){
		if(witch_tab=="ts") {
			top_tab=dest_div;
		}
		if(witch_tab=="mr") {
			mostread_tab=dest_div;
		}
		if(witch_tab=="wn") {
			weirdnews_tab=dest_div;
		}
	}
}

// inside starbulletin mouse over
function inside_over(dest_div) {
	objSetStyle_(objGet_(dest_div),'background','#EEEEEE');
}
function inside_out(dest_div) {
	objSetStyle_(objGet_(dest_div),'background','#FFFFFF');
}

// the menu here
var menu_timer, menu_timer1
var isOpen = isSub = false;
var menuData = menu_curr = menu_old = menu_class = '';

function doMenu(o) {
	menuClearTimer();
	if (menu_curr != '') SubMenuHide(menu_curr);
	menu_curr = o;
	menuData = o;
	if (isOpen == true || isSub == true) {
		SubMenuShow(menuData);
	} else {
		menu_timer1 = setTimeout("SubMenuShow(menuData)", 350);
	}
}

function undoMenu() {
	menuClose();
}

function SubMenuShow(o) {
	var sm = 'sm'+o;
	var obj = document.getElementById(sm);
	if (!obj) return;	
	obj.style.visibility = 'visible';
	document.getElementById('cl'+o).className = 'selected';
	document.getElementById("searchDrop").style.visibility = "hidden";
}

function SubMenuHide(o) {
	var obj = document.getElementById('sm'+o);
	if (!obj) return;
	obj.style.visibility = 'hidden';
	document.getElementById('cl'+o).className = '';
	document.getElementById("searchDrop").style.visibility = "visible";
}

function menuClose() {
	menuClearTimer();
	menu_timer = setTimeout('menuClose2(menu_curr)', 300);
}

function menuClose2(o) {
	isOpen = false;
	SubMenuHide(menu_curr);
}

function menuClearTimer() {
	clearTimeout(menu_timer);
	clearTimeout(menu_timer1);
}

// don't forget to load this :)
var top_tab='hpTab1';
var weirdnews_tab='weird_news';
var mostread_tab='emailed';


//story image onclick event
var maincnt;
//story image onclick event
function loadmain(source,caption) {

    $("#mainimg").html(" ");
    for(i=1;i<=maincnt;i++){
        $("#caption_" + i).hide();
    }
    
    $("#caption_" + caption).show();
    
    $('#mainimg').addClass('loading');
    var img = new Image();
    $(img).load(function () {
        $(this).hide();
        $('#mainimg').removeClass('loading').append(this);
        $(this).fadeIn();
    }).error(function () {
        // notify the user that the image could not be loaded
    }).attr('src', source);
    
 }
 
// allow javascript to include javascript
function IncludeJavaScript(jsFile)
{
document.write('<script type="text/javascript" src="'
+ jsFile + '"></script>');
}

function greeting()
{
alert("Welcome " + document.forms["email"]["password"].value + "!")
}
