var detect = navigator.userAgent.toLowerCase();
var isIE = detect.indexOf('msie') != -1;
function init() {
		if(window.init_menu) {
			init_menu();
		}
}

function full_screen_popup(mylink, windowname){
  if (! window.focus)return true;
    var href;
      if (typeof(mylink) == 'string')
        href=mylink;
  else
    href=mylink.href;
    window.open(href, windowname, ',type=fullWindow,fullscreen,scrollbars=yes');
  return false;
}

function confirm_delete(objid,referer,type) {
	if(confirm('Are you sure you want to delete this?')) {
		window.location = 'process.php?action=delete'+'&id='+objid+'&referer='+referer+'&type='+type;
	}
	return(false);
}
function move_item_up(objid,type,key, referer) {
	if(confirm('Are you sure you want to move this record?')) {
		window.location = 'process.php?action=move_item'+'&id='+objid+'&type='+type+'&key='+key+'&referer='+referer;
	}
	return(false);
}   
function request_delete(module, object, id) {
	if(confirm('Are you sure you want to delete this '+object+'?')) {
		var next = encodeURIComponent(window.location.toString());
		window.location = 'process.php?action=delete&id='+id+'&referer='+next;
	}
	return(false);
}
function trim(string) {
	var new_string = string.replace(/^\s+/g, '');
	new_string = new_string.replace(/\s+$/g, '');
	return(new_string);
}
String.prototype.trim = function() {
    var str = this.replace(/^\s+/g, '');
    str = str.replace(/\s+$/g, '');
    return(str);
}
var _GET = new Array();
function parse_get() {
	var temp = new Array();
	var get = window.location.search.substring(1);

	if(get.length == 0) {
		return(false);
	}
	else if(get.indexOf('&') != -1) {
		var pairs = get.split('&');
		for(var i = 0; i < pairs.length; ++i) {
			temp = pairs[i].split('=');
			parse_get_assign_pair(temp[0], temp[1]);
		}
	}
	else {
		temp = get.split('=');
		parse_get_assign_pair(temp[0], temp[1]);
	}
}


function parse_get_assign_pair(key, val) {
	key = key.replace('+', ' ');
	key = unescape(key);
	val = val.replace('+', ' ');
	val = unescape(val);
	_GET[key] = val;
}
function jump_to() {
	for(var i = 0; i < this.options.length; ++i) {
		if(this.options[i].selected && this.options[i].value != 0) {
			window.location = 'index.php?category='+this.options[i].value;
		}
		if(this.options[i].selected && this.options[i].value == 0) {
      window.location = 'index.php';
    }
	}
	this.options[0].selected = true;
	return(false);
}
function init_jump_select() {
	var js = document.getElementById('jump_select');
	if(js) { js.onchange = jump_to; }
}

function upfontSize() {
  document.getElementById('primary').style.fontSize = "140%"
  document.getElementById('primary').style.lineHeight = "110%"
}
function downfontSize() {
  document.getElementById('primary').style.fontSize = ""
  document.getElementById('primary').style.lineHeight = ""
}

$(document).ready(function() {
	
$("ul#topnav li").hover(function() { //Hover over event on list item
	$(this).css({ 'background' : '#999999'}); //Add background color + image on hovered list item
	$(this).find("span").show(); //Show the subnav
} , function() { //on hover out...
	$(this).css({ 'background' : 'none'}); //Ditch the background
	$(this).find("span").hide(); //Hide the subnav
	
});
	
});

	



