/*
 * FeatureList - simple and easy creation of an interactive "Featured Items" widget
 * Examples and documentation at: http://jqueryglobe.com/article/feature_list/
 * Version: 1.0.0 (01/09/2009)
 * Copyright (c) 2009 jQueryGlobe
 * Licensed under the MIT License: http://en.wikipedia.org/wiki/MIT_License
 * Requires: jQuery v1.3+
*/
;(function($) {
	$.fn.featureList = function(options) {
		var tabs	= $(this);
		var output	= $(options.output);

		new jQuery.featureList(tabs, output, options);

		return this;	
	};

	$.featureList = function(tabs, output, options) {
		function slide(nr) {
			if (typeof nr == "undefined") {
				nr = visible_item + 1;
				nr = nr >= total_items ? 0 : nr;
			}

			tabs.removeClass('current').filter(":eq(" + nr + ")").addClass('current');

			output.stop(true, true).filter(":visible").fadeOut();
			output.filter(":eq(" + nr + ")").fadeIn(function() {
				visible_item = nr;	
			});
		}

		var options			= options || {}; 
		var total_items		= tabs.length;
		var visible_item	= options.start_item || 0;

		options.pause_on_hover		= options.pause_on_hover		|| true;
		options.transition_interval	= options.transition_interval	|| 5000;

		output.hide().eq( visible_item ).show();
		tabs.eq( visible_item ).addClass('current');

		tabs.click(function() {
			if ($(this).hasClass('current')) {
				return false;	
			}

			slide( tabs.index( this) );
		});

		if (options.transition_interval > 0) {
			var timer = setInterval(function () {
				slide();
			}, options.transition_interval);

			if (options.pause_on_hover) {
				tabs.mouseenter(function() {
					clearInterval( timer );

				}).mouseleave(function() {
					clearInterval( timer );
					timer = setInterval(function () {
						slide();
					}, options.transition_interval);
				});
			}
		}
	};
})(jQuery);

/* Swap Text & Image */
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
/* Set Menu Active */
function SetMenuActive (menuitem) {
	var activatemenuitem = document.getElementsByName(menuitem);
	activatemenuitem[0].className = "active";
}
function AutomaticallySetMenu() {
    var file_name = document.location.href;
	var end = (file_name.indexOf("?") == -1) ? file_name.length : file_name.indexOf("?");
    var menuitem = file_name.substring(file_name.lastIndexOf("/")+1,file_name.lastIndexOf("."));
	var activatemenuitem = document.getElementsByName(menuitem);
	activatemenuitem[0].className = "active";
}

function redirect(schoolname) {
switch (schoolname)
{
case "ranchoms":
  newlocation='http://' + schoolname + '.org';
  break;
case "sierravistams":
  newlocation='http://' + schoolname + '.org';
  break;
case "southlakems":
  newlocation='http://' + schoolname + '.org';
  break;
case "venadoms":
  newlocation='http://' + schoolname + '.org';
  break;
case "northwoodhigh":
  newlocation='http://' + schoolname + '.org';
  break;
case "woodbridgehigh":
  newlocation='http://' + schoolname + '.org';
  break;
default:
	newlocation='http://iusd.org/' + schoolname;
}
/*
document.write("<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd\">");
document.write("<html xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">");
document.write("<head>");
document.write("<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=iso-8859-1\" \/>");
document.write("<title>Irvine Public School Foundation<\/title>");
document.write("<link rel=\"stylesheet\" type=\"text\/css\" href=\"\/style.css\" \/>");
document.write("<link rel=\"stylesheet\" type=\"text\/css\" href=\"\/style1.css\" \/>");
document.write("<script type=\"text\/javascript\" src=\"http:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.3\/jquery.min.js\"><\/script>");
document.write("<script type=\"text\/javascript\" src=\"\/js\/jquery.featureList-1.0.0.js\"><\/script>");
document.write("");
document.write("<\/head>");
document.write("<body>");
document.write("<div class=\"subpages\">");
document.write("<div class=\"header-wrapper-subpages\">");
document.write("  <a href=\"\/index.html\"><img src=\"\/images\/logo_small.jpg\" style=\"position:absolute; top:35px; padding-right:100px; padding-left:10px;\"><\/a>");
document.write("<\/div>");
document.write("<div class=\"top-menu-subpages\">");
document.write("  <ul>");
document.write("    <li><a href=\"\/index.html\">Home<\/a><\/li>");
document.write("	<li><a href=\"\/Why.shtml\">Why We Need You<\/a><\/li>");
document.write("    <li><a href=\"\/What.shtml\">What We Do<\/a><\/li>");
document.write("    <li><a href=\"\/AboutUs.shtml\">About Us<\/a><\/li>");
document.write("	<li><a href=\"\/Join\/Volunteer.asp\">Join Our Team<\/a><\/li>");
document.write("  <\/ul>");
document.write("  <a href=\"\/Donate.shtml\"><img class=\"donate-btn-subpages\" src=\"\/images\/Donate_Round.png\"><\/a>");
document.write("<\/div>");
document.write("<div class=\"body\" >");
document.write('<h2 style=\"padding-top:100px;padding-left:300px;\">Redirecting to your school\'s home site in a few seconds...<\/h2>');
document.write("<\/div>");
document.write("<div class=\"footer-wrapper-subpages\" ><\/div>");
document.write("<\/div>");
document.write("<script type=\"text\/javascript\">AutomaticallySetMenu()<\/script>");
document.write("<\/body>");
document.write("<\/html>");

setTimeout(newlocation,1000);
*/
window.open (newlocation);
}
