// JavaScript Document

 var playerStatus = 1;
function SwapImage(name,img) {
eval("document." +name+ ".src='images/" +img+ ".jpg'");
}
function SwapImage2(name,img,x) {
eval("document." +name+ ".src='images/" +img+ ".jpg'" );
	for(i=1;i<=4;i++){
		if(i != x){
			eval("document.bullet" +i+ ".src='images/nav-bullet.jpg'" );
		}
	 }
}

var sliderlength = 8;
var IE, NS, NS6, Opera;
var theAgent;


if ((document.all) || (navigator.appVersion.indexOf("MSIE 4") != -1)) {
	IE = true;
} else if (document.getElementById && !document.all) {
	NS6 = true;
} else if (document.layers) {
	NS = true;
}

theAgent = navigator.userAgent.toLowerCase();
if (theAgent.indexOf("opera") != -1) 
{
	Opera = true;
	IE = false;
	NS6 = true;
	NS = false;
}


function HIGHLIGHTROW(row, color)
{
   if (IE || NS6 || Opera) 
   {
       row.style.backgroundColor = color; 
   }
	
}

function DEHIGHLIGHTROW(row, color)
{
   if (IE || NS6 || Opera) 
   {
       row.style.backgroundColor = color; 
   }
}

function newLocation(adURL){
	     x = adURL + "&player=" + document.formPlayer.player.value;
	   	window.location.href = x;
		}

function detect_browser()
{
var browser_name = navigator.userAgent;

// We have to check for Opera first because
// at the beginning of the userAgent variable
// Opera claims it is MSIE.

if (browser_name.indexOf("Opera")!= -1)
browser_name = "Opera";
else if (browser_name.indexOf("Firefox")!= -1)
browser_name = "Firefox";
else if (browser_name.indexOf("MSIE")!= -1)
browser_name = "MSIE";
else if (browser_name.indexOf("Netscape")!= -1)
browser_name = "Netscape";
else if (browser_name.indexOf("Safari")!= -1)
browser_name = "Safari";

return browser_name;

} // end function detect_browser()


var FlashHelper =
{
	movieIsLoaded : function (theMovie)
	{
		if (typeof(theMovie) != "undefined") return theMovie.PercentLoaded() == 100;
		else return
		false;
  },

	getMovie : function (movieName)
	{
  	if (navigator.appName.indexOf ("Microsoft") !=-1) return window[movieName];
	  else return document[movieName];
	}
};

function niftyplayer(name)
{
	this.obj = FlashHelper.getMovie(name);

	if (!FlashHelper.movieIsLoaded(this.obj)) return;

	this.play = function () {
		this.obj.TCallLabel('/','play');
	};

	this.stop = function () {
		this.obj.TCallLabel('/','stop');
	};

	this.pause = function () {
		this.obj.TCallLabel('/','pause');
	};

	this.playToggle = function () {
		this.obj.TCallLabel('/','playToggle');
	};

	this.reset = function () {
		this.obj.TCallLabel('/','reset');
	};

	this.load = function (url) {
		this.obj.SetVariable('currentSong', url);
		this.obj.TCallLabel('/','load');
	};

	this.loadAndPlay = function (url) {
		this.load(url);
		this.play();
	};

	this.getState = function () {
		var ps = this.obj.GetVariable('playingState');
		var ls = this.obj.GetVariable('loadingState');

		// returns
		//   'empty' if no file is loaded
		//   'loading' if file is loading
		//   'playing' if user has pressed play AND file has loaded
		//   'stopped' if not empty and file is stopped
		//   'paused' if file is paused
		//   'finished' if file has finished playing
		//   'error' if an error occurred
		if (ps == 'playing')
			if (ls == 'loaded') return ps;
			else return ls;

		if (ps == 'stopped')
			if (ls == 'empty') return ls;
			if (ls == 'error') return ls;
			else return ps;

		return ps;

	};

	this.getPlayingState = function () {
		// returns 'playing', 'paused', 'stopped' or 'finished'
		return this.obj.GetVariable('playingState');
	};

	this.getLoadingState = function () {
		// returns 'empty', 'loading', 'loaded' or 'error'
		return this.obj.GetVariable('loadingState');
	};

	this.registerEvent = function (eventName, action) {
		// eventName is a string with one of the following values: onPlay, onStop, onPause, onError, onSongOver, onBufferingComplete, onBufferingStarted
		// action is a string with the javascript code to run.
		//
		// example: niftyplayer('niftyPlayer1').registerEvent('onPlay', 'alert("playing!")');

		this.obj.SetVariable(eventName, action);
	};

	return this;
}
var gPlayerID = 1;

