// JavaScript Document

//** Tab Content script-  Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Last updated: June 29th, 06

var enabletabpersistence=1 //enable tab persistence via session only cookies, so selected tab is remembered?

////NO NEED TO EDIT BELOW////////////////////////
var tabcontentIDs=new Object()

function expandcontent(linkobj){
var ulid=linkobj.parentNode.parentNode.id //id of UL element
var ullist=document.getElementById(ulid).getElementsByTagName("li") //get list of LIs corresponding to the tab contents
for (var i=0; i<ullist.length; i++){
ullist[i].className=""  //deselect all tabs
if (typeof tabcontentIDs[ulid][i]!="undefined") //if tab content within this array index exists (exception: More tabs than there are tab contents)
document.getElementById(tabcontentIDs[ulid][i]).style.display="none" //hide all tab contents
}
linkobj.parentNode.className="selected"  //highlight currently clicked on tab
document.getElementById(linkobj.getAttribute("rel")).style.display="block" //expand corresponding tab content
saveselectedtabcontentid(ulid, linkobj.getAttribute("rel"))
}

function savetabcontentids(ulid, relattribute){// save ids of tab content divs
if (typeof tabcontentIDs[ulid]=="undefined") //if this array doesn't exist yet
tabcontentIDs[ulid]=new Array()
tabcontentIDs[ulid][tabcontentIDs[ulid].length]=relattribute
}

function saveselectedtabcontentid(ulid, selectedtabid){ //set id of clicked on tab as selected tab id & enter into cookie
if (enabletabpersistence==1) //if persistence feature turned on
setCookie(ulid, selectedtabid)
}

function getullistlinkbyId(ulid, tabcontentid){ //returns a tab link based on the ID of the associated tab content
var ullist=document.getElementById(ulid).getElementsByTagName("li")
for (var i=0; i<ullist.length; i++){
if (ullist[i].getElementsByTagName("a")[0].getAttribute("rel")==tabcontentid){
return ullist[i].getElementsByTagName("a")[0]
break
}
}
}

function initializetabcontent(){
for (var i=0; i<arguments.length; i++){ //loop through passed UL ids
if (enabletabpersistence==0 && getCookie(arguments[i])!="") //clean up cookie if persist=off
setCookie(arguments[i], "")
var clickedontab=getCookie(arguments[i]) //retrieve ID of last clicked on tab from cookie, if any
var ulobj=document.getElementById(arguments[i])
var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL
for (var x=0; x<ulist.length; x++){ //loop through each LI element
var ulistlink=ulist[x].getElementsByTagName("a")[0]
if (ulistlink.getAttribute("rel")){
savetabcontentids(arguments[i], ulistlink.getAttribute("rel")) //save id of each tab content as loop runs
ulistlink.onclick=function(){
expandcontent(this)
return false
}
if (ulist[x].className=="selected" && clickedontab=="") //if a tab is set to be selected by default
expandcontent(ulistlink) //auto load currenly selected tab content
}
} //end inner for loop
if (clickedontab!=""){ //if a tab has been previously clicked on per the cookie value
var culistlink=getullistlinkbyId(arguments[i], clickedontab)
if (typeof culistlink!="undefined") //if match found between tabcontent id and rel attribute value
expandcontent(culistlink) //auto load currenly selected tab content
else //else if no match found between tabcontent id and rel attribute value (cookie mis-association)
expandcontent(ulist[0].getElementsByTagName("a")[0]) //just auto load first tab instead
}
} //end outer for loop
}


function getCookie(Name){ 
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return ""
}

function setCookie(name, value){
document.cookie = name+"="+value //cookie value is domain wide (path=/)
}

