var cols;
var sel = new Array;

var editPage="";

function go(formId) {
	form = document.getElementById(formId);
	form.submit();
}

function closePopWin() {
//	hidePopWin(false);
	var actionField = document.getElementById("action");
	var form = actionField.form;
	form.submit();
}

function showEditPage(page) {
	if(editPage!="") {
		var lastPage = document.getElementById("subPage_"+editPage);
		lastPage.style.display = 'none';
	}
	showPage = document.getElementById("subPage_"+page);
	showPage.style.display = '';
	editPage = page;

	var currentPage = document.getElementById("pageName");
	currentPage.value = page;

}

var selectedTracks;
function selectTrack(disc,id) {

	var inputFieldName = "disc_"+disc;
	var imageFieldName = "discimage_"+disc+"_"+id;
	inputField = document.getElementById(inputFieldName);

	var currentValue = inputField.value;
	var re = new RegExp(".*"+id+".*","g");

	r = currentValue.search(re);
	image = document.getElementById(imageFieldName);
	if(r==false) {
		newVal = currentValue.replace(","+id,"");
		inputField.value = newVal; 
		image.src = 'http://development/colville/onedesk/style/sttw/images/tick_box_off.gif';
	} else {
		inputField.value = inputField.value + "," + id;
		image.src = 'http://development/colville/onedesk/style/sttw/images/tick_box_down.gif';
	}

}


function dispSubClass(field,action,urn) {
	var actionField = document.getElementById("action");
	actionField.value = "dispSubClass";
	var subField = document.getElementById("subField");
	subField.value = field;
	var subAction = document.getElementById("subAction");
	subAction.value = action;
	var subUrnField = document.getElementById("subUrn");
	subUrnField.value = urn;
	var form = actionField.form;
	form.submit();
}


function dispSelect(field) {
	var action = document.getElementById("action");
	var subField = document.getElementById("subField");
	action.value = "dispSelect";
	subField.value = field;
	var form = action.form;
	form.submit();
}


function removePick(field,pickUrn) {
	var action = document.getElementById("action");
	var pickField = document.getElementById("pickField");
	var pickUrnField = document.getElementById("pickUrn");
	action.value = "removePick";
	pickField.value = field;
	pickUrnField.value = pickUrn;
	var form = action.form;
	form.submit();
}

function addPick(field,pickUrn) { 
	var docParent = window.frameElement.ownerDocument;
	var action = docParent.getElementById("action");
	var pickField = docParent.getElementById("pickField");
	var pickUrnField = docParent.getElementById("pickUrn");
	action.value = "addPick";
	pickField.value = field;
	pickUrnField.value = pickUrn;
	var form = action.form;
	form.submit();
}

function mObject(){
   if (navigator.appName.indexOf ("Microsoft") !=-1){
    	return window["SingMovie"];
   }else{
    	return document["SingMovie"];
   }
}

function stop() {
   mObject().StopPlay();
}

function play() {
   mObject().Play();
}

function rewind() {
	var play = 0;	

	if(mObject().IsPlaying()){
		play=1;
	}

	mObject().GotoFrame(4);

	if(play==1) {
		mObject().Play();
	}
}

function pause() {
   if(mObject().IsPlaying()){
	    stop();
   }else{
    	play();
   }
}

function submitListForm(formName,listfield) {
	var action = document.getElementById("action_"+formName);
	if(action=="moveTo") {
		var moveTo  = document.getElementById("moveTo_"+formName);
		moveTo.value = listfield.option[listfield.value].id;
	}
	action.value = listfield.value;
	action.form.submit();
}

function submitForm(action,formName) { 
	var actionField = document.getElementById("action_"+formName);
	actionField.value = action;
	actionField.form.submit();
}

function submitForm1(action,formName, itemValue) { 
	var actionField = document.getElementById("action_"+formName);
	var itemField = document.getElementById("pagesize");
	itemField.value = itemValue;
	actionField.value = action;
	actionField.form.submit();
}

function submit(action) { 
	var actionField = document.getElementById("action");
	actionField.value = action;
	form = actionField.form;
	form.submit();
}

function doSubmit(action) { 
	var actionField = document.getElementById("action");
	actionField.value = action;

	form = actionField.form;
	form.submit();
}


