/***********************************************************/
/* TOGGLE CONTENT SELECTION -- News, Events */
/***********************************************************/
function ManagementToggle(which){
	var divParent = which.parentNode;
	var windows = divParent.getElementsByTagName('div');
	var arrows = divParent.getElementsByTagName('img');
	/*FIND DIV WINDOW*/
	for(var w=0;w<windows.length;w++){
		var window = windows[w];
		var winAttribute = String(window.getAttribute('rel'));
		if (winAttribute.toLowerCase().match("window")){
			window.style.display = (window.style.display == "none") ? "block" : "none";
			
			if(arguments[1] != null){
				window.style.display = (arguments[1].innerHTML.indexOf("Expand All") != -1) ? "block" : "none";

			}
		}
	}
	/*FIND IMG WINDOW*/
	for(var a=0;a<arrows.length;a++){
		var arrow = arrows[a];
		var arrAttribute = String(arrow.getAttribute('rel'));
		if (arrAttribute.toLowerCase().match("arrow")){
			arrow.src = (arrow.src.indexOf("arrowUp.gif") != -1) ? "images/arrowDown.gif" : "images/arrowUp.gif";

			if(arguments[1] != null){
				arrow.src = (arguments[1].innerHTML.indexOf("Expand All") != -1) ? "images/arrowDown.gif" : "images/arrowUp.gif";
			}
		}
	}
	if(arguments[1] != null){
		//arguments[1].innerText = "ddddd";
		arguments[1].innerHTML = (arguments[1].innerHTML.indexOf("Expand All") != -1) ? "<img src='images/arrowDown.gif' border=0 align='absmiddle'> Collapse All" : "<img src='images/arrowUp.gif' border=0 align='absmiddle'> Expand All";
	}
}



//**********************************************************************************
// Toggle Calander Function 
//**********************************************************************************

function toggleCal(div){
	document.getElementById(div).style.display = 'block';

	for(a = 0; a < rightmenu.length; a++)
	{
		if(div != rightmenu[a]){
			document.getElementById(rightmenu[a]).style.display = 'none';
		}
	}			
}

var d = new Date()
var CurrentMonth = d.getMonth();
function SetupCalendar(){
var colLINK = Array(
document.getElementById("spJan"), 
document.getElementById("spFeb"), 
document.getElementById("spMar"), 
document.getElementById("spApr"),
document.getElementById("spMay"),
document.getElementById("spJun"),
document.getElementById("spJul"),
document.getElementById("spAug"),
document.getElementById("spSep"),
document.getElementById("spOct"),
document.getElementById("spNov"),
document.getElementById("spDec") 
) 
	
//LINK COLLECTION
	
var colCALENDAR = Array( 
document.getElementById("divJan"),
document.getElementById("divFeb"),
document.getElementById("divMar"),
document.getElementById("divApr"),
document.getElementById("divMay"),
document.getElementById("divJun"),
document.getElementById("divJul"),
document.getElementById("divAug"),
document.getElementById("divSep"),
document.getElementById("divOct"),
document.getElementById("divNov"),
document.getElementById("divDec") 
) 
	
//LINK COLLECTION

	
	for(var i = 0; i < colLINK.length; i++){
		var objLINK = colLINK[i]; 
		
		//CURSOR LINK
		
		var objLINK_CURRENT = colLINK[CurrentMonth]; 
		
		//CURRENT LINK
		
		
		var objCALENDAR = colCALENDAR[i]; 
		
		//CURSOR CALENDAR
		
		var objCALENDAR_CURRENT = colCALENDAR[CurrentMonth]; 
		
		//CURRENT CALENDAR
		
		
		objLINK.className = "";
		objLINK["ID"] = i;
		objCALENDAR.style.display = 'none';
		objCALENDAR_CURRENT.style.display = 'block';
		if(String(objLINK.getAttribute('enabled')).toLowerCase().match("false")){
			objLINK.className = "disabled";
		
		}
		else{
			if(objLINK_CURRENT.id != objLINK.id){
					objLINK.onmouseover = function(){this.className = "over";}

					objLINK.onmouseout = function(){this.className = "";}
	
					objLINK.onclick = function(){CurrentMonth = this["ID"];SetupCalendar();}
	
				}
					else{
				
						objLINK.onmouseover = function(){}
				
						objLINK.onmouseout = function(){}

				
						objLINK.className = "current";
			
			}
		
		}	
	
	}
}




//*******************************************
//FULLSCREEN POPUP
//*******************************************
function OpenFullWindow(targeturl){
	window.open(targeturl,"","fullscreen")
}


//**********************************************************************************
// Toggle Function for LibiGel page
//**********************************************************************************
var content = new Array('mem00' , 'mem01' , 'mem02' , 'mem03' , 'mem04' , 'mem05', 'mem06', 'mem07', 'mem08');

function toggleThis(div){  document.getElementById(div).style.display = 'block';  for(a = 0; a < content.length; a++)
	{
		if(div != content[a]){
			document.getElementById(content[a]).style.display = 'none';
		}
	}			
}


//**********************************************************************************
// Show or Hide
//**********************************************************************************
function hideThis(div){  
	document.getElementById(div).style.display = 'none';
}
function showThis(div){  
	document.getElementById(div).style.display = 'block';
}


//**********************************************************************************
// TOGGLE DIV DISPLAY STATE FUNCTION
//**********************************************************************************