function showPLayer(link, movie)
{



	var height = 45;
	if (movie)
			height = 200;
	var WMP7;
	if (navigator.userAgent.indexOf("MSIE")>=0)
	{
			//IE
			if (location.href.indexOf("playlist")>=0)
					width = 310;
			else
					width = 385;
	}
	else
	{
			//Other
			width = 385;
	}
	try
	{
			if ( navigator.appName != "Netscape" )
			{
					WMP7 = new ActiveXObject('WMPlayer.OCX');
			}
	}
	catch (error)
	{
			;
	}
   var HTML = '';





	// Windows Media Player 7 Code
	if ( WMP7 )
	{

	HTML +=  ('<OBJECT id=PlayerS height="'+height+'" width="100%" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" VIEWASTEXT>');
	//HTML +=  ('<PARAM NAME="URL" VALUE="'+link+'">');
	HTML +=  ('<PARAM NAME="URL" VALUE="'+link+'">');
	HTML +=  ('<PARAM NAME="rate" VALUE="1">');
	HTML +=  ('<PARAM NAME="balance" VALUE="0">');
	HTML +=  ('<PARAM NAME="currentPosition" VALUE="0">');
	HTML +=  ('<PARAM NAME="defaultFrame" VALUE="">');
	HTML +=  ('<PARAM NAME="playCount" VALUE="999">');
	HTML +=  ('<PARAM NAME="autoStart" VALUE="1">');
	HTML +=  ('<PARAM NAME="currentMarker" VALUE="0">');
	HTML +=  ('<PARAM NAME="invokeURLs" VALUE="-1">');
	HTML +=  ('<PARAM NAME="baseURL" VALUE="">');
	HTML +=  ('<PARAM NAME="mute" VALUE="0">');
	HTML +=  ('<PARAM NAME="uiMode" VALUE="full">');
	HTML +=  ('<PARAM NAME="stretchToFit" VALUE="0">');
	HTML +=  ('<PARAM NAME="windowlessVideo" VALUE="1">');
	HTML +=  ('<PARAM NAME="enabled" VALUE="-1">');
	HTML +=  ('<PARAM NAME="enableContextMenu" VALUE="0">');
	HTML +=  ('<PARAM NAME="fullScreen" VALUE="0">');
	HTML +=  ('<PARAM NAME="SAMIStyle" VALUE="">');
	HTML +=  ('<PARAM NAME="SAMILang" VALUE="">');
	HTML +=  ('<PARAM NAME="SAMIFilename" VALUE="">');
	HTML +=  ('<PARAM NAME="captioningID" VALUE="">');
	HTML +=  ('<PARAM NAME="Volume" VALUE="100">');
	HTML +=  ('</OBJECT>');

	}

	// Windows Media Player 6.4 Code
	else
	{
	//alert(link);

	/*
	HTML +=  ('<OBJECT id="WMPlayer" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ');
	HTML +=  ('codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" ');
	HTML +=  ('width="'+width+'" height="'+height+'"');
	HTML +=  ('standby="Loading Microsoft Windows Media Player components..." ');
	HTML +=  ('type="application/x-oleobject" VIEWASTEXT> ');
	HTML +=  ('<PARAM NAME="FileName"           VALUE="'+link+'">');
	HTML +=  ('<PARAM NAME="TransparentAtStart" Value="false">');
	HTML +=  ('<PARAM NAME="AutoStart"          Value="true">');
	HTML +=  ('<PARAM NAME="AnimationatStart"   Value="false">');
	HTML +=  ('<PARAM NAME="ShowControls"       Value="false">');
	HTML +=  ('<PARAM NAME="ShowDisplay"         value ="false">');
	HTML +=  ('<PARAM NAME="playCount" VALUE="999">');
	HTML +=  ('<PARAM NAME="displaySize"          Value="0">');
	HTML +=  ('<PARAM NAME="Volume" VALUE="100">');
	HTML +=  ('<param name="enableContextMenu" value="0">');

	HTML +=  ('<Embed type="application/x-mplayer2" ');
	HTML +=  ('pluginspage= ');
	HTML +=  ('"http://www.microsoft.com/Windows/MediaPlayer/" ');
	HTML +=  ('src="playnotie.php?url=' + link + '"');
	HTML +=  ('Name=MediaPlayer ');
	HTML +=  ('transparentAtStart=0 ');
	HTML +=  ('autostart=1 ');
	HTML +=  ('playcount=999 ');
	HTML +=  ('volume=100');
	HTML +=  ('animationAtStart=0 ');
	HTML +=  ('width="100%" height="'+height+'"');
	HTML +=  ('displaySize=0></embed> ');
	HTML +=  ('</OBJECT> ');

	*/


  // Windows Media 10



   HTML +=  ('<OBJECT   ID="PlayerS" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" WIDTH=370 HEIGHT=45>');
   HTML +=  ('<PARAM NAME="AutoStart" VALUE="True" >');
   HTML +=  ('<PARAM NAME="URL" VALUE="'+ link +'">');
   HTML +=  ('<!-- Turn off the controls -->');
   HTML +=  ('<PARAM NAME="uiMode" VALUE="full">');
   HTML +=  ('<PARAM NAME="wmode" VALUE="transparent">')
   HTML +=  ('<EMBED TYPE="application/x-mplayer2"');
   HTML +=  ('SRC="'+ link +'"');
   HTML +=  ('transparent=0');
   HTML +=  ('NAME="Player"');
   HTML +=  ('VOLUME="100"');
   HTML +=  ('WIDTH="370"');
   HTML +=  ('HEIGHT="45"');
   HTML +=  ('AUTOSTART="1"');
   HTML +=  ('SHOWCONTROLS="false">');
   HTML +=  ('</EMBED>');
   HTML +=  ('</OBJECT>');


	}
	return HTML;
}