var playTrack = false;
function playMP3(trackUrl) {
	if(playTrack) { stopTrack; playTrack=false; return; }
	Player.URL=trackUrl;
	playTrack = true;
}

function stopTrack() {
	Player.controls.stop();
}

function highlightRow(row,on) {
	var cell;
	for(i=0;i<cols;i++) {
		name = "cell"+row+"_"+i;
		cell = document.getElementById(name);
		if(on) {
			if(sel[row]) {
				cell.className="tableDataSelected";
			} else {
				cell.className="tableDataOver";
			}
		} else {
			if(sel[row]) {
				cell.className="tableDataSelected";
			} else {
				if((row%2)==0) {
					end="Even";
				} else {
					end = "Odd";
				}
				cell.className="tableData"+end;
			}
		}
	}
}

function selectRow(row) {
	if(sel[row]) {
		sel[row]=false;
	} else {
		sel[row]=true;
	}
	for(i=0;i<cols;i++) {
		name = "cell"+row+"_"+i;
		cell = document.getElementById(name);
		if(sel[row]) {
			cell.className="tableDataSelected";
		} else {
			if((row%2)==0) {
				end="Even";
			} else {
				end = "Odd";
			}
			cell.className="tableData"+end;
		}
	}
	
}


function showHide(id) {
	var searchBox = document.getElementById(id);
	if(searchBox.style.display=="none") {
		searchBox.style.display="block";
	} else {
		searchBox.style.display="none";
	}
}

function hide(id) {
	var searchBox = document.getElementById(id);
	if(searchBox == undefined) { return; }
	searchBox.style.display="none";
}

function minMax(id,minImg,maxImg) {

	showHide(id);
	var imgId = "img"+id;
	
	var searchBox = document.getElementById(id);
	var img = document.getElementById(imgId);
	if(searchBox.style.display=="none") {
		img.src=maxImg;
	} else {
		img.src=minImg;
	}

}

function updateField(field,value,disp) {
	var searchBox = window.frameElement.ownerDocument.getElementById(field);
	searchBox.value = value;
	var dispBox = window.frameElement.ownerDocument.getElementById("disp_"+field);
	dispBox.value = disp;
	parent.hidePopWin(false);
}

function resizeFrame(width,height) {
//alert(width+":"+height);
	if(width!="same") {
		window.frameElement.style.width = width;
	}
	if(height!="same") {
		window.frameElement.style.height = height;
	}
}


function addTrack(id) {
//	var pickDisp = window.frameElement.ownerDocument.frames["pickDisp"];
	var pickDisp = document.frames["pickDisp"];
	var pickRef = pickDisp.document.getElementById("pickRef");
	pickRef.value = id;
	pickRef.form.submit();

}


function pick_select(id, all) {
	var target = document.getElementById(id+"_selected");
	var source = document.getElementById(id+"_avail");	
	
	var tpos = target.options.length;
	
	
	for(i=0;i<source.options.length;) {
		if(source.options[i].selected || all) {
			target.options[tpos] = new Option(source.options[i].text,source.options[i].value);
			target.options[tpos].selected = true;
			
			tpos++;
		    
			source.options[i] = null;
			i=0;
		} else {
			i++;
		}
	}
	updateSelectHidden(id);
}

function updateSelectHidden(id) {

	var target = document.getElementById(id+"_selected");
	var hidden = document.getElementById(id);
	
	hidden.value = "";
	for(i=0;i<target.options.length;i++) {
		hidden.value = hidden.value + "," +target.options[i].value;
	}

}

function pick_unselect(id, all) {
	var source = document.getElementById(id+"_selected");
	var target = document.getElementById(id+"_avail");	
	
	var tpos = target.options.length;
	
	for(i=0;i<source.options.length;) {
		if(source.options[i].selected || all) {
			target.options[tpos++] = new Option(source.options[i].text,source.options[i].value);
			source.options[i] = null;
			i=0;
		} else {
			i++;
		}
	}
	updateSelectHidden(id);
}

function minimizeWin() 
{
window.resizeTo(100,100);
window.moveTo(screen.width,screen.height);
}

function maximizeWin() 
{
window.resizeTo(screen.width,screen.height);
window.moveTo(0,0);
}

function openWindow(url,name,height,width,xpos,ypos) {
	window.open(url,name,"scrollbars=1,width="+width+",height="+height+",top="+ypos+",left="+xpos);
}

