;
/**
* Written by Rob Schmitt, The Web Developer's Blog
* http://webdeveloper.beforeseven.com/
*/

/**
* The following variables may be adjusted
*/
var active_color = '#000'; // Colour of user provided text
var inactive_color = 'gray'; // Colour of default text

/**
* No need to modify anything below this line
*/
(function($) {
$(document).ready(function() {
  $(".form-item-search-block-form input").css("color", inactive_color);
  var default_values = new Array();
  $(".form-item-search-block-form input").focus(function() {
    if (!default_values[this.id]) {
      default_values[this.id] = this.value;
    }
    if (this.value == default_values[this.id]) {
      this.value = '';
      this.style.color = active_color;
    }
    $(this).blur(function() {
      if (this.value == '') {
        this.style.color = inactive_color;
        this.value = default_values[this.id];
      }
    });
  });
});
})(jQuery);;
jQuery(window).load(function(){

	/* 	Makes the why us sub pages show like that on the menu */
	var identifier = window.location.pathname;

	switch(identifier){
		case '/team/':
		jQuery(".menu-327 a").addClass("active");
		break;
		case "/history/":
		jQuery(".menu-327 a").addClass("active");
		break;
		case "/process/":
		jQuery(".menu-327 a").addClass("active");
		break;
		case "/alliances/":
		jQuery(".menu-327 a").addClass("active");
		break;
	}

	var menu198 = jQuery(".menu-198 > a").hasClass('active');
	var menu327 = jQuery(".menu-327 > a").hasClass('active');
	var menu482 = jQuery(".menu-482 > a").hasClass('active');
	var menu333 = jQuery(".menu-333 > a").hasClass('active');
	var menu503 = jQuery(".menu-503 > a").hasClass('active');
	var menu490 = jQuery(".menu-490 > a").hasClass('active');
	
	if(menu198 == true) {
	    jQuery("#indent").css("display","block");
	    var position = jQuery(".menu-198 > a").load.position();
	    var p = position.left + 39;
	    jQuery("#indent").css("left",p);
	    
	} else if(menu327 == true) {
	    jQuery("#indent").css("display","block");
	    var position = jQuery(".menu-327 > a").position();
	    var p = position.left + 10;
	    jQuery("#indent").css("left",p);
	    
	} else if(menu482 == true) {
	    jQuery("#indent").css("display","block");
	    var position = jQuery(".menu-482 > a").position();
	    var p = position.left + 19;
	    jQuery("#indent").css("left",p);
	    
	} else if(menu333 == true) {
	    jQuery("#indent").css("display","block");
	    var position = jQuery(".menu-333 > a").position();
	    var p = position.left + 29;
	    jQuery("#indent").css("left",p);
	    
	} else if(menu503 == true) {
	    jQuery("#indent").css("display","block");
	    var position = jQuery(".menu-503 > a").position();
	    var p = position.left + 38;
	    jQuery("#indent").css("left",p);
	    
	} else if(menu490 == true) {
	    jQuery("#indent").css("display","block");
	    var position = jQuery(".menu-490 > a").position();
	    var p = position.left + 39;
	    jQuery("#indent").css("left",p);
	} else {
	    jQuery("#indent").css("display","block");
	    var position = jQuery(".menu-198 > a").position();
	    var p = position.left + 39;
	    jQuery("#indent").css("left",p);
	}

});;
/**
* Cornerz 0.6 - Bullet Proof Corners
* Jonah Fox (jonah@parkerfox.co.uk) 2008
* 
* Usage: $('.myclass').curve(options)
* options is a hash with the following parameters. Bracketed is the default
*   radius (10)
*   borderWidth (read from BorderTopWidth or 0)
*   background ("white"). Note that this is not calculated from the HTML as it is expensive
*   borderColor (read from BorderTopColor)
*   corners ("tl br tr bl"). Specify which borders
*   fixIE ("padding") - attmepts to fix IE by incrementing the property by 1 if the outer width/height is odd.

CHANGELIST from  v0.4

0.5 - Now attempts to fix the odd dimension problem in IE 
0.6 - Added semicolons for packing and fixed a problem with odd border width's in IE

*/
    
