/*
 * show/hide content
 */
var menuAction = new Array();
function doNothing() { return; }
function menuOver(id_sub, selected, id, src){
	if (selected==1) highlight(id, src); 
	this.menuAction[id_sub] = false;
	divAppear(id_sub);
}

function menuOut(id_sub, selected, id, src){
	//if (selected==1) highlight(id, src); 
	this.menuAction[id_sub] = true;
	setTimeout("this.menuAction['"+id_sub+"']?divFade('"+id_sub+"', "+selected+", '"+id+"', '"+src+"'):doNothing();", 100);
}
function divAppear(id){
        //new Effect.Appear(document.getElementById(id), { duration: 0.2 });
        document.getElementById(id).style.display="block";
}
function divFade(id_sub, selected, id, src){
	//if (selected==1) highlight(id, src);
        document.getElementById(id_sub).style.display="none";
	//new Effect.Fade(document.getElementById(id_sub), { duration: 0 });
	if (selected==1) highlight(id, src);
}
// Pass the string as 's'.
// Pass 1 for 'v' if you want
// to strip a leading space,
// 2 for a trailing space
// and 3 for all spaces.
function stripWhitespace (s, v)
{

 var i;
 var returnstring = '';
 var tdone = 0;
 var lastd;
 if (v == null) v = 3;
 
   if (v == 1) {
   
     for (i = 0; i < s.length; i++)
     {   
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) tdone = 1;
        if (tdone == 1 || i == s.length) returnstring +=c;  
		
     }
   }  
   if (v == 2) {
     for (i = s.length; i > -1; i--)
     {
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) tdone = 1;
        if (tdone == 1) 
        {
        lastd = i;
        i = -1;
		}
	 }
	 for (x = 0; x <= lastd; x++)
        {
           var ch = s.charAt(x);
           returnstring +=ch	
        }   
     } 
   if (v == 3) {
     for (i = 0; i < s.length; i++)
     {
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) returnstring +=c;
 
     }
   } 
  
  return returnstring;
   
 }

/**********************************
** Function to read a cookie. Just
** give it the name of the cookie
** and it will return the value
** as a string.
**********************************/
function readCookie(name)
{
	var cookieStr		= document.cookie;
	var cookieStr		= unescape(cookieStr);
	var cookiePieces	= cookieStr.split(";");
	var tempCookiePair
	var tempCookiePairPieces
	var cookieVals = new Array();
	var tempName
	var tempVal


	var myCookieVal = "";

	for(i=0;i<cookiePieces.length;i++)
	{
		tempCookiePair			= cookiePieces[i];
		tempCookiePairPieces	= tempCookiePair.split("=");

		
		tempName	= tempCookiePairPieces[0];
		tempName = stripWhitespace(tempName, 1);
		tempName = stripWhitespace(tempName, 2);
		tempVal	= tempCookiePairPieces[1];
		cookieVals[tempName] = tempVal;

	}

	
		if(cookieVals[name])
		{
			myCookieVal = cookieVals[name];
		}

		return myCookieVal;
	
}

/*****************************************
** stuff involved in popping the new name
** and split screen windows
*****************************************/
/**
 * Standard method for opening a full window
 **/
function openFullWindow(url){
	window.open(url, '', '');
}

function popsplitwin() 
{
	if(window.location.href.indexOf('evoke.com') != -1 && readCookie("whichsite") != "raindance") 
	{
			window.open('/rndc/split.jsp','mywindow','width=326,height=297');
	}
}

function checkId() {
	var id = document.getElementById("confid").value;
	var o = /^[0-9]+$/;
	if ((id.length != 10) && (id.length != 7)) {
		alert("Your conference ID must be 7 or 10 digits.");
		return false;
	}
	if (o.test(id) == false) {
		alert("Conference ID's must contain only numbers.");
		return false;
	} else {
		return true;
	}
}

function isWindows() {
		var userAgent = navigator.userAgent.toLowerCase();
		if (userAgent.indexOf('windows') > 0) {
			// we are on windows
			return true;
		} else {
			return false;
		}
}

function osClientSelect() {
		if (isWindows()) {
			//
		} else {
			// dim the thick client
			document.getElementById("thickButton").disabled = true;
			document.getElementById("thinButton").checked = true;
			document.getElementById("preferThinClient").value = 'true';
		}
}