var UniqueID = 314 // Make each link open in a new window 
var newWinOffset = 0 // Position of first pop-up

function PlayerOpen(soundfiledesc,soundfilepath) {
	PlayWin = window.open('',UniqueID,'width=320,height=190,top=' + newWinOffset +',left=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
	PlayWin.focus(); 
	
	var winContent = "<HTML><HEAD><TITLE>" + soundfiledesc + "</TITLE></HEAD><BODY bgcolor='#C7E58B'>"; 
	winContent += "<B style='font-size:18px;font-family:Verdana,sans-serif;line-height:1.5'>" + soundfiledesc + "</B>";

	winContent += "<OBJECT width='300' height='42'>"; 
	winContent += "<param name='SRC' value='" + soundfilepath + "'>";

	winContent += "<param name='AUTOPLAY' VALUE='true'>"; 
	winContent += "<param name='CONTROLLER' VALUE='true'>";
	winContent += "<param name='BGCOLOR' VALUE='#FF9900'>"; 
	winContent += "<EMBED SRC='" + soundfilepath + "' AUTOSTART='TRUE' LOOP='FALSE' WIDTH='300' HEIGHT='42' CONTROLLER='TRUE' BGCOLOR='#C7E58B'></EMBED>";
	winContent += "</OBJECT>"; 
	
	winContent += "<p style='font-size:12px;font-family:Verdana,sans-serif;text-align:center'><a href='" + soundfilepath +"'>Download this file</a> <SPAN style='font-size:10px'>(right-click or Option-click)</SPAN></p>";
	winContent += "<FORM><DIV align='center'><INPUT type='button' value='Close this window' onclick='javascript:window.close();'></DIV></FORM>"; 
	winContent += "</BODY></HTML>"; 
	
	PlayWin.document.write(winContent); 
	PlayWin.document.close(); // "Finalizes" new window 
	UniqueID = UniqueID + 1 // newWinOffset = newWinOffset + 20 // subsequent pop-ups will be this many pixels lower 
} 

function videoPlayerOpen(videofiledesc,videofilepath) {

	PlayWin = window.open('',UniqueID,'width=500,height=400,top=' + newWinOffset +',left=0,resizable=1,scrollbars=1,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
	PlayWin.focus(); 
	
	var winContent = "<HTML><HEAD><TITLE>" + videofiledesc + "</TITLE></HEAD><BODY style='text-align: center; background: #C7E58B'>"; 
	winContent += "<B style='font-size:18px;font-family:Verdana,sans-serif;line-height:1.5'>" + videofiledesc + "</B>";
	
	winContent += "<OBJECT >\n";
	winContent += "<param name='SRC' value='" + videofilepath + "'>\n"
	winContent += "<param name='AUTOPLAY' VALUE='true'>\n"
	winContent += "<param name='CONTROLLER' VALUE='true'>\n"
	winContent += "<param name='BGCOLOR' VALUE='#FF9900'>\n"
	winContent += "<EMBED SRC='" + videofilepath + "' AUTOSTART='TRUE' LOOP='FALSE' CONTROLLER='TRUE' BGCOLOR='#C7E58B'></EMBED>\n"
	winContent += "</OBJECT>\n"

	winContent += "<p style='font-size:12px;font-family:Verdana,sans-serif;text-align:center'><a href='" + videofilepath +"'>Download this file</a> <SPAN style='font-size:10px'>(right-click or Option-click)</SPAN></p>";
	winContent += "<FORM><DIV align='center'><INPUT type='button' value='Close this window' onclick='javascript:window.close();'></DIV></FORM>"; 
	winContent += "</BODY></HTML>"; 
	
	PlayWin.document.write(winContent); 
	PlayWin.document.close(); // "Finalizes" new window 
	UniqueID = UniqueID + 1 // newWinOffset = newWinOffset + 20 // subsequent pop-ups will be this many pixels lower 
} 

function changeActionAndSubmitForm (formName,url) {
	var form = document.getElementById(formName);
	form.action=url; 
	form.submit();
}

function updateFinalAdjustment(input, output, instock, direction) {
	var inputField = document.getElementById(input);
	var outputField = document.getElementById(output);
	
	if (!isNaN(inputField.value)) { 
		if ( inputField.value > 0 ) {		
			if (direction == 'increase') {
				var total = parseInt(instock) + parseInt(inputField.value);
			} else {
				var total = parseInt(instock) - parseInt(inputField.value);
			}
			if (total > 0) {
				outputField.style.color ='black';
			} else {
				outputField.style.color ='red';
			}
		} else {
			var total = "Number must be positive";
			outputField.style.color ='red';	
		}
	} else {
		var total = "Please enter a number";
		outputField.style.color ='red';
	}
	
	outputField.value=total;
	if (outputField.value == 'NaN') { outputField.value = ''; }
}

function printPage() {
    window.print();
}

function embeddedSoundFix() {
	//put this function straight after your embedded sound object
	objects = document.getElementsByTagName('object');
	for (var i = 0; i < objects.length; i++)
	{
		objects[i].outerHTML = objects[i].outerHTML;
	}
}

function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent('on'+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}

function multi_select(id, all) {
	var target = document.getElementById("selected_"+id);
	var source = document.getElementById("avail_"+id);	
	
	var tpos = target.options.length;
	
	
	for(i=0;i<source.options.length;) {
		if(source.options[i].selected || all) {
			target.options[tpos] = new Option(source.options[i].text,source.options[i].value);
			target.options[tpos].selected = true;
			
			tpos++;
		    
			source.options[i] = null;
			i=0;
		} else {
			i++;
		}
	}
	updateMultiSelectHidden(id);
}

function updateMultiSelectHidden(id) {

	var target = document.getElementById("selected_"+id);
	var hidden = document.getElementById(id);
	
	hidden.value = "";
	for(i=0;i<target.options.length;i++) {
		hidden.value = hidden.value + "," +target.options[i].value;
	}

}

function multi_unselect(id, all) {
	var source = document.getElementById("selected_"+id);
	var target = document.getElementById("avail_"+id);	
	
	var tpos = target.options.length;
	
	for(i=0;i<source.options.length;) {
		if(source.options[i].selected || all) {
			target.options[tpos++] = new Option(source.options[i].text,source.options[i].value);
			source.options[i] = null;
			i=0;
		} else {
			i++;
		}
	}
	updateMultiSelectHidden(id);
}


function checkUncheckAll(theElement) {
     var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	  theForm[z].checked = theElement.checked;
	  }
     }
    }