;(function($){

  if($.browser.msie && document.namespaces["v"] == null) {
    document.namespaces.add("v", "urn:schemas-microsoft-com:vml", "#default#VML");
  }

  $.fn.cornerz = function(options){
    
    function canvasCorner(t,l, r,bw,bc,bg){
	    var sa,ea,cw,sx,sy,x,y, p = 1.57, css="position:absolute;";
	    if(t) 
		    {sa=-p; sy=r; y=0; css+="top:-"+bw+"px;";  }
	    else 
		    {sa=p; sy=0; y=r; css+="bottom:-"+bw+"px;"; }
	    if(l) 
		    {ea=p*2; sx=r; x=0;	css+="left:-"+bw+"px;";}
	    else 
		    {ea=0; sx=0; x=r; css+="right:-"+bw+"px;";	}
		
	    var canvas=$("<canvas width="+r+"px height="+ r +"px style='" + css+"' ></canvas>");
	    var ctx=canvas[0].getContext('2d');
	    ctx.beginPath();
	    ctx.lineWidth=bw*2;	
	    ctx.arc(sx,sy,r,sa,ea,!(t^l));
	    ctx.strokeStyle=bc;
	    ctx.stroke();
	    ctx.lineWidth = 0;
	    ctx.lineTo(x,y);
	    ctx.fillStyle=bg;
	    ctx.fill();
	    return canvas;
    };

    function canvasCorners(corners, r, bw,bc,bg) {
	    var hh = $("<div style='display: inherit' />"); // trying out style='float:left' 
	    $.each(corners.split(" "), function() {
	      hh.append(canvasCorner(this[0]=="t",this[1]=="l", r,bw,bc,bg));
	    });
	    return hh;
    };

    function vmlCurve(r,b,c,m,ml,mt, right_fix) {
        var l = m-ml-right_fix;
        var t = m-mt;
        return "<v:arc filled='False' strokeweight='"+b+"px' strokecolor='"+c+"' startangle='0' endangle='361' style=' top:" + t +"px;left: "+ l + "px;width:" + r+ "px; height:" + r+ "px' />";
    }
    

    function vmlCorners(corners, r, bw, bc, bg, w) {
      var h ="<div style='text-align:left; '>";
      $.each($.trim(corners).split(" "), function() {
        var css,ml=1,mt=1,right_fix=0;
        if(this.charAt(0)=="t") {
          css="top:-"+bw+"px;";
        }
        else {
          css= "bottom:-"+bw+"px;";
          mt=r+1;
        }
        if(this.charAt(1)=="l")
          css+="left:-"+bw+"px;";
        else {
          css +="right:-"+(bw)+"px; "; // odd width gives wrong margin?
           ml=r;
           right_fix = 1;
        }

        h+="<div style='"+css+"; position: absolute; overflow:hidden; width:"+ r +"px; height: " + r + "px;'>";
        h+= "<v:group  style='width:1000px;height:1000px;position:absolute;' coordsize='1000,1000' >";
        h+= vmlCurve(r*3,r+bw,bg, -r/2,ml,mt,right_fix); 
        if(bw>0)
          h+= vmlCurve(r*2-bw,bw,bc, Math.floor(bw/2+0.5),ml,mt,right_fix);
        h+="</v:group>";
        h+= "</div>"; 
      });
      h += "</div>";
      
      return h;
    };

    var settings = {
      corners : "tl tr bl br",
      radius : 10,
      background: "white",
      borderWidth: 0,
      fixIE: true };              
    $.extend(settings, options || {});
    
    var incrementProperty = function(elem, prop, x) {
      var y = parseInt(elem.css(prop), 10) || 0 ;
      elem.css(prop, x+y);
    };
    
    
    return this.each(function() {
      
      var $$ = $(this);
      var r = settings.radius*1.0;
      var bw = (settings.borderWidth || parseInt($$.css("borderTopWidth"), 10) || 0)*1.0;
      var bg = settings.background;
      var bc = settings.borderColor;
      bc = bc || ( bw > 0 ? $$.css("borderTopColor") : bg);
            
      var cs = settings.corners;

      if($.browser.msie) {//need to use innerHTML rather than jQuery
        h = vmlCorners(cs,r,bw,bc,bg, $(this).width() );     
        this.insertAdjacentHTML('beforeEnd', h);
        
      }
      else  //canvasCorners returns a DOM element
        $$.append(canvasCorners(cs,r,bw,bc,bg));
      
      
      if(this.style.position != "absolute")
        this.style.position = "relative";
     
       this.style.zoom = 1; // give it a layout in IE
      
       if($.browser.msie && settings.fixIE) {
          var ow = $$.outerWidth();
          var oh = $$.outerHeight();
          
          if(ow%2 == 1) {
            incrementProperty($$, "padding-right", 1);
            incrementProperty($$, "margin-right", 1);
          }

          if(oh%2 == 1) { 
            incrementProperty($$, "padding-bottom", 1);
            incrementProperty($$, "margin-bottom", 1);
          }
        }
          
      }
      
    );
 
  };
})(jQuery);
;
jQuery(document).ready(function(){

	/* Overlay for video thumbnail links. */
	jQuery('.video-box').prepend('<div class="video_overlay"></div>');

/* 	Accordion */
	jQuery("#accordion").accordion({
		autoHeight: false,
		collapsible: true,
		active: false
	});

	
	/* bottom rounded corners for the footer */
	if (jQuery.browser.msie && jQuery.browser.version.substr(0,1)<9) {
		jQuery('.region-footer').cornerz({
			radius: 20,
			corners: "br bl",
			borderWidth: 2,
			background: "#333",
			borderColor: "white"

		});
		
		jQuery('#center_middle_text_wrap a').cornerz({
			radius: 10,
			corners: "tl tr br bl",
			borderWidth: 2,
			background: "white",
			borderColor: "#666"
		});
		var IE7_PNG_SUFFIX = ".png";
	}
});