function toggleSubNav(div){  
	document.getElementById(div).style.display = 'block';
}


//*******************************************
//POP-UP WINDOW
//*******************************************
function OpenBrWindow(theURL,winName,features) {
	Window = window.open(theURL,winName,features);
}


function toggle(which,classN){
	this.className = "In"
}

function checkLength(which){
	document.getElementById("lblCommentLen").innerHTML = "Total Length: " + which.value.length;
	if(which.value.length > which.limit-1) {
		return false;
	}else{
		return true;
	}
}

function Confirmation(str){
	return confirm(str);
}

function StopFlashMovie(flashName)
{
	var flashMovie = document[flashName];
	flashMovie.StopPlay();
}

function PlayFlashMovie(flashName)
{
	var flashMovie = document[flashName];
	flashMovie.Play();
}




//*********************************************************************************
//Browser and platform detection
//*********************************************************************************

var exclude=1;
var agt=navigator.userAgent.toLowerCase();
var win=0;var mac=0;var lin=1;
if(agt.indexOf('win')!=-1){win=1;lin=0;}
if(agt.indexOf('mac')!=-1){mac=1;lin=0;}
var lnx=0;if(lin){lnx=1;}
var ice=0;
var ie=0;var ie4=0;var ie5=0;var ie6=0;var com=0;var dcm;
var op5=0;var op6=0;var op7=0;
var ns4=0;var ns6=0;var ns7=0;var mz7=0;var kde=0;var saf=0;
if(typeof navigator.vendor!="undefined" && navigator.vendor=="KDE"){
	var thisKDE=agt;
	var splitKDE=thisKDE.split("konqueror/");
	var aKDE=splitKDE[1].split("; ");
	var KDEn=parseFloat(aKDE[0]);
	if(KDEn>=2.2){
		kde=1;
		ns6=1;
		exclude=0;
		}
	}
else if(agt.indexOf('webtv')!=-1){exclude=1;}
else if(typeof window.opera!="undefined"){
	exclude=0;
	if(/opera[\/ ][5]/.test(agt)){op5=1;}
	if(/opera[\/ ][6]/.test(agt)){op6=1;}
	if(/opera[\/ ][7-9]/.test(agt)){op7=1;}
	}
else if(typeof document.all!="undefined"&&!kde){
	exclude=0;
	ie=1;
	if(typeof document.getElementById!="undefined"){
		ie5=1;
		if(agt.indexOf("msie 6")!=-1){
			ie6=1;
			dcm=document.compatMode;
			if(dcm!="BackCompat"){com=1;}
			}
		}
	else{ie4=1;}
	}
else if(typeof document.getElementById!="undefined"){
	exclude=0;
	if(agt.indexOf("netscape/6")!=-1||agt.indexOf("netscape6")!=-1){ns6=1;}
	else if(agt.indexOf("netscape/7")!=-1||agt.indexOf("netscape7")!=-1){ns6=1;ns7=1;}
	else if(agt.indexOf("gecko")!=-1){ns6=1;mz7=1;}
	if(agt.indexOf("safari")!=-1 || (typeof document.childNodes!="undefined" && typeof document.all=="undefined" && typeof navigator.taintEnabled=="undefined")){mz7=0;ns6=1;saf=1;}
	}
else if((agt.indexOf('mozilla')!=-1)&&(parseInt(navigator.appVersion)>=4)){
	exclude=0;
	ns4=1;
	if(typeof navigator.mimeTypes['*']=="undefined"){
		exclude=1;
		ns4=0;
		}
	}
if(agt.indexOf('escape')!=-1){exclude=1;ns4=0;}
if(typeof navigator.__ice_version!="undefined"){exclude=1;ie4=0;}




//Different dropdown menu position for mac, win or other
//***********************************************************************

if (mac) {
	document.write('<script language="JavaScript" src="js/slideOutMenusInit1.js"></scr'+'ipt>')
}
else if (win) {
	document.write('<script language="JavaScript" src="js/slideOutMenusInit2.js"></scr'+'ipt>')
}
else if (!mac && !win) {
	document.write('<script language="JavaScript" src="js/slideOutMenusInit1.js"></scr'+'ipt>')
}




//*********************************************************************************
// Form Validation
//*********************************************************************************

var events_Fields = new Array('Zeus');
var events_Errors = new Array('E-mail');

var partners_Fields = new Array('FirstName','LastName','AddressOne','StateProvince','Zip','Zeus');
var partners_Errors = new Array('First Name','Last Name','Address 1','State/Province','Zip Code','E-mail');

function SetWhichForm(num){
	document.vForm.whichForm.value = num;
}

function MainForm() {
	var pass = true;
	var ErrorMessage = "The following fields are required:\n";
	var theArray = null;
	var theErrors = null;
	
	switch(document.vForm.whichForm.value){
		case "0":
			theArray = events_Fields;
			theErrors = events_Errors;
			break;
		case "1":
			theArray = partners_Fields;
			theErrors = partners_Errors;
			break;
	}
	
	for (i = 0;i < theArray.length;i++) {
		var tempobj = eval("document.vForm." + theArray[i]);
		if(tempobj.value == ""){
			ErrorMessage += " - " + theErrors[i] + "\n";
			pass = false;
		}
	}
	if (!pass) {
		alert(ErrorMessage)
		return false;
	}
	else {
		return true;
	}
}
