/**********************************************
 LMCore.js
 Basic ActiveCampus JavaScript functions including
    imageswapper, popup, external site frame, and quicklinks
 Author:  M. Dempster 3//01
 Copyright:  LiquidMatrix Corp.
**********************************************/

/**********************************************
 Browser control variables  
 These variables determine which browser is being used
**********************************************/ 
var isNav = (document.layers) ? true:false				//Layers compliant browser (Netscape 4.x)
var isIE = (document.all) ? true:false				//IE4/5 compliant browser 
var isDOM = (document.getElementById) ? true:false	   	//DOM Compliant browser (NS6, Opera 5)
var isOther = (!isNav&&!isDOM&&!isIE) ? true:false				//Other browser (NS3, Lynx)

/**********************************************
 Global Variables  
 Variables used in ALL pages, or by multiple JS functions
**********************************************/ 
var preloadFlag = false 								//Determines if images for swapping in page are loaded

/**********************************************
 newImage(stringexp)    
 arg:  
 	use:  Required
	Datatype:  String
	A valid string expression (An image filename, with path)
 Return:  JS image object
 Description:  Creates an image object containing the file found at arg
**********************************************/ 
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

/**********************************************
 changeImages([stringexp, (obj2|str2)])    
 Return:  Nothing
 Description:   Replaces image found at reference stringexp with specified image obj2 or str2.  Image may
 				may be pulled from an Image Object (eg: Imageobj.src) or a string (eg: "/images/x.gif").
 Tips:  You may use any number of argument pairs to swap multiple images at the same time.  Arguments MUST be 
  		paired;  args not paired will result in an error.
**********************************************/ 
function changeImages() {
  	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

/**********************************************
 jumpto(formobj, stringexp)
 form:  
 	use:  Required
	Datatype:  JS Form Obj
	A valid reference to a form object on the page.
 name:  
 	use:  Required
	Datatype:  String
	A valid reference to a select control.    
 Return:  Nothing
 Description:   Takes the value of the selected item in selector name, and forwards browser to that value.  
 				During the forward process, it resets the selector to default (index=0)
 Tips:  Normally, form is passed this.form, which is a generic reference to the form enclosing name
**********************************************/ 
function jumpto(form, name) {
	var myindex= eval('form.'+ name + '.selectedIndex');			//Gets index of user selection in Stringexp
    var myval=eval('form.' + name + '.options[myindex].value');		//Gets value at myindex
    eval('form.'+ name + '.selectedIndex = 0');						//Resets selected index to 0 (default)
	if (myval != "") {
        
	     location.href=myval;									//If value is local, send this window to new page.
    }
}


/**********************************************
NUEDIT new function for quilinks to open them in a new window gigidy
**********************************************/

function NUquicklink(form, name) {
var myindex= eval('form.'+ name + '.selectedIndex');
var myval=eval('form.' + name + '.options[myindex].value');
eval('form.'+ name + '.selectedIndex = 0');
window.open(myval)
}




/**********************************************
 popup(stringexp, stringexp, integer, integer, stringexp, stringexp, )
 Note:  All vars are type STring and are required
 URL:  Valid URL of a webpage (determines page to be shown in new window)
 Name: String (determines name of new window)
 wwidth: Integer (determines width of new window)
 wheight: Integer (determined height of new window)
 wresize: 0 or 1 (determines if window can be resized or not)
 wscrolls:  yes or no (determines if scrollbars will be created on window)
 Return:  Nothing
 Description:   Pops open new window with parameters specified above.
**********************************************/ 
function popup(url, name, wwidth, wheight, wresize, wscrolls){
    eval("window.open('" + url + "','" + name + "','toolbar=no,menubar=no,address=no,status=no,dependent=no,resizable=" + wresize + ",scrollbars=" + wscrolls + ",height=" + wheight + ",width=" + wwidth + "')");
}


/**********************************************
 external(stringexp)
 url:  
 	use:  Required
	Datatype: String
	A valid reference to a web site address   
 Return:  Nothing
 Description:   Takes the value of URL, and creates a new window containing the External site frame, which displays the address specified
**********************************************/ 
function external(url){
    eval("window.open('/external.asp?URL=" + escape(url) + "','ACEXT','toolbar=yes,menubar=yes,address=yes,status=yes,dependent=no,resizable=1,height=540,width=760')");
}


/**********************************************
 autojump(formobj,formobj,stringexp,integer)
 formname:    
 	use:  Required
	Datatype: JS Form Object
	A valid reference to a form  
 thisfield:    
 	use:  Required
	Datatype: JS Form Control object
	A valid reference to a form control contained within formname
 fieldname:    
 	use:  Required
	Datatype: String
	A valid reference to a name of form control within formname  
 maxlen:    
 	use:  Required
	Datatype: Integer    
 Return:  Nothing
 Description:   On keypress in thisfield, tests to see if the length of the data entered is longer than maxlen.
 				If so, switch focus to fieldname.
 Tips:  Normally, formname and thisfield are passed "this.form" and "this" respectively, referencing the currently selected control and form.
**********************************************/ 
function autojump(formname, thisfield, fieldname, maxlen) {
	maxlen = (isNav) ? maxlen - 1:maxlen						//If NS4.0, length needs to be truncated by 1
	if (thisfield.value.length >= maxlen) {						//On keypress, if value is longer than maxlen
		formname.elements[fieldname].focus();					//Focus on fieldname
	}
}

/*************************
TODO LIST FUINCTIONS
***************************/
function openList() {
	setElementVisibility('todoOpen', 'visible');
	if (navigator.appVersion.indexOf('Mac') != -1) {
		top.todoList.bodyheight();
	} 
}
function createReference(Element) {
	if (isDOM && !isIE) {
		oRef = eval("document.getElementById('" + Element + "').style")
	} else if (isNav) {
		oRef = eval("document.layers['" + Element + "']")
	} else {
		oRef = eval("document.all." + Element + ".style")
	}
	return oRef
}

function setElementVisibility(Element, state) {
	oElement = createReference(Element)
	if (state.toLowerCase() == 'visible'){
		document.getElementById(Element).className = 'displayOnPage';
	}
	oElement.visibility = state.toLowerCase(); 
}


function getElementVisibility(Element, state) {
	oElement = createReference(Element)
	elementVis = oElement.visibility;
	return elementVis
}

function adjustIFrameSize (iframeWindow) {
  if (iframeWindow.document.height) {
	var iframeElement = parent.document.getElementById(iframeWindow.name);
	iframeElement.style.height = (iframeWindow.document.height) + 'px';
	iframeElement.style.width = iframeWindow.document.width + 'px';
  }
  else if (document.all) {
	var iframeElement = parent.document.all[iframeWindow.name];
	if (iframeWindow.document.compatMode &&  iframeWindow.document.compatMode != 'BackCompat') 
	{
	  iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 'px';
	  iframeElement.style.width = iframeWindow.document.documentElement.scrollWidth + 'px';
	}
	else {
	  iframeElement.style.height = iframeWindow.document.body.scrollHeight +  'px';
	  iframeElement.style.width = iframeWindow.document.body.scrollWidth + 'px';
	}
  }
}

function bodyheight () {
			x = document.body.offsetHeight
			parent.document.getElementById("todoList").style.height = x + 'px'
}

function setup() {
	if (navigator.appVersion.indexOf('Mac') == -1) {
		if (parent.adjustIFrameSize) parent.adjustIFrameSize(window);
	}
}
function setElementClass() {
    for (var i=0; i<setElementClass.arguments.length; i+=2) {
		if (top.isIE) { 
			eval('document.all.' + setElementClass.arguments[i] + '.className = "' + setElementClass.arguments[i+1] + '"'); 
		} else if (top.isDOM) {
			eval('document.getElementById(\'' + setElementClass.arguments[i] + '\').className = "' + setElementClass.arguments[i+1] + '"'); 
		}
	}
}


/* Special  ONly function to generate open/close effect on aud paths, left sidebar, subpages. */
function toggle(el) {
	for(ii=0; ii<el.parentNode.childNodes.length; ii++)
	{
		if (el.parentNode.childNodes[ii].tagName == "UL") 
		{
			if (el.parentNode.childNodes[ii].style.display == "none" || el.parentNode.childNodes[ii].style.display == "" ) {
				el.parentNode.childNodes[ii].style.display = "block"
				el.className = "opened"
			} else {
				el.parentNode.childNodes[ii].style.display = "none"
				el.className = "closed"
			}
		}
	}
}



/******************************************/
/*                NU EDIT                 */
/******************************************/
function NUalternate(id){ 
 if(document.getElementsByTagName && document.getElementById(id)){  
   var table = document.getElementById(id);   
   var rows = table.getElementsByTagName("tr");   
   for(i = 0; i < rows.length; i++){           
     if(i % 2 == 0){ 
       rows[i].className = "even"; 
     }else{ 
       rows[i].className = "odd"; 
     }       
   } 
 } 
}    

function NUsitesearch(campus) {
var nuurl;
nuurl = "/lp/search.aspx?nu=true&searchTxt=" + document.getElementById('searchBox').value + "&pageUrl=" + campus + "&searchMatch=any";
window.location=nuurl; 
}



/* SITE MAP EXPANDER */
function NUexpandList(pid) {
		if (document.getElementById('u'+pid).style.display == "none") {
			document.getElementById('u'+pid).style.display = "block";
			document.getElementById('pid'+pid).alt = "reduce";
			document.getElementById('pid'+pid).title = "Click to reduce!";
			document.getElementById('pid'+pid).src = "/images/sitewide/smupH.gif";
		} else {
			document.getElementById('u'+pid).style.display = "none";
			document.getElementById('pid'+pid).alt = "expand";
			document.getElementById('pid'+pid).title = "Click to expand!";
			document.getElementById('pid'+pid).src = "/images/sitewide/smdwnH.gif";
		}		
	}

function SMhover(t,pid) {
	if (t == 'in') {
		if (document.getElementById('u'+pid).style.display == "none") {
			document.getElementById('pid'+pid).src = "/images/sitewide/smdwnH.gif";
		} else {
			document.getElementById('pid'+pid).src = "/images/sitewide/smupH.gif";
		}		
	} else {
		if (document.getElementById('u'+pid).style.display == "none") {
			document.getElementById('pid'+pid).src = "/images/sitewide/smdwn.gif";
		} else {
			document.getElementById('pid'+pid).src = "/images/sitewide/smup.gif";
		}
	}
}
function NUOpenWindow(URL) {
	window.open(URL, 'NUWindow', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=yes,width=600,height=300,left = 100,top = 100');
	}


/* This fuction is used by page 1 of the online application 
it is called in the onsubmit command of the form tag to take
the 4 phone number box and put them into a hidden single field
used by the LM COM object*/	
function nuphonefixPG1() {
	document.getElementById("PermPhone_Number").value = document.getElementById("PermPhone_NumberAREA").value + document.getElementById("PermPhone_Number3").value + document.getElementById("PermPhone_Number4").value;
	document.getElementById("MailPhone_Number").value = document.getElementById("MailPhone_NumberAREA").value + document.getElementById("MailPhone_Number3").value + document.getElementById("MailPhone_Number4").value;
	document.getElementById("CellPhone_Number").value = document.getElementById("CellPhone_NumberAREA").value + document.getElementById("CellPhone_Number3").value + document.getElementById("CellPhone_Number4").value;
	document.getElementById("OtherPhone_Number").value = document.getElementById("OtherPhone_NumberAREA").value + document.getElementById("OtherPhone_Number3").value + document.getElementById("OtherPhone_Number4").value;
	return true;
}
function nuphonefixPG2() {
	document.getElementById("HS_Phone_Number").value = document.getElementById("HS_Phone_NumberAREA").value + document.getElementById("HS_Phone_Number3").value + document.getElementById("HS_Phone_Number4").value;
	return true;
}
function nuphonefixPG3() {
	document.getElementById("FamEmployerPhone_Number").value = document.getElementById("FamEmployerPhone_NumberAREA").value + document.getElementById("FamEmployerPhone_Number3").value + document.getElementById("FamEmployerPhone_Number4").value;
	document.getElementById("FamPhone_Number").value = document.getElementById("FamPhone_NumberAREA").value + document.getElementById("FamPhone_Number3").value + document.getElementById("FamPhone_Number4").value;
	document.getElementById("FamEmployerPhone_Number2").value = document.getElementById("FamEmployerPhone_NumberAREA2").value + document.getElementById("FamEmployerPhone_Number32").value + document.getElementById("FamEmployerPhone_Number42").value;
	document.getElementById("FamPhone_Number2").value = document.getElementById("FamPhone_NumberAREA2").value + document.getElementById("FamPhone_Number32").value + document.getElementById("FamPhone_Number42").value;
	return true;
}

//NUEDIT to automatically create a list of jump links on a page - code provided by Joe Marini
var g_anchorCount;

function buildBookmarks(strWhichTag, sBookMarkNode)
{
	var i;
	g_anchorCount = 0;
	// create the list that will hold the bookmark links
	var oList = document.createElement("ul");
	oList.setAttribute("id","bookmarksList");
	// now get a list of all the elements on the page that we want to create
	// bookmarks for. Typically these will be <h2>, <h3> tags, etc.
	var aMarkElements = document.getElementsByTagName(strWhichTag);
	// loop through each tag and make a bookmark for it
	for (i=0; i<aMarkElements.length;i++)
	{
		// get the text that is inside the given heading tag
		var sName = aMarkElements[i].firstChild.data;
		// build a named anchor for the location
		var oAnchor = buildNamedAnchor();
		// change the tag to be whatever it was but now fronted by the Anchor tag
		aMarkElements[i].innerHTML = oAnchor + aMarkElements[i].innerHTML;
		// create a LI tag for the bookmark. This will be inserted into our UL that 
		// holds all of the bookmarks.
		var oListItem = document.createElement("li");
		var oLink = document.createElement("a");
		var sLinkDest = "#bookmark" + g_anchorCount;
		oLink.setAttribute("href", sLinkDest);
		// add the <a> tag to the LI
		oListItem.appendChild(oLink);
		var oLinkText = document.createTextNode(sName);
		oLink.appendChild(oLinkText);
		// now add the finished LI to the UL list
		oList.appendChild(oListItem);
		// increase the variable that's keeping track of how many named anchors
		// there are. This ensures that each one gets a unique name.
		g_anchorCount++;
	}
	// when we're finished, add the bookmark list to the end of the container
	// that will hold the bookmarks.
	insertBookmarkList(oList,sBookMarkNode);
}

function buildNamedAnchor()
{
	// create a named anchor of the form <a name='bookmarkX'><a/>
	// where X is an increasing integer number
	return "<a name='bookmark" + g_anchorCount + "'></a>";
}

// Inserts the bookmark list inside the given container tag 
// indicated by sBookmarkNode
function insertBookmarkList(oBookmarkList, sBookmarkNode)
{
	// get the tag to insert the bookmark list into
	var oListHost = document.getElementById(sBookmarkNode);
	// add the bookmark list
	oListHost.appendChild(oBookmarkList);
}

//opens UC interactive map
function ucMap() {
	var sH = screen.availHeight;
	var sW = screen.availWidth;
	window.open('map.aspx','ucmap','scrollbars=no,resizable=yes,height='+sH+',width='+sW+',menubar=no,toolbar=no,titlebar=no');
}
//DOE
function changePicDOE(val){
	document.getElementById('photo').src = val;
}
function toggleDOE(chkd){
	chkd = String(chkd);
	if (chkd == 'true') {
		document.getElementById('doeToggle').innerHTML = 'Yes';
		document.getElementById('people_doe').value = 'Y';
	} else {
		document.getElementById('doeToggle').innerHTML = 'No';
		document.getElementById('people_doe').value = '';
	}
}

////////////////////////////////////////////////////START////////////////////////////////////////////////
///////////////////////////////////////////FLASH VIDEO DETECTION////////////////////////////////////////
var isflashIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isflashWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isflashOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
var requiredMajorVersion = 9;
var requiredMinorVersion = 0;
var requiredRevision = 115;
function ControlVersion(){
	var version;
	var axo;
	var e;
	try{
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	}catch(e){
		
	}
	if(!version){
		try{
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			version = "WIN 6,0,21,0";
			axo.AllowScriptAccess = "always";
			version = axo.GetVariable("$version");
		}catch(e){

		}
	}
	if(!version){
		try{
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		}catch(e){
		
		}
	}
	if(!version){
		try{
			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;
}
function GetSwfVer(){
	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];
			var versionRevision = descArray[3];
			if(versionRevision == ""){
				versionRevision = descArray[4];
			}
			if(versionRevision[0] == "d"){
				versionRevision = versionRevision.substring(1);
			}else if (versionRevision[0] == "r"){
				versionRevision = versionRevision.substring(1);
				if(versionRevision.indexOf("d") > 0){
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	else if(navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if( isflashIE && isflashWin && !isflashOpera ){
		flashVer = ControlVersion();
	}	
	return flashVer;
}
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision){
	versionStr = GetSwfVer();
	if(versionStr == -1 ){
		return false;
	}else if(versionStr != 0){
		if(isflashIE && isflashWin && !isflashOpera){
			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];
		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;
	}
}
var hasFlash = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
/////////////////////////////////////////////////////END////////////////////////////////////////////////
///////////////////////////////////////////FLASH VIDEO DETECTION////////////////////////////////////////

function getMultiVideo_old(ids,wt,ht){
	var inHTML = 'ERROR, NO VIDEO!';
	var myID = '';
	var chkid = false;
	var chkids = false;
	document.getElementById('multiVideo').style.width=wt+'px';
	if(ids.length>0){
		chkid = true;
		inHTML = '<div id="videoContent" style="border:1px solid #002d62;"></div>';
		if(ids.indexOf(',')>0){
			myID = ids.substr(0,ids.indexOf(','));
			chkids = true;
			inHTML = inHTML+'<div id="vidListFunc"></div>';
		}else{
			myID = ids;
		}
	}
	document.getElementById('multiVideo').innerHTML = inHTML;
	if(chkid){
		getVideo(myID,wt,ht,'videoContent');
	}
	if(chkids){
		getVideoListLoop(ids,wt,ht);
	}
}

function getMultiVideo(ids,wt,ht,div){
	var inHTML = 'ERROR, NO VIDEO!';
	var myID = '';
	var chkid = false;
	var chkids = false;
	if (div == null) {
		div = 'multiVideo';	
	}
	document.getElementById(div).style.width=wt+'px';
	if(ids.length>0){
		chkid = true;
		inHTML = '<div id="videoContent' + div + '" style="border:1px solid #002d62;"></div>';
		if(ids.indexOf(',')>0){
			myID = ids.substr(0,ids.indexOf(','));
		}else{
			myID = ids;
		}
		chkids = true;
		inHTML = inHTML+'<div id="vidListFunc' + div + '"></div>';
	}
	document.getElementById(div).innerHTML = inHTML;
	if(chkid){
		getVideo(myID,wt,ht,'videoContent' + div);
	}
	if(chkids){
		getVideoListLoop(ids,wt,ht,'vidListFunc' + div,'videoContent' + div);
	}
}

var myVidTimer = 8000;
var myVidTotal = 5;
function getRColVideo(ids){
	var tmpIO, tmpLen;
	var ctr = 0;
	if(ids!=''){
		ids = ids+',';
		if(ids.indexOf(',')>0){
			do{
				ctr ++;
				tmpIO = ids.indexOf(',');
				if(ctr<2){
					getRColVideoSwitch(ids.substr(0,tmpIO));
				}else{
					setTimeout('getRColVideoSwitch("'+ids.substr(0,tmpIO)+'");',((ctr-1)*myVidTimer));
				}
				tmpIO = tmpIO + 1;
				tmpLen = ids.length - tmpIO;
				ids = ids.substr(tmpIO,tmpLen);
			}while(ids!='');
		}
	}
}

function getRColVideoSwitch(id){
	if(document.getElementById('rColVideoDET').title==''){
		setTimeout('getRColVideoSwitch("'+id+'");',(myVidTotal*myVidTimer));
		getVideoRColDetails(id);
		getVideo(id,'188','141','rColVideoContent');
		//getVideo(id,'192','108','rColVideoContent');
	}
}

//getVideoImage
function getVideo(id,wt,ht,divID){
	if(document.getElementById(divID)){
		var abort = false;
		var currentID = id;
		try{
			if(document.getElementById('videoContent')){
				if(document.getElementById('videoContent').title!=id){
					currentID = document.getElementById('videoContent').title;
					abort = false;
				}else{
					abort = true;
				}
			}
		}catch(e){
	
		}
		if(abort){
			//alert('Video is already selected');
		}else{
			//document.getElementById(divID).innerHTML='Please Wait...';
			var xmlHttp;
			try{
				//Firefox, Opera 8.0+, Safari
				xmlHttp = new XMLHttpRequest();
			}catch(e){
				//Internet Explorer
				try{
					xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
				}catch(e){
					try{
						xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
					}catch(e){
						alert('Your browser does not support AJAX!');
						return false;
					}
				}
			}
			xmlHttp.onreadystatechange = function(){
				if(xmlHttp.readyState == 4){
					var responseText = xmlHttp.responseText;
					document.getElementById(divID).innerHTML = responseText;
					//document.getElementById(divID).style.height = ht+'px';
					//document.getElementById(divID).style.width = wt+'px';
					try{
						if(document.getElementById('vidDet'+currentID)){
							if(divID=='videoPlayerContentGO'){
								//document.getElementById('vidDet'+currentID).style.background='#fff';
							}else{
								//document.getElementById('vidDet'+currentID).style.background='#ccc';
							}
						}
						if(document.getElementById('vidDet'+id)){
							//document.getElementById('vidDet'+id).style.background='#ffc89b';
						}
						if(document.getElementById('videoContent')){
							document.getElementById('videoContent').title = id;
						}
					}catch(e){
						
					}
				}
			}
			var urlString = '/video/player/flashImage.asp';
			urlString = urlString+'?id='+id+'&w='+wt+'&h='+ht+'&d='+divID;
			xmlHttp.open('GET',urlString,true);
			xmlHttp.send(null);
		}
	}else{
		alert('Invalid ID');
	}
}

function getVideoListLoop(ids,h,w,listDiv,contentDiv){
	if (listDiv == null) {
		listDiv = 'vidListFunc';
	}
	if (contentDiv == null) {
		contentDiv = 'videoContent';
	}
	var tmpIO, tmpLen;
	var ctr = 0;
	if(ids!=''){
		ids = ids+',';
		if(ids.indexOf(',')>0){
			do{
				ctr ++;
				tmpIO = ids.indexOf(',');
				getVideoShortDetails(ids.substr(0,tmpIO),listDiv,h,w,contentDiv,ctr);
				tmpIO = tmpIO + 1;
				tmpLen = ids.length - tmpIO;
				ids = ids.substr(tmpIO,tmpLen);
			}while(ids!='');
		}
	}
}

function getVideoRColDetails(id){
	var xmlHttp;
	try{
		//Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	}catch(e){
		//Internet Explorer
		try{
			xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
		}catch(e){
			try{
				xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
			}catch(e){
				alert('Your browser does not support AJAX!');
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange = function(){
		if(xmlHttp.readyState == 4){
			var responseText = xmlHttp.responseText;
			document.getElementById('rColVideoDET').innerHTML = responseText;
		}
	}
	var urlString = '/video/player/videoRColDetails.asp';
	urlString = urlString+'?id='+id;
	xmlHttp.open('GET',urlString,true);
	xmlHttp.send(null);
}

function getVideoShortDetails(id,divID,h,w,divVID,ctr){
	if(document.getElementById(divID)){
		var abort = false;
		var currentID = id;
		try{
			if(document.getElementById(divVID)){
				if(document.getElementById(divVID).title!=id){
					currentID = document.getElementById(divVID).title;
					abort = false;
				}else{
					abort = true;
				}
			}
		}catch(e){
			
		}
		if(abort){
			//alert('Video is already selected2');
		}else{
			var xmlHttp;
			try{
				//Firefox, Opera 8.0+, Safari
				xmlHttp = new XMLHttpRequest();
			}catch(e){
				//Internet Explorer
				try{
					xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
				}catch(e){
					try{
						xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
					}catch(e){
						alert('Your browser does not support AJAX!');
						return false;
					}
				}
			}
			xmlHttp.onreadystatechange = function(){
				if(xmlHttp.readyState == 4){
					var responseText = xmlHttp.responseText;
					document.getElementById(divID).innerHTML = document.getElementById(divID).innerHTML+responseText;
				}
			}
			var urlString = '/video/player/videoShortDetails.asp';
			urlString = urlString+'?id='+id+'&d='+divVID+'&h='+h+'&w='+w+'&vd='+divVID+'&ctr='+ctr;
			xmlHttp.open('GET',urlString,true);
			xmlHttp.send(null);
		}
	}else{
		alert('Invalid ID');
	}
}

//getVideoDetails
function getVideoDetails(id,divID){
	if(document.getElementById(divID)){
		var abort = false;
		var currentID = id;
		try{
			if(document.getElementById('videoContent')){
				if(document.getElementById('videoContent').title!=id){
					currentID = document.getElementById('videoContent').title;
					abort = false;
				}else{
					abort = true;
				}
			}
		}catch(e){
			
		}
		if(abort){
			//alert('Video is already selected2');
		}else{
			var xmlHttp;
			try{
				//Firefox, Opera 8.0+, Safari
				xmlHttp = new XMLHttpRequest();
			}catch(e){
				//Internet Explorer
				try{
					xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
				}catch(e){
					try{
						xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
					}catch(e){
						alert('Your browser does not support AJAX!');
						return false;
					}
				}
			}
			xmlHttp.onreadystatechange = function(){
				if(xmlHttp.readyState == 4){
					var responseText = xmlHttp.responseText;
					document.getElementById(divID).innerHTML = responseText;
				}
			}
			var urlString = '/video/player/videoDetails.asp';
			urlString = urlString+'?id='+id+'&d='+divID;
			xmlHttp.open('GET',urlString,true);
			xmlHttp.send(null);
		}
	}else{
		alert('Invalid ID');
	}
}

//playVideo
function playVideo(id,wt,ht,divID,hd){
	var myHD = '';
	try{
		document.getElementById('rColVideoDET').title='Now Playing!';
	}catch(e){
		
	}
	try{
		myHD = hd;
	}catch(e){
		
	}
	if(myHD==null){
		myHD = '';
	}
	if(hasFlash){
		//flash
		if(document.getElementById(divID)){
			var xmlHttp;
			try{
				//Firefox, Opera 8.0+, Safari
				xmlHttp = new XMLHttpRequest();
			}catch(e){
				//Internet Explorer
				try{
					xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
				}catch(e){
					try{
						xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
					}catch(e){
						alert('Your browser does not support AJAX!');
						return false;
					}
				}
			}
			xmlHttp.onreadystatechange = function(){
				if(xmlHttp.readyState == 4){
					var responseText = xmlHttp.responseText;
					document.getElementById(divID).innerHTML = responseText;
				}
			}
			var urlString = '/video/player/flashPlayer.asp';
			urlString = urlString+'?id='+id+'&w='+wt+'&h='+ht+'&hd='+myHD+'&div='+divID;
			xmlHttp.open('GET',urlString,true);
			xmlHttp.send(null);
		}else{
			alert('invalid ID');
		}
	}else{
		//noflash
		document.getElementById(divID).innerHTML = '<br />ERROR!<br /><br />The latest version of "Adobe Flash Player" is required to view this video.<br /><br /><a href="http://www.adobe.com/go/EN_US-H-GET-FLASH" target="_blank">CLICK HERE</a> to download the latest version "Adobe Flash Player".';
		//alert('ERROR! You must have Adobe Flash Player installed to view this video.');
	}
}

//getVideoList
function getVideoList(os,ord){
	var urlString = '/video/player/videoList.asp';
	if(ord=='go'){
		urlString = '/video/player/videoGOList.asp';
	}
	var loc = '';
	if(document.getElementById('locSelect')){
		loc = document.getElementById('locSelect').value;
	}
	var cid = '';
	if(document.getElementById('videoContent')){
		cid = document.getElementById('videoContent').title;
	}
	var xmlHttp;
	try{
		//Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	}catch(e){
		//Internet Explorer
		try{
			xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
		}catch(e){
			try{
				xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
			}catch(e){
				alert('Your browser does not support AJAX!');
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange = function(){
		if(xmlHttp.readyState == 4){
			var responseText = xmlHttp.responseText;
			document.getElementById('videoList').innerHTML = responseText;
		}
	}
	if(loc!=''){
		loc = '?qsLoc='+loc;
	}
	if(os!=''){
		if(loc!=''){
			os = '&offset='+os;
		}else{
			os = '?offset='+os;
		}
	}
	if(cid!=''){
		if(os!='' || loc!=''){
			cid = '&cid='+cid;
		}else{
			cid = '?cid='+cid;
		}
	}
	if(ord!=''){
		if(os!='' || loc!='' || cid!=''){
			ord = '&vOrder='+ord;
		}else{
			ord = '?vOrder='+ord;
		}
	}
	urlString = urlString+loc+os+cid+ord;
	xmlHttp.open('GET',urlString,true);
	xmlHttp.send(null);
}
//END NUEDIT