function toggle(DivID,State) // 1 visible, 0 hidden
{

	var obj = document.getElementById(DivID);


    if(document.layers){   //NN4+
        document.layers[DivID].visibility = State ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        obj.style.visibility = State ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[DivID].style.visibility = State ? "visible" : "hidden";
    }
	
	
}



/*
function load(media)
{
var player = document.getElementById('player');

if (detect_browser() == "MSIE" ||
detect_browser() == "Netscape")
{
player.innerHTML = '<object id="sound"'
+ 'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"'
+ 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"'
+ 'standby="Loading Microsoft® Windows® Media Player components..."'
+ 'type="application/x-oleobject" width="1" height="1">'
+ '<param name="url" value="'+media+'">'
+ '<param name="volume" value="100">'
+ '<embed id="sound" type="application/x-mplayer2" src="'+media+'"'
+ 'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"'
+ 'pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"'
+ 'type="application/x-mplayer2"'
+ 'url="'+media+'"'
+ 'volume="100"'
+ 'width="1" height="1">'
+ '<\/embed>'
+ '<\/object>';
}
else // if Safari or Firefox, then load Quicktime controls
{
player.innerHTML = '<OBJECT '
+ 'CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '
+ 'WIDTH="1"HEIGHT="1" ID="sound"'
+ 'style="position:absolute;"'
+ 'CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">'
+ '<PARAM name="SRC" VALUE="'+media+'">'
+ '<PARAM name="AUTOPLAY" VALUE="true">'
+ '<PARAM name="CONTROLLER" VALUE="false">'
+ '<PARAM name="VOLUME" VALUE="100">'
+ '<PARAM name="ENABLEJAVASCRIPT" VALUE="true">'
+ '<PARAM name="TYPE" VALUE="audio/wav">'
+ '<embed classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"'
+ 'name="sound"'
+ 'id="sound"'
+ 'src="'+media+'"'
+ 'pluginspage="http://www.apple.com/quicktime/download/"'
+ 'volume="100"'
+ 'enablejavascript="true" '
+ 'type="audio/wav" '
+ 'height="1" '
+ 'width="1"'
+ 'style="position:absolute;"'
+ 'autostart="true"'
+ '> </embed>'
+ '</OBJECT>';
}

} 
*/// end function load(media) 

/*function showVideo(id){
var style1 = '';
	
	  for(i=1; i<=3; i++){
	    style1 = document.getElementById("player" +i).style;	
		if (i == id){
		style1.display = style1.display="block";
		}
		else{
		style1.display = style1.display="none";
   		}
	}
}
*/
function showVid(id){
frames['video'].location.href = id;
}

function nextClient(z,fName){
	alert("here");
	
   sliderlen = parseFloat(eval("document." + fName +".sliderlen.value"));
	y = eval("document." + fName +".netCounter.value");
	startVal = parseFloat(eval("document." + fName +".startVal.value"));
	var objText = document.getElementById(fName);
	
	if (z == 1 && y < sliderlen  ){
		
		y++;
	
    eval("document." +fName+ ".netCounter.value=" +y);

	  for(i=startVal;i<=sliderlen;i++){
		
		var obj = document.getElementById("Slider" +i).style;
		var objSlide = document.getElementById("Slider" +i);
		
		
			if(i==y){
				
				//obj.style.visibility = "visible" ;
				//Effect.SlideDown(objSlide);
				obj.display = obj.display="block" ;
				objText.innerHTML= eval("document." + fName +".image"+ y +".title");
				
			}
			else{
				obj.display = obj.display="none" ;
				
			}
		}
	}
	else{
		
		
		if (z == 0 && y > startVal){
		  y--;
		 
		   eval("document." +fName+ ".netCounter.value=" +y);
		  
		  for(i=startVal;i<=sliderlen;i++){
			var obj = document.getElementById("Slider" +i).style;
			var objSlide = document.getElementById("Slider" +i);
	
				if(i==y){
					
					obj.display = obj.display="block" ;
					objText.innerHTML= eval("document." + fName +".image"+ y +".title");
					//Effect.SlideDown(objSlide);
				}
				else{
					obj.display = obj.display="none" ;
				}
			}
		}
	
	}
}

function nextLayer(a,id){
			
	for(i=1;i<=6;i++){
		var obj = document.getElementById(a +i);
		if(i==id){
        	obj.style.visibility = "visible" ;
		}
		else{
			obj.style.visibility = "hidden" ;
		}
	}
}

function linkPop(div){

	var style1 = document.getElementById(div).style;	
		if (style1.display == "block"){
			
		style1.display = style1.display="none";
		
		}
		else{
		
		style1.display = style1.display="block";
		
		
		
		
   }
}