;
// IE5.5+ PNG Alpha Fix v2.0 Alpha: Background Tiling Support
// (c) 2008-2009 Angus Turnbull http://www.twinhelix.com

// This is licensed under the GNU LGPL, version 2.1 or later.
// For details, see: http://creativecommons.org/licenses/LGPL/2.1/

var IEPNGFix = window.IEPNGFix || {};

IEPNGFix.tileBG = function(elm, pngSrc, ready) {
	// Params: A reference to a DOM element, the PNG src file pathname, and a
	// hidden "ready-to-run" passed when called back after image preloading.

	var data = this.data[elm.uniqueID],
		elmW = Math.max(elm.clientWidth, elm.scrollWidth),
		elmH = Math.max(elm.clientHeight, elm.scrollHeight),
		bgX = elm.currentStyle.backgroundPositionX,
		bgY = elm.currentStyle.backgroundPositionY,
		bgR = elm.currentStyle.backgroundRepeat;

	// Cache of DIVs created per element, and image preloader/data.
	if (!data.tiles) {
		data.tiles = {
			elm: elm,
			src: '',
			cache: [],
			img: new Image(),
			old: {}
		};
	}
	var tiles = data.tiles,
		pngW = tiles.img.width,
		pngH = tiles.img.height;

	if (pngSrc) {
		if (!ready && pngSrc != tiles.src) {
			// New image? Preload it with a callback to detect dimensions.
			tiles.img.onload = function() {
				this.onload = null;
				IEPNGFix.tileBG(elm, pngSrc, 1);
			};
			return tiles.img.src = pngSrc;
		}
	} else {
		// No image?
		if (tiles.src) ready = 1;
		pngW = pngH = 0;
	}
	tiles.src = pngSrc;

	if (!ready && elmW == tiles.old.w && elmH == tiles.old.h &&
		bgX == tiles.old.x && bgY == tiles.old.y && bgR == tiles.old.r) {
		return;
	}

	// Convert English and percentage positions to pixels.
	var pos = {
			top: '0%',
			left: '0%',
			center: '50%',
			bottom: '100%',
			right: '100%'
		},
		x,
		y,
		pc;
	x = pos[bgX] || bgX;
	y = pos[bgY] || bgY;
	if (pc = x.match(/(\d+)%/)) {
		x = Math.round((elmW - pngW) * (parseInt(pc[1]) / 100));
	}
	if (pc = y.match(/(\d+)%/)) {
		y = Math.round((elmH - pngH) * (parseInt(pc[1]) / 100));
	}
	x = parseInt(x);
	y = parseInt(y);

	// Handle backgroundRepeat.
	var repeatX = { 'repeat': 1, 'repeat-x': 1 }[bgR],
		repeatY = { 'repeat': 1, 'repeat-y': 1 }[bgR];
	if (repeatX) {
		x %= pngW;
		if (x > 0) x -= pngW;
	}
	if (repeatY) {
		y %= pngH;
		if (y > 0) y -= pngH;
	}

	// Go!
	this.hook.enabled = 0;
	if (!({ relative: 1, absolute: 1 }[elm.currentStyle.position])) {
		elm.style.position = 'relative';
	}
	var count = 0,
		xPos,
		maxX = repeatX ? elmW : x + 0.1,
		yPos,
		maxY = repeatY ? elmH : y + 0.1,
		d,
		s,
		isNew;
	if (pngW && pngH) {
		for (xPos = x; xPos < maxX; xPos += pngW) {
			for (yPos = y; yPos < maxY; yPos += pngH) {
				isNew = 0;
				if (!tiles.cache[count]) {
					tiles.cache[count] = document.createElement('div');
					isNew = 1;
				}
				var clipR = Math.max(0, xPos + pngW > elmW ? elmW - xPos : pngW),
					clipB = Math.max(0, yPos + pngH > elmH ? elmH - yPos : pngH);
				d = tiles.cache[count];
				s = d.style;
				s.behavior = 'none';
				s.left = (xPos - parseInt(elm.currentStyle.paddingLeft)) + 'px';
				s.top = yPos + 'px';
				s.width = clipR + 'px';
				s.height = clipB + 'px';
				s.clip = 'rect(' +
					(yPos < 0 ? 0 - yPos : 0) + 'px,' +
					clipR + 'px,' +
					clipB + 'px,' +
					(xPos < 0 ? 0 - xPos : 0) + 'px)';
				s.display = 'block';
				if (isNew) {
					s.position = 'absolute';
					s.zIndex = -999;
					if (elm.firstChild) {
						elm.insertBefore(d, elm.firstChild);
					} else {
						elm.appendChild(d);
					}
				}
				this.fix(d, pngSrc, 0);
				count++;
			}
		}
	}
	while (count < tiles.cache.length) {
		this.fix(tiles.cache[count], '', 0);
		tiles.cache[count++].style.display = 'none';
	}

	this.hook.enabled = 1;

	// Cache so updates are infrequent.
	tiles.old = {
		w: elmW,
		h: elmH,
		x: bgX,
		y: bgY,
		r: bgR
	};
};


