
/******************
POP UP WINDOW: AUDIO PLAYER
*******************/
function AudioPlayerWindow(URLStr)
{
			var popUpWin=0;
			var width=350;
			var height=110;
		var left = (screen.width/2) - width/2;
		var top = (screen.height/4) - height/4;
	if(popUpWin)
	{
		if(!popUpWin.closed) popUpWin.close();
	}
	popUpWin = open(URLStr, 'Player', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


/* 
  ================================================
  PVII Uberlink Script
  Copyright (c) 2006 Project Seven Development
  www.projectseven.com
  Version: 1.0.0
*/
function P7_Uberlink(cl,d){
	var i,ob,tA,h=document.location.href;
	if(document.getElementById){
	ob=(d)?document.getElementById(d):document;
	if(ob){
	tA=ob.getElementsByTagName('A');
	for(i=0;i<tA.length;i++){
	if(tA[i].href==h){
	tA[i].className=cl;
}}}}}

// ROLLOVER FUNCTION
function imgSwap(oImg)
{
   var strOver  = "-hover"    // image to be used with mouse over
   var strOff = "-off"     // normal image
   var strImg = oImg.src
   if (strImg.indexOf(strOver) != -1) 
      oImg.src = strImg.replace(strOver,strOff)
   else
      oImg.src = strImg.replace(strOff,strOver)
}

/******************
COLLAPSIBLE / EXPAND
*******************/
function expand(ind)

{
 e = document.getElementById("ex_" + ind);
 if (e.style.display == 'none')
 {
   e.style.display = 'block';
 }
 else if (e.style.display == 'block')
 {
   e.style.display = 'none';
 }
}

function expandAll(ID_root) {
	var elems = document.getElementsByTagName("*");
	for (var i=0; i<elems.length; i++) {
		if (elems[i].id.indexOf(ID_root) == 0) {
			if (elems[i].id.indexOf(ID_root + "0") == 0) {
				elems[i].href = "javascript:contractAll('ex_')";
				elems[i].innerHTML = "Contract All";
			} else elems[i].style.display = "block";
		}
	}
}

function contractAll(ID_root) {
	var elems = document.getElementsByTagName("*");
	for (var i=0; i<elems.length; i++) {
		if (elems[i].id.indexOf(ID_root) == 0) {
			if (elems[i].id.indexOf(ID_root + "0") == 0) {
				elems[i].href = "javascript:expandAll('ex_')";
				elems[i].innerHTML = "Expand All";
			} else elems[i].style.display = "none";
		}
	}
}
//collapsible / expand ends


/******************
JQUERY FUNCTIONS
*******************/

// initilization logic for JQuery functions
$(document).ready(function(){

	// MENU SYSTEM
	// BEGIN Breadcrumb Logic
	var markerFound = false;
	
	if ($(".mg_menu .marker").parent().hasClass("parent") == false)
	{
		if ($(".bc_here").length > 0)
			$("#bc_holder").html($("#bc_holder").html() + "<a href='" + $(".mg_menu .marker").attr("href") + "'>" + $(".mg_menu  .marker").html() + "</a> &raquo; ");
		else
			$("#bc_holder").html("<span class='bc_selected'>" + $(".mg_menu  .marker").html() + "</span>");
			
		markerFound = true;
	}
	
	var first = true;
	var curmb;
	$(".mg_menu .marker").parents("LI.parent").each(function(){
	
		if (first != true) 
			crumb = "<a href='" + $(this).children("a").attr("href") + "'>" + $(this).children("a").html() + "</a> &raquo; ";
		else
		{
			if ($(".bc_here").length > 0 || markerFound == true)
				crumb = "<a href='" + $(this).children("a").attr("href") + "'>" + $(this).children("a").html() + "</a>  &raquo; ";
			else
				crumb = "<span class='bc_selected'>" + $(this).children("a").html() + "</span>";
		}
		
		$("#bc_holder").html(crumb + $("#bc_holder").html() );

		first = false;
	});	
	
	if ($(".bc_here").length == 1) 
	{
		$("#bc_holder").html($("#bc_holder").html() + " <span class='bc_selected'>" + $(".bc_here").html() + "</span>");
	}
	
	if ($(".mg_menu .marker").html() == "Home" || $(".mg_menu .marker").html() == undefined) 
		$("#breadcrumb").hide(); //  hide breadcrumb if on homepage
		
	// END Breadcrumb Logic
	
	
	// MENU ONE
	$("#menuOne .marker").parents("LI").addClass("show");
	
	// MENU TWO
	$("#menuTwo .marker").parents("LI").addClass("show");
	
	// MENU THREE
	$("#menuThree .marker").parents("LI").addClass("show");
	$("#menuThree LI UL").remove();
	
	P7_Uberlink('marker','');

	// MENU SYSTEM ENDS
	
	// FADE ON THUMBNAILS WITH CLASS ".fade"

		$(".fade").fadeTo("fast", 1.0); // This sets the opacity of the thumbs to fade down to 60% when the page loads
		
		$(".fade").hover(function(){
		$(this).fadeTo("fast", 0.8); // This should set the opacity to 100% on hover
		},function(){
		$(this).fadeTo("fast", 1.0); // This should set the opacity back to 60% on mouseout
		});
		
	// FADE ENDS

  });	