function open_win(theURL,winName,features) { 
   
  var mainWin = self;
		if( window.winName == null )      // If the window has never been opened
			winName=window.open(theURL, winName, features);
		else {
		if( window.winName.closed )    // If the window was open but has been closed
			winName=window.open(theURL,  winName, features);
		else                                                                       // The window is already open
			winName.location.href = theURL;
		}
		winName.opener = mainWin;
		winName.focus();
  
}
/************************************************************************************************************
(C) www.dhtmlgoodies.com, November 2005

This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	

Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.

Thank you!

www.dhtmlgoodies.com
Alf Magne Kalleland

************************************************************************************************************/

var dhtmlgoodies_slideSpeed = 10;	// Higher value = faster
var dhtmlgoodies_timer = 10;	// Lower value = faster

var objectIdToSlideDown = false;
var dhtmlgoodies_activeId = false;
var dhtmlgoodies_slideInProgress = false;
function showHideContent(e,inputId)
{
	if(dhtmlgoodies_slideInProgress)return;
	dhtmlgoodies_slideInProgress = true;
	if(!inputId)inputId = this.id;
	inputId = inputId + '';
	var numericId = inputId.replace(/[^0-9]/g,'');
	var answerDiv = document.getElementById('dhtmlgoodies_a' + numericId);

	objectIdToSlideDown = false;
	
	if(!answerDiv.style.display || answerDiv.style.display=='none'){		
		if(dhtmlgoodies_activeId &&  dhtmlgoodies_activeId!=numericId){			
			objectIdToSlideDown = numericId;
			slideContent(dhtmlgoodies_activeId,(dhtmlgoodies_slideSpeed*-1));
		}else{
			
			answerDiv.style.display='block';
			answerDiv.style.visibility = 'visible';
			
			slideContent(numericId,dhtmlgoodies_slideSpeed);
		}
	}else{
		slideContent(numericId,(dhtmlgoodies_slideSpeed*-1));
		dhtmlgoodies_activeId = false;
	}	
}

function slideContent(inputId,direction)
{
	
	var obj =document.getElementById('dhtmlgoodies_a' + inputId);
	var contentObj = document.getElementById('dhtmlgoodies_ac' + inputId);
	height = obj.clientHeight;
	if(height==0)height = obj.offsetHeight;
	height = height + direction;
	rerunFunction = true;
	if(height>contentObj.offsetHeight){
		height = contentObj.offsetHeight;
		rerunFunction = false;
	}
	if(height<=1){
		height = 1;
		rerunFunction = false;
	}

	obj.style.height = height + 'px';
	var topPos = height - contentObj.offsetHeight;
	if(topPos>0)topPos=0;
	contentObj.style.top = topPos + 'px';
	if(rerunFunction){
		setTimeout('slideContent(' + inputId + ',' + direction + ')',dhtmlgoodies_timer);
	}else{
		if(height<=1){
			obj.style.display='none'; 
			if(objectIdToSlideDown && objectIdToSlideDown!=inputId){
				document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.display='block';
				document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.visibility='visible';
				slideContent(objectIdToSlideDown,dhtmlgoodies_slideSpeed);				
			}else{
				dhtmlgoodies_slideInProgress = false;
			}
		}else{
			dhtmlgoodies_activeId = inputId;
			dhtmlgoodies_slideInProgress = false;
		}
	}
}



function initShowHideDivs()
{
	var divs = document.getElementsByTagName('DIV');
	var divCounter = 1;
	for(var no=0;no<divs.length;no++){
		if(divs[no].className=='dhtmlgoodies_question'){
			divs[no].onclick = showHideContent;
			divs[no].id = 'dhtmlgoodies_q'+divCounter;
			var answer = divs[no].nextSibling;
			while(answer && answer.tagName!='DIV'){
				answer = answer.nextSibling;
			}
			answer.id = 'dhtmlgoodies_a'+divCounter;	
			contentDiv = answer.getElementsByTagName('DIV')[0];
			contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px'; 	
			contentDiv.className='dhtmlgoodies_answer_content';
			contentDiv.id = 'dhtmlgoodies_ac' + divCounter;
			answer.style.display='none';
			answer.style.height='1px';
			divCounter++;
		}		
	}	
}
//ajax object.................
var xmlHttp

function getGigs()
{
 /* { if (str.length==0)

  document.getElementById("txtHint").innerHTML="";
  return;
  }*/
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="test-ajax.cfm";
/*url=url+"?q="+str;
url=url+"&sid="+Math.random();*/
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("nextGigs").innerHTML=xmlHttp.responseText;
  Effect.SlideDown('nextGigs');
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