IEPNGFix.update = function() {
	// Update all PNG backgrounds.
	for (var i in IEPNGFix.data) {
		var t = IEPNGFix.data[i].tiles;
		if (t && t.elm && t.src) {
			IEPNGFix.tileBG(t.elm, t.src);
		}
	}
};
IEPNGFix.update.timer = 0;

if (window.attachEvent && !window.opera) {
	window.attachEvent('onresize', function() {
		clearTimeout(IEPNGFix.update.timer);
		IEPNGFix.update.timer = setTimeout(IEPNGFix.update, 100);
	});
}
;
function team_select(num) {
	jQuery(".team_wrap").hide();
	jQuery(".team_highlight").removeClass("team_highlight");
	jQuery(".photo_caption").css("color", "#0A2747");
	jQuery("#team_" + num).show();
	jQuery("#team_slot_" + num + " img").addClass("team_highlight");
	jQuery("#team_slot_" + num + " .photo_caption").css("color", "#DD550C");
}

jQuery(document).ready(function(){
/* 	page load */
	jQuery(".team_wrap").hide();
 	jQuery("#team_1").show();
 	jQuery("#team_slot_1 img").addClass("team_highlight");
 	jQuery("#team_slot_1 .photo_caption").css("color", "#DD550C");
 	
/*  	ie6/7 needed a click after load for jcarousel to work... ie6/7 isnt worth to effort to figure out the problem :P */
	if (jQuery.browser.msie && jQuery.browser.version.substr(0,1)<8) {
	 	setTimeout(
	  	function() {
	    	jQuery('.jcarousel-prev').click();
	  	}, 2500);
	  	setTimeout(
	  	 function() {
	    	jQuery('.jcarousel-next').click();
	  	}, 3500);
	}


	jQuery('#team_slot_1').click(function() {
 		team_select(1);
 	});
 	
	jQuery('#team_slot_2').click(function() {
 		team_select(2);
 	});

	jQuery('#team_slot_3').click(function() {
 		team_select(3);
 	});

	jQuery('#team_slot_4').click(function() {
 		team_select(4);
 	});

	jQuery('#team_slot_5').click(function() {
 		team_select(5);
 	});

	jQuery('#team_slot_6').click(function() {
 		team_select(6);
 	});

	jQuery('#team_slot_7').click(function() {
 		team_select(7);
 	});

	jQuery('#team_slot_8').click(function() {
 		team_select(8);
 	});

	jQuery('#team_slot_9').click(function() {
 		team_select(9);
 	});

	jQuery('#team_slot_10').click(function() {
 		team_select(10);
 	});

	jQuery('#team_slot_11').click(function() {
 		team_select(11);
 	});

	jQuery('#team_slot_12').click(function() {
 		team_select(12);
 	});

	jQuery('#team_slot_13').click(function() {
 		team_select(13);
 	});

	jQuery('#team_slot_14').click(function() {
 		team_select(14);
 	});

	jQuery('#team_slot_15').click(function() {
 		team_select(15);
 	});
 	
 	jQuery('#team_slot_16').click(function() {
 		team_select(16);
 	});
 	
 	jQuery('#team_slot_17').click(function() {
 		team_select(17);
 	});
 	
 	jQuery('#team_slot_18').click(function() {
 		team_select(18);
 	});
 	
 	jQuery('#team_slot_19').click(function() {
 		team_select(19);
 	});
 	
 	jQuery('#team_slot_20').click(function() {
 		team_select(20);
 	});
});

	
;