function Set_Cookie( name, value, expires, path, domain, secure ) {
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

function Get_Cookie( name ) {
		
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) &&
	( name != document.cookie.substring( 0, name.length ) ) )
	{
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function rowChangeClass(table,cols,row,classname) {
        for(i=0;i<cols;i++) {
                document.getElementById(table+row+"_"+i).className = classname;
        }
}

function showElement(elemid) {
	elem = document.getElementById(elemid);
	try {
		elem.style.display = "table-row";
	} catch(e) {
		elem.style.display = "block";
	}
}

function hideElement(elemid) {
	elem = document.getElementById(elemid);
	elem.style.display = "none";
}

function Switch(obj) {
		
	var el = obj;
	
	if (el == "popularSonggenreBody")
		el = "popularSonggenreFoot";
	else if (el == "popularSonggenreFoot")
		el = "popularSonggenreBody";
	
if (el == "newMembersgenreBody")
		el = "newMembersgenreFoot";
	else if (el == "newMembersgenreFoot")
		el = "newMembersgenreBody";
	
	if (el == "newRecordingsgenreBody")
		el = "newRecordingsgenreFoot";
	else if (el == "newRecordingsgenreFoot")
		el = "newRecordingsgenreBody";
		
		
	
		
		
	 var elB = document.getElementById(el); 
	 		
    if (elB.style.display == "none") {
    try {
        elB.style.display = "table-row"; 
    }catch(e){
		elB.style.display = "block"; 
  	 } 
  	 
  	 
	if (el == "popularSonggenreBody")
		el = "popularSonggenreFoot";
	else if (el == "popularSonggenreFoot")
		el = "popularSonggenreBody";
              
                
if (el == "newRecordingsgenreBody")
		el = "newRecordingsgenreFoot";
	else if (el == "newRecordingsgenreFoot")
		el = "newRecordingsgenreBody"; 
		
	if (el == "newMembersgenreBody")
		el = "newMembersgenreFoot";
	else if (el == "newMembersgenreFoot")
		el = "newMembersgenreBody";
		
	elB = document.getElementById(el);
	elB.style.display = "none"
		 
    } else {
		elB.style.display = "none";   
    }
}

var MAX_DUMP_DEPTH = 10;

      

       function dumpObj(obj, name, indent, depth) {

              if (depth > MAX_DUMP_DEPTH) {

                     return indent + name + ': <Maximum Depth Reached>\\n';

              }

              if (typeof obj == 'object') {

                     var child = null;

                     var output = indent + name + '\\n';

                     indent += '\\t';

                     for (var item in obj)

                     {

                           try {

                                  child = obj[item];

                           } catch (e) {

                                  child = '<Unable to Evaluate>';

                           }

                           if (typeof child == 'object') {

                                  output += dumpObj(child, item, indent, depth + 1);

                           } else {

                                  output += indent + item + ': ' + child + '\\n';

                           }

                     }

                     return output;

              } else {

                     return obj;

              }

       }

function showHideHelp(helpId) {
	var text = document.getElementById('pageHelpText_'+helpId);
	if(text.style.display == 'block') {
		document.getElementById('pageHelpImage_'+helpId).src = '/style/riders/images/help/help_down.gif';
		text.style.display = 'none';

		var field = 'pageHelp_'+helpId;
		var fieldWidget = document.getElementById(field);
		var scrollHeight = parseInt(text.scrollHeight);
		var height = parseInt(text.style.height.replace('px',''));
		var containerHeight = parseInt(fieldWidget.style.height.replace('px',''));

		var offset = containerHeight + scrollHeight;
		//alert(containerHeight + ':' + scrollHeight + ':' +  height);
	
		fieldWidget.style.overflow = 'hidden';
	
		text.style.overflow = 'hidden';

		expandElement(field, -10, 40, 30)
	} else {
		document.getElementById('pageHelpImage_'+helpId).src = '/style/riders/images/help/help_up.gif';
		text.style.display = 'block';
		
		var field = 'pageHelp_'+helpId;
		var fieldWidget = document.getElementById(field);
		var scrollHeight = parseInt(text.scrollHeight);
		var height = parseInt(text.style.height.replace('px',''));
		var containerHeight = parseInt(fieldWidget.style.height.replace('px',''));

		var offset = containerHeight + scrollHeight;
		//alert(containerHeight + ':' + scrollHeight + ':' +  height);
	
		fieldWidget.style.overflow = 'hidden';
	
		text.style.overflow = 'hidden';

		expandElement(field, 10, 40, offset)
	}			
	//readMore.style.display = 'none';
}

function expandElement(elName, increase, sec, highest) {
	el = document.getElementById(elName);
	el.style.display = 'block';

	el.style.height.replace('px','');
	var tempHeight = parseInt(el.style.height) + parseInt(increase);

	if (tempHeight != highest) {

		x = highest - tempHeight;
		if ( x <= increase ) {
			el.style.height = highest;
		} else {
			el.style.height = tempHeight;
			setTimeout("expandElement('"+elName+"', "+increase+", "+sec+", "+highest+")", sec );
		}
	}

}

function updateStatusBar(str){
	window.status = str ;
    return true ;
}

function OD_debug(output) {
	var el = document.getElementById("debugger");
	el.style.visibility = "visible";
	el.innerHTML = output;
}

// Flash Player Version Detection - Rev 1.5
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.

var requiredMajorVersion = 9;			// Major version of Flash required
var requiredMinorVersion = 0;			// Minor version of Flash required
var requiredRevision = 0;				// Minor revision of Flash required

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;			
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
			var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        // is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function setCalendarYears() {
	scwDropDownYears = 80;
	scwBaseYear = scwDateNow.getFullYear()-scwDropDownYears;
}

// Change the position of the loading div and display the image
function showLoadingImage(e) {
	var loadingDiv = document.getElementById("loading");
/*	var cursorX = 0;
	var cursorY = 0;

	if(isIE) {
		cursorX = e.clientX;
		cursorY = e.clientY;
	} else {
		cursorX = e.pageX;
		cursorY = e.pageY;
	}
	loadingDiv.style.top = cursorY;
	loadingDiv.style.left = cursorX;
*/
	loadingDiv.style.display = "block";
}

function hideLoadingImage() {
	var loadingDiv = document.getElementById("loading");
	loadingDiv.style.display = "none";
}
