﻿var theform; 
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) { 
    theform = document.forms["Form1"]; 
} 
else { 
    theform = document.Form1; 
} 

/*
'************************************************************
'*	Added on 20 April 2007 by ECD/BS.
'*
'*	These two functions below:
'*      pd_PostBack
'*      pd_DoPostBackWithOptions
'*  override:
'*      __doPostBack
'*      WebForm_DoPostBackWithOptions
'*  We do this in order to get support in IE for autocomplete
'*	field value saving.
'*  In IE only, autocomplete values are only saved on a
'*  form submit, which isn't fired by our link buttons.
'************************************************************
*/
// Var to hold whether browse control is using the dual selector.
var hasDualSelect = false;
// Override the base __doPostBack function
var orig_doPostBack;
var orig_WebForm_DoPostBackWithOptions;
var from_WebForm_DoPostBackWithOptions = false;

function pd_PostBack(Param1, Param2) { 
    if (from_WebForm_DoPostBackWithOptions == false) {
        // If IE, we need to explicitly run AutoComplete
        // so form values are remembered.
        // ECD: 05/18/2007, added try/catch, was causing
        // issues in AOL Browser and Opera.
        try
        {
            if (document.all)
            {
                window.external.AutoCompleteSaveForm(theform);
            }
        }
        catch (e)
        {
            // Do nothing, continue on...
        }    
        
        // If the browse control is using dual selector, we
        // need to select the values in the selectors on submit.
        if (hasDualSelect == true)
        {
            if (Param2 == '-')
            {
                bSelectInverse(); 
            }
            else
            { 
                bSelectAll();
            } 
        }
    }
    
    // Set back to original __doPostBack.
    __doPostBack = orig_doPostBack;
    __doPostBack(Param1, Param2);
}


function pd_DoPostBackWithOptions(options) { 
    from_WebForm_DoPostBackWithOptions = true;

    // If IE, we need to explicitly run AutoComplete
    // so form values are remembered.
    // ECD: 05/18/2007, added try/catch, was causing
    // issues in AOL Browser and Opera.
    try
    {
        if (document.all)
        {
            window.external.AutoCompleteSaveForm(theform);
        }
    }
    catch (e)
    {
        // Do nothing, continue on...
    }

    // If the browse control is using dual selector, we 
    // need to select the values in the selectors on submit.
    if (hasDualSelect == true)
    {
        if (options.eventArgument == '-')
        {
            bSelectInverse(); 
        }
        else
        { 
            bSelectAll();
        } 
    }

    // Set back to original WebForm_DoPostBackWithOptions.
    WebForm_DoPostBackWithOptions = orig_WebForm_DoPostBackWithOptions;
    WebForm_DoPostBackWithOptions(options);
}


function __pdPostbackFuncs() {
    orig_doPostBack = __doPostBack;
    __doPostBack = pd_PostBack; 

    if (window.WebForm_DoPostBackWithOptions != null) {
        orig_WebForm_DoPostBackWithOptions = WebForm_DoPostBackWithOptions;
        WebForm_DoPostBackWithOptions = pd_DoPostBackWithOptions;
    }
}


// __pdLoadTask JAVASCRIPT.  USED TO LOAD NEW TASK
function __pdL(taskid, taskname, tasktypeid, taskargs, path, clearhistory, subtaskid, subtaskname, formaction){ 
    
    if (formaction != "") { 
    	theform.action = formaction + "?t=" + taskid;
    } else {
		theform.action = "default.aspx?t=" + taskid;
    }
    
    if (formaction == 'defaultupload.aspx') {
         // Needed for ABCUpload
        AddUploadID()
    }
    
    if (taskargs != "") {
        var argArray = taskargs.split('~');
        for (i = 0; i < argArray.length; i++) {
            if (argArray[i].substring(0,3) == 'nid') {
                theform.action += '&' + argArray[i]
            }
        }
    }
	 
    theform.__TASKID.value = taskid; 
    theform.__TASKNAME.value = taskname; 
    theform.__TASKTYPEID.value = tasktypeid; 
    theform.__TASKARGS.value = taskargs; 
    theform.__APPPATH.value = path; 
    theform.__CLEARHISTORY.value = clearhistory; 
    theform.__SUBTASKID.value = subtaskid; 
    theform.__SUBTASKNAME.value = subtaskname; 
    ClearForm(); 
    theform.submit(); 
} 


// OLD PDLOADTASK STILL CALLED BY HTML BANNERS
function __pdLT(taskid, taskname, tasktypeid, taskargs, path, clearhistory, subtaskid, subtaskname){ 
  __pdL(taskid, taskname, tasktypeid, taskargs, path, clearhistory, subtaskid, subtaskname, '')
} 


function pause(numberMillis) {
        var now = new Date();
        var exitTime = now.getTime() + numberMillis;
        while (true) {
            now = new Date();
            if (now.getTime() > exitTime)
                return;
        }
    }



// __pdLTN JAVASCRIPT.  USED TO LOAD NEW TASK IN A NEW WINDOW 
function __pdLTN(taskid, taskname, tasktypeid, taskargs, path, clearhistory, subtaskid, subtaskname, formaction, windowname, windowfeatures){ 
    var winref;
    winref = window.open("/podium/blank.html", windowname, windowfeatures);
    
    var winform; 
    if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) { 
        winform = document.forms["Form2"]; 
    } 
    else { 
        winform = document.Form2; 
    } 
    
    winform.target = windowname;
    if (taskargs.indexOf('gm_fv=1') > -1) {
        winform.__PD.value = 'gm_fv'; 
    } else if (taskargs.indexOf('gm_p=1') > -1) {
        winform.__PD.value = 'gm_p'; 
    } else {
        winform.__PD.value = 'co'; 
    }
    winform.__TASKID.value = taskid; 
    winform.__TASKNAME.value = taskname; 
    winform.__TASKTYPEID.value = tasktypeid; 
    winform.__TASKARGS.value = taskargs; 
    winform.__APPPATH.value = path; 
    winform.__CLEARHISTORY.value = clearhistory; 
    winform.__SUBTASKID.value = subtaskid; 
    winform.__SUBTASKNAME.value = subtaskname; 
    winform.__pdVIEWSTATE.value = theform.__pdVIEWSTATE.value;
    winform.submit(); 
    
    winform.__PD.value = ''; 
    winform.__TASKID.value = '';
    winform.__TASKNAME.value = '';
    winform.__TASKTYPEID.value = ''; 
    winform.__TASKARGS.value = ''; 
    winform.__APPPATH.value = '';
    winform.__CLEARHISTORY.value = '';
    winform.__SUBTASKID.value = '';
    winform.__SUBTASKNAME.value = ''; 

} 

// __pdLoadSubTask JAVASCRIPT.  USED TO LOAD NEW SUB TASK
function __pdLST(subtaskid, subtaskname){ 
    theform.__SUBTASKID.value = subtaskid; 
    theform.__SUBTASKNAME.value = subtaskname; 
    ClearForm(); 
    theform.submit(); 
} 



// __pdSetVal JAVASCRIPT.  USED TO SET VARIOUS SYSTEM VALUES
function __pdSetVal(val){ 
    theform.__PD.value = val; 
    if ((val == 'gm_p' || val == 'gm_mtl')) {
        if (theform.__EVENTTARGET) {
		    theform.__EVENTTARGET.name = "__NOEVENTTARGET"; 
	    }
	    if (theform.__EVENTARGUMENT) {
		    theform.__EVENTARGUMENT.name = "__NOEVENTARGUMENT"; 
	    }
		theform.target = '_blank'
    }
    
   // ClearForm(); 
    theform.submit(); 
    
    if ((val == 'gm_p' || val == 'gm_mtl')) {
         if (theform.__NOEVENTTARGET) {
		    theform.__NOEVENTTARGET.name = "__EVENTTARGET"; 
	    }
	    if (theform.__NOEVENTARGUMENT) {
		    theform.__NOEVENTARGUMENT.name = "__EVENTARGUMENT"; 
	    }
		theform.target = ''
		theform.__PD.value = ''; 
	}
} 

// __pdIFPrint JAVASCRIPT.  USED TO Print Iframes
function __pdIFPrint(ifID){ 
	try {
        window.open(frames[ifID].location.href);
    }
    catch (e)
    {
        // Do nothing, continue on...
    }    
} 


// __pdTransfer JAVASCRIPT.  USED TO Transfer Applications
function __pdTransfer(url){ 
	if (url != "") { 
		theform.action = url;
	}
	ClearForm(); 
    theform.submit(); 
} 

function __pdCheckTransfer() {
   if (__pdDoTransferURL.length > 0) __pdTransfer(__pdDoTransferURL);
   // alert('h1');
}
var __pdDoTransferURL = '';

function __pdTransferToSSL(sslurl) {
  var loc = document.location.toString();
  if (loc.substring(0,4) == 'http') { 
    if (loc.match('#')) {
        sslurl = sslurl + '#' + loc.split('#')[1];
    }
    location.replace(sslurl); // get rid of current page in history
  }  
}

function __pdTransferFromSSL(url) {
  var loc = document.location.toString();
  if (loc.substring(0,5) == 'https') { 
    if (loc.match('#')) {
        url = url + '#' + loc.split('#')[1];
    }
    location.replace(url); // get rid of current page in history
  }  
}

// __pdSiteSearch JAVASCRIPT.  USED TO GET SITE SEARCH RESULTS 
function __pdSiteSearch(pageTitle, searchTerm) {
    __pdL(52392, pageTitle, 1, 'q=' + searchTerm, '', 'true', 0, '', '');
}


// CLEAR VIEWSTATE AND POSTBACK EVENTS
function ClearForm(){ 
	if (theform.__EVENTTARGET) {
		theform.__EVENTTARGET.name = "__NOEVENTTARGET"; 
	}
	if (theform.__EVENTARGUMENT) {
		theform.__EVENTARGUMENT.name = "__NOEVENTARGUMENT"; 
	}
	var elem = theform.__VIEWSTATE; 
	elem.name = "__NOVIEWSTATE"; 
	// BTS - commented out this like because it seemed to cause viewstate errors when back-button is clicked.
	// elem.value = ""; 
	if (theform.elements.length < 100) {
	    var formElements = theform.elements; 
	    for (i=0; i<formElements.length; i++) { 
		    elem = formElements[i]; 
		    if (elem.type != "file") {
			    if (elem.name.substring(0,2) != "__" && elem.name.indexOf("_PU_PN_") == -1  ) { 
				    elem.value="";
				    elem.id="";
				    elem.name="";
			    } 
		    }
	    } 
	}
} 

function enc(str) {
	//StartFragment 
	var the_res="";//the result will be here
	for(i=0;i<str.length;++i)
	{
		the_res+=String.fromCharCode(5^str.charCodeAt(i));
	}
	return the_res;
}



// Function for ABCUpload
function AddUploadID() {
    var theUniqueID = Math.floor(Math.random() * 1000000) * ((new Date()).getTime() % 1000);
    var thePos = theForm.action.indexOf('&uplid')
    if (thePos > 0) {
        theForm.action = theForm.action.substring(0, thePos);
    }
    theForm.action += '&uplid=' + theUniqueID;
}



//
// PDJscript.js
//

//*******************************************************************************************************
// Timeout
//*******************************************************************************************************
var pdTimerBase = 20;
var pdTimerDone = false;
var pdTime;
var pdTimerDisableClient = false;

function PDTimerReset() {
   theform.__PDTIMER.value = pdTimerBase;
   PDTimerDisplay(pdTimerBase);
   pdTimerDone = false;
   window.clearTimeout(pdTime);
   PDTimerRun();
}

function PDTimerEndNow() {
    theform.__PDTIMER.value = 1;
    PDTimerInc();
}

function PDTimerKey() {
   if (pdTimerDone == false) PDTimerReset();
}
window.document.body.onmouseup = PDTimerKey;
window.document.body.onkeyup = PDTimerKey;

function PDTimerInc() {
    var s = pdTimerBase;
    if (window.pdTimerTimeoutFunc != null) {
        if (theform.__PDTIMER.value.length > 0) s = theform.__PDTIMER.value;
        s = s - 1;
        theform.__PDTIMER.value = s;
        PDTimerDisplay(s);
        if (s <= 0) {
            pdTimerDone = true;
            window.clearTimeout(pdTime);
            if (pdTimerDisableClient == false) pdTimerTimeoutFunc();
        } else {
            PDTimerRun();
        }
    }
}

function PDTimerDisplay(val) {
    var td = document.getElementById('pdTimerD');
    if (td) td.innerHTML = val;
}

function PDTimerInit(disableClient) {
    PDTimerReset();
    pdTimerDisableClient = disableClient;
}

function PDTimerRun() {
   pdTime = window.setTimeout("PDTimerInc()", 60000);
}

function PDKeepAlive() {
    $.get('/podium/KeepAlive.aspx');
}

function PDCSecLShow() {
    $("#pdCSec").css({width:"200"});
    PDCSecShow();
    scrollToTop();
    window.setTimeout("document.getElementById('pdCSecPass').focus()", 500);
}

function PDCSecRShow() {
    PDCSecShow();
    window.setTimeout("document.getElementById('pdCSecEM').focus()", 500);
}

function PDCSecShow() {
    $("#pdCSec").css({display:"block", "z-index":"9999999"});
    $("#pdCSecFade").css({display:"block", "z-index":"9999998"});    
    
    pdInitIF('pdCSecFade');
    pdShowIF();
    PDCSecSize()
 }
 
function PDCSecSize() {
    var w,h,l,t,x,y;
       
    if ($("#pdCSec").width() > 400) $("#pdCSec").css({width:"400"})
    w = $("#pdCSec").width();
    h = $("#pdCSec").height();
            
    l = (document.body.clientWidth / 2) - (w / 2);
    t = (document.body.clientHeight / 2) - (h / 2);
    if (document.body && document.body.scrollHeight) {
	    x = document.body.scrollWidth;
	    if(document.body.clientHeight){
	        y = (document.body.scrollHeight<document.body.clientHeight)?document.body.clientHeight:document.body.scrollHeight;
	    }else {
	        y = document.body.scrollHeight
	    }
    } else if (self.outerHeight) {
	    x = self.outerWidth;
	    y = self.outerHeight;
	} else if (document.height) {
	    x = document.width;
	    y = document.height;
    } 
    
    $("#pdCSec").css({left: l, top: t});
    $("#pdCSecFade").css({width: x, height: y});    
}

function PDCSecHide() {
    $("#pdCSec").css({display:"none"});
    $("#pdCSecFade").css({display:"none"});
    pdHideIF();
}

//*******************************************************************************************************
// Scroll window to top (used when loading iframes)
//*******************************************************************************************************
function scrollToTop() {
    scroll(0,0);
} 

//*******************************************************************************************************
// PRODUCTION FUNCTIONS
//*******************************************************************************************************

// SET L1 Navigation visibility
function SetTaskStay(taskid) {
	var docSpans = document.getElementsByTagName('span'); 
	var taskSpanID = 't_' + taskid;
	var taskSpanIDStay = 'ts_' + taskid;
	var hasStay = false;
	for (var i = 0; i < docSpans.length; i++) {
		if (docSpans[i].id.substring(0,taskSpanIDStay.length) == taskSpanIDStay) {
			hasStay = true;
			break;
		}
	}
	if (hasStay == true) {
		for (var i = 0; i < docSpans.length; i++) {
			if (docSpans[i].id.substring(0,2) == 't_') {
				if (docSpans[i].id.substring(0,taskSpanID.length) == taskSpanID) {
					docSpans[i].style.display = 'none';
				} else {
					//docSpans[i].style.display = '';
				}
			}
			if (docSpans[i].id.substring(0,3) == 'ts_') {
				if (docSpans[i].id.substring(0,taskSpanIDStay.length) == taskSpanIDStay) {
					docSpans[i].style.display = '';
				} else {
					docSpans[i].style.display = 'none';
				}
			}
		}
	}
}


//*******************************************************************************************************
// COMPONENTART FUNCTIONS
//*******************************************************************************************************

// SET height of rotator
function SetRotatorHeight(rid) {
	var docDivs = document.getElementsByTagName('div'); 
	var rSlideItemID = rid + '_slide';
	var maxHeight = 0;
	var sc = new getObj(rid);
	sc.style.height = '';
}

//*******************************************************************************************************
// OBJECT FUNCTIONS
//*******************************************************************************************************

// getObj - finds an object based on id
function getObj(name)
{
	if (document.getElementById) {
		this.obj = document.getElementById(name);
		if(this.obj)this.style = document.getElementById(name).style;
	} else if (document.all) {
		this.obj = document.all[name];
		if(this.obj)this.style = document.all[name].style;
	} else if (document.layers) {
		this.obj = document.layers[name];
		if(this.obj)this.style = document.layers[name];
	}
}



function makeId(path) {
    return path.substring( path.lastIndexOf("/") + 1, path.lastIndexOf("."));
}


function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}


//*******************************************************************************************************
// FORM FUNCTIONS
//*******************************************************************************************************

// CATCH THE ENTER KEY
var txtFocus = false;
function CaptureEnter(evt)
{
	if (txtFocus == false) {
		if (evt.keyCode == 13)
		{
			evt.cancelBubble = true;
			evt.returnValue = false;
		}
	}
}
function SettxtFocus(f) {
	txtFocus = f;
}

// ConfirmClick - shows confirmation box and allows user to confirm or cancel
function ConfirmClick(msg){ 
    if (confirm(msg)) { 
        return true; 
    } 
    else { 
        return false; 
    } 
} 

// Enable Disable a control
function EnableDisable(chkid, objid) {
	var c = new getObj(chkid);
	var f = new getObj(objid);
	if ((f.obj) && (c.obj)) {
	    f.obj.disabled = !c.obj.checked;
	}
}

function DisableEnable(chkid, objid) {
	var c = new getObj(chkid);
	var f = new getObj(objid);
	if ((f.obj) && (c.obj)) {
	    f.obj.disabled = c.obj.checked;
	}
}

// Select all checkboxes or Unselect all
function Check_ALL(List_name){
	var i =0;
	var flag = true; 
	var elem = document.getElementById("List_name");
	while (flag)
	{ 
		var id = List_name + "_" + i; 
		var ChildElem= document.getElementById(id);
		if (ChildElem != null)
			ChildElem.checked = true;
		else
			flag = false;
		i++;
	}
}
function Clear_ALL(List_name){
	var i =0;
	var flag = true; 
	var elem = document.getElementById("List_name");
	while (flag)
	{ 
		var id = List_name + "_" + i; 
		var ChildElem= document.getElementById(id);
		if (ChildElem != null)
			ChildElem.checked = false;
		else
			flag = false;
		i++;
	}
}

function SetSelected(obj_name){
   var control = document.getElementById(obj_name);  
   if( control != null ) control.checked = true; 
}

function SetSelectedOnOff(id){
   var cb=document.getElementById(id);  
   if(cb)cb.checked=(cb.checked||cb.disabled)?false:true;
}

function SynchControlSelections(changed_obj_name,synch_obj_name){
   var changed_control = document.getElementById(changed_obj_name);  
   var synch_control = document.getElementById(synch_obj_name);  
   if( changed_control != null && synch_control != null) synch_control.checked = changed_control.checked; 
}

function clearTexBox(tbl) {
	
	var aTBs = tbl.split('|')
	for (i=0;i<aTBs.length;i++){
		var objTB = document.getElementById(aTBs[i])
		if(objTB) objTB.value = ''
	}
}

function Check_ALL2(List_name){
	
	for (var i=0; i < document.forms[0].elements.length; i++)
	{
		var elem = document.forms[0].elements[i];
		if (elem.name.indexOf(List_name) != -1)
		{
			elem.checked = true;
		}
	}
}
function Clear_ALL2(List_name){
	for (var i=0; i < document.forms[0].elements.length; i++)
	{
		var elem = document.forms[0].elements[i];
		if (elem.name.indexOf(List_name) != -1)
		{
			elem.checked = false;
		}
	}
}

// Select all checkboxes or Unselect all
function Check_ALL3(List_name,check){
var i, n_elems, elems = document.getElementsByTagName("input"); 
n_elems = elems.length; 

for (i = 0; i < n_elems; i++)
	{ 

	if (elems[i].type == "checkbox")
	    {
	    if (elems[i].name.indexOf(List_name) != -1)
		    {
			    elems[i].checked = check;
		    }
		}
	}
	i++;
}

// Select all radio button
function Check_ALL4(value){
    
    var oInput = document.getElementsByTagName("input"); 
       for (i = 0; i < oInput.length; i++) { 
       if (oInput[i].type == "radio") { 
            if (oInput[i].value == value) oInput[i].checked = true;
        }
    }
}

function Check_All5(id, check) {
    var o=document.getElementById(id);
    var l=o.getElementsByTagName("input")
    for(i=0;i<l.length;i++)
        if (l[i].type=="checkbox"&&!l[i].disabled)
           l[i].checked=check;   
}

//fix for radiobutton groupname not working in repeaters
function CheckUniqueRadioButton(name, oRb) {
    var re=new RegExp(name)
    var l=document.getElementsByTagName('input')
    for(i=0;i<l.length;i++)
        if(l[i].type=='radio')
            if(re.test(l[i].name))
                l[i].checked=false;
    oRb.checked=true;             
}


// Form Change
function SetFormChanged(val) {
	theform.__FORMCHANGED.value = val; 
}
function CheckFormChanged() {
	if (theform.__FORMCHANGED.value == 1) { 
		return ConfirmClick('Changes have been made.\n\nPress OK to continue without saving.\n\nPress CANCEL to go back and save.');
	} else { 
		return true; 
	}
}
      

//*******************************************************************************************************
// IMAGE FUNCTIONS
//*******************************************************************************************************

// IMAGE SWAP
function ImageSwapPD(daImage, daSrc){
 	var obj;
 	if(document.images){
		// Check to see whether you are using a name, number, or object
		if (typeof(daImage) == 'string') {
	   		obj = 'document.' + daImage;
	   		obj = eval(obj);
	   		obj.src = daSrc;
	   	} 
		else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
			daImage.src = daSrc;
	   	}
 	}
}		

function loadImages() {
    for (var i = 0; i < arguments.length; i++) {
        var temp = makeId(arguments[i]);
        eval(temp + "= new Image()");
        eval(temp + ".src ='"+ arguments[i] + "'");
    }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//*******************************************************************************************************
// SHOW-HIDE FUNCTIONS
//*******************************************************************************************************

// ShowHide - changes display of an object
function ShowHide(objid) {
	var f = new getObj(objid);
	if (f.obj) {
		if (f.style.display == 'none'){	
			f.style.display = ''; 
		}
		else { 				
			f.style.display = 'none'; 
		}
	}
}

// Show 
function Show(objid) {
	var f = new getObj(objid);
	if (f.obj)f.style.display = ''; 
}
// Hide 
function Hide(objid) {
	var f = new getObj(objid);
	if (f.obj)f.style.display = 'none'; 
}

// ShowHide2 - shows/hides div while changing clicked anchor text
function ShowHide2(ShowObjID, ClickObjID, ToShowString, ToHideString) {
	var ShowObj = new getObj(ShowObjID);
	var ClickObj = new getObj(ClickObjID);
	if (ShowObj.style.display == 'none'){	
		ShowObj.style.display = ''; 
		ClickObj.obj.innerHTML = ToHideString;
	}
	else { 				
		ShowObj.style.display = 'none'; 
		ClickObj.obj.innerHTML = ToShowString;
	}
}

// ShowHide2 - shows/hides div while changing clicked anchor text
function ShowHide3(ShowObjID, ClickObj, ToShowString, ToHideString) {
	var ShowObj = new getObj(ShowObjID);
 
	if (ShowObj.style.display == 'none'){	
		ShowObj.style.display = ''; 
		ClickObj.innerHTML = ToShowString
	}
	else { 				
		ShowObj.style.display = 'none'; 
		ClickObj.innerHTML = ToHideString
	}
}

// ShowHideUNav - changes display of User Navigation
function ShowHideUNav() {
	var theform; 
	if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) { 
		theform = document.forms["Form1"]; 
	} 
	else { 
		theform = document.Form1; 
	} 
	var f = new getObj("unavdiv");
	var i = new getObj("unavimg");
	if (f.style.display == 'none'){				
		f.style.display = ''; 
		i.obj.innerHTML = '-';
		theform.__UNAVDM.value = '0'; 
    }
	else { 				
		f.style.display = 'none'; 
		theform.__UNAVDM.value = '1'; 
		i.obj.innerHTML = '+';
	 }
}

//Given an array of client ids this will set the other divs to invisible while setting the supplied to visible
function SetVisible(myObj, clArray){
	var item_ids = new Array();
	var s = (clArray);
	item_ids = s.split(',');
	var i = 0;
	for (i; i < item_ids.length; i++)
	{
		var elem = document.getElementById(item_ids[i]);
		if(!elem)continue;	
		if (myObj == elem.id){
			elem.style["display"] = '';
		} else {
			elem.style["display"] = 'none';
			}
	} 
}


// Show Edit Mode
var ShowObjs = '';
function ShowEM(ShowObjId, HighlightObjId) {
    if (ShowObjs.indexOf('|' + ShowObjId + '|', 0) == -1) {
        var s = new getObj(ShowObjId);
	    var h = new getObj(HighlightObjId);
	    if (s.obj) {
	        if (s.style.display != '') {
	            s.style.display = ''; 
	        }
	    }
	    if (h.obj) {
	        if (h.style.border != '1px dashed #c1c1c1') {
	            h.style.border = '1px dashed #c1c1c1'; 
	        }
	    }
	    ShowObjs += '|' + ShowObjId + '|'
    } 
}

function HideEM(ShowObjId, HighlightObjId) {
    ShowObjs = ShowObjs.replace('|' + ShowObjId + '|', '');
    window.setTimeout("doHideEM('" + ShowObjId + "', '" + HighlightObjId + "')", 250);
}

function doHideEM(ShowObjId, HighlightObjId) {
    if (ShowObjs.indexOf('|' + ShowObjId + '|', 0) == -1) {
	    var s = new getObj(ShowObjId);
        var h = new getObj(HighlightObjId);
        if (s.obj) {
            if (s.style.display != 'none') {
                s.style.display = 'none'; 
            }
        }
        if (h.obj) {
            if (h.style.border != '0px') {
                h.style.border = '0px'; 
            }
        }
    }
}

//*******************************************************************************************************
// CHANNEL FUNCTIONS
//*******************************************************************************************************

// setCBStyle - sets properties for channnel boxes
function setCBStyle(objid, maxheight, displaymode)
{
	var d = new getObj(objid);
	if (maxheight > 0) {
		if (d.obj.offsetHeight > maxheight) {
			d.style.height = maxheight + 'px';
		}
	}
	if (displaymode == 'none') {
		d.style.display = displaymode;
	}
}

// ShowHideCB - sets display for channel boxes
function ShowHideCB(cbobjid, shobj, img1, img2) {
	var cb = new getObj(cbobjid);
	if (cb.style.display == 'none'){				
		cb.style.display = ''; 
		shobj.src = img2;
		SetUserCBMode(cbobjid, 0);
	}
	else { 				
		cb.style.display = 'none'; 
		shobj.src = img1;
		SetUserCBMode(cbobjid, 1);
	}
}

function SetUserCBMode(cbobjid, mode) {
    var curVal = getCookieValue('UCM');
	if (curVal.length > 0) {
		var c = '';
		var str = new Array();
		var strmatch = cbobjid + ':';
		var found = false;
		str = curVal.split(",");
		for (var i = 0; i < str.length; i++) {
			if (c.length > 0) {
				c += ",";
			}
			if (str[i].substring(0, strmatch.length) == strmatch) {
				c += strmatch + mode;
				found = true;
			} else {
				c += str[i];
			}
		} 
		if (found == false) {
			if (c.length > 0) {
				c += ",";
			}
			c += strmatch + mode;
		}
		setCookieValue('UCM', c);
	} else {
		setCookieValue('UCM', cbobjid + ':' + mode);
	}
}

//*******************************************************************************************************
// COOKIE FUNCTIONS
//*******************************************************************************************************
function getCookieValue(name) {
    var ca = document.cookie.split(';');
    var val = '';
    for(var i=0;i < ca.length;i++) {
	    var c = ca[i];
	    while (c.charAt(0)==' ') c = c.substring(1,c.length);
	    if (c.indexOf(name) == 0) {
	        val = c.substring(name.length + 1,c.length);
	        break;
	    }
    }
    return val;
}

function setCookieValue(name, val) {
    var date = new Date();
  	date.setTime(date.getTime()+(30*24*60*60*1000));
  	var expires = "; expires="+date.toGMTString();
	document.cookie = name+"="+val+expires+"; path=/";
}


//*******************************************************************************************************
// WINDOW FUNCTIONS
//*******************************************************************************************************

// pdOpenWindow - shows a popup window with content
function pdOpenWindow(content, width, height) {
	generator = window.open('','Podium','width='+width+',height=600,location=0,status=0, toolbar=0, location=0, menubar=0, directories=0, resizable=1, scrollbars=0');
	generator.document.write('<html><head><title>Podium</title></head>');
	generator.document.write('<body style="margin:0px;border:0px;padding:0px;">');
	generator.document.write('<table width="100%" height="100%" cellpadding="0" cellspacing="0"><tr><td width="100%" height="100%" align="center" valign="middle">');
	generator.document.write('<div align="center" valign="middle" id="pdiv"><span id="pspan">');
	generator.document.write(content);
	generator.document.write('</span></div>');
	generator.document.write('</td></tr></table>');
	generator.document.write('</body></html>');
	generator.document.close();
	if (!width) {
		//var odiv = generator.document.getElementById('pdiv');
		//var ospan = generator.document.getElementById('pspan');
		window.setTimeout("generator.resizeTo((generator.document.getElementById('pspan').offsetWidth + 27),(generator.document.getElementById('pdiv').offsetHeight + 66))",300);
	}	
}

/*
'************************************************************
'*	Added on 7 Oct 2005 by ECD
'*
'*	This is the functionality the cImage control now uses. The above function
'*	was very limited, this function has autoclose, and title functionality.
'************************************************************
*/
// Set the horizontal and vertical position for the popup
PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)
defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows
var AutoClose = true;

if (parseInt(navigator.appVersion.charAt(0))>=4)
{
	var isNN=(navigator.appName=="Netscape")?1:0;
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
}

var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

function pdOpenImagePopup(imageURL,imageTitle)
{
	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}
	
	if (imageTitle==null)
	{
		imageTitle='Podium';
	}
	
	with (imgWin.document)
	{
		writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
		writeln('<sc'+'ript>');
		writeln('var isNN,isIE;');
		writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;');
		writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){');
		writeln('if (isIE){');
		writeln('width=document.images["Podium"].width;');
		writeln('height=35+document.images["Podium"].height;');
		writeln('window.resizeTo(width,height);');
		writeln('}');
		writeln('if (isNN){');       
		writeln('window.innerWidth=document.images["Podium"].width;');
		writeln('window.innerHeight=document.images["Podium"].height;}}');
		writeln('function doTitle(){document.title="'+imageTitle+'";}');
		writeln('</sc'+'ript>');
		
		if (!AutoClose)
		{
			writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
		}
		else
		{
			writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
		}
		
		writeln('<img name="Podium" src='+imageURL+' style="display:block"></body></html>');
		close();		
	}
}

function iFrameHeight(id) {
	   
	 try {
        var iframe=new iFrame(id);
        iframe.SetFrameHeight();
     }
     catch (e) {
        var ifr = document.getElementById(id)
        if (ifr) {
            ifr.style.height = 5000;
        }
     }

}

function iFrame(id) {
    
    this.oFrame = document.getElementById(id);
    this.cBody = this.oFrame.contentWindow.document.getElementById('__pdIFRAMEarea');
    if (this.cBody) {
        this.cBody.cBody=this.cBody;this.cBody.oFrame=this.oFrame;
        this.cBody.onclick=this.SetFrameHeight; 
    }
    
}

iFrame.prototype.SetFrameHeight = function() {

	try {
		this.oFrame.style.height=(this.cBody)?this.cBody.offsetHeight:5000;
	}
	catch (e) {
		this.oFrame.style.height = 5000
	}
}

//function 

//*******************************************************************************************************
// CURRENCY FUNCTIONS
//*******************************************************************************************************

// Given an array of client ids and total client id this will maintain the total values
function AddItem(clArray, total,sepChar,decChar){
	var t = document.getElementById(clArray);
	var item_ids = new Array();
	var s = (t.value);
	item_ids = s.split(',');

	var i = 0, vtemp = 0, vresult = 0;
	for (i; i < item_ids.length; i++)
		{
			var elem = document.getElementById(item_ids[i]);
			if(!elem)continue;	

			vtemp=elem.value;
			//get rid of group seperators
			str = replaceAll(elem.value,sepChar,'');
			//replace current culture decimal seperator with US
			str = replaceAll(str,decChar,'.');
			vtemp = makePos(Number(str));

			if (!isNaN(vtemp)) vresult += vtemp;
			elem.value = formatCurrency(vtemp,sepChar,decChar);
		} 
	try{
	    var elem1 = document.getElementById(total);
	    vtemp = 0;
	    str = replaceAll(elem1.value,sepChar,'');
	    str = replaceAll(str,decChar,'.');
	    vtemp = Number(str);
    	
	    if(vresult > 0){
	        elem1.value = (s)?formatCurrency(vresult,sepChar,decChar):formatCurrency(elem1.value,sepChar,decChar);
        }
        else {  
                elem1.value = formatCurrency(vtemp,sepChar,decChar);
        }
   }
   catch(err){
      return 0;
   }
}

function makePos(value){
    var newVal = value;
    if(!isNaN(newVal)){
        if(newVal < 0) {
            newVal = newVal * -1
         }
    }
    return newVal;
}

function replaceAll(source, searchVal, newVal) {

    if (searchVal == newVal) return source;
	var strReplaceAll = source;
    var intIndexOfMatch = strReplaceAll.indexOf( searchVal );
 
    while (intIndexOfMatch != -1){
    strReplaceAll = strReplaceAll.replace( searchVal, newVal )
     
    intIndexOfMatch = strReplaceAll.indexOf( searchVal );
    }
     
    return strReplaceAll;

}

function SetBold(o){
    var l=o.getElementsByTagName('TD');
    for(i=0;i<l.length;i++)
        l[i].style.fontWeight=(l[i].style.fontWeight=='bold')?'normal':'bold';
}

function formatCurrency(num,sepChar,decChar) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+sepChar+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + num + decChar + cents);
}

function showCVV(obj){
	var objIF = document.getElementById('tCVVinfo')
	var objCVV = document.getElementById('iCVVinfo')
	
	if(obj){
		var ol=obj.offsetLeft;var ot=obj.offsetTop;
		while ((obj=obj.offsetParent) != null) {ol += obj.offsetLeft; ot += obj.offsetTop; }
		
		objIF.style.left = ol-6;
		objCVV.style.left = ol-6;
		objIF.style.top = ot+18
		objCVV.style.top = ot+18
	}
	
	objIF.style.display = (objIF.style.display == 'none')?'':'none';
	objCVV.style.display = (objCVV.style.display == 'none')?'':'none';

}

function SetPaymentOption(obj, tCC, tSP, tSA){
	
	var aChkBoxes = obj.getElementsByTagName('input');
	var ccVal = false;
	var checkVal = false;
	var saccountVal = false;
	
	for(i=0;i<aChkBoxes.length;i++) {
		if(aChkBoxes[i].checked) {
		    if (aChkBoxes[i].value=='check') {
		        checkVal = true;
		    } else if (aChkBoxes[i].value=='saccount') {
		        saccountVal = true
		    } else {
		        ccVal = true;
		    }
		}
	}
			
	var objCC = document.getElementById(tCC)
	var objSP = document.getElementById(tSP)
	var objSA = document.getElementById(tSA)
	if(objCC && objSP && objSA)objCC.style.display = (ccVal)?'block':'none';
	if(objCC && objSP && objSA)objSP.style.display = (checkVal)?'block':'none';
	if(objCC && objSP && objSA)objSA.style.display = (saccountVal)?'block':'none';
	
	var textInputs=objCC.getElementsByTagName('input');
	for(j=0;j<textInputs.length;j++){
		textInputs[j].disabled=!ccVal;
	}
	
	var textInputs=objCC.getElementsByTagName('select');
	for(j=0;j<textInputs.length;j++){
		textInputs[j].disabled=!ccVal;
	}
	
	var stextInputs=objSA.getElementsByTagName('input');
	for(j=0;j<stextInputs.length;j++){
		stextInputs[j].disabled=!saccountVal;
	}
}

/*Fix for dissappearing dropdowns in Multipage tabs for Safari*/
function ShowDropDowns()
{
    if (window.ComponentArt_Snap_Page_Loaded != null)
    {
        if (ComponentArt_Snap_Page_Loaded == true)
        {
           var DropDowns = document.getElementsByTagName("select");
           for (i = 0; i < DropDowns.length; i++)
           {
                if (DropDowns[i].style.visibility == "hidden") 
                    DropDowns[i].style.visibility = "visible";
           }
        }
    }    
}

function Copy2ClipAlert(pCopyText)
{
    if (window.clipboardData)
    {
        window.clipboardData.setData("Text", pCopyText);
    }
    else if (window.netscape)
    {
        // you have to sign the code to enable this, or see notes below
        netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

        var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
        if (!clip) return;

        var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
        if (!trans) return;

        trans.addDataFlavor('text/unicode');
    
        var str = new Object();
        var len = new Object();
        var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
        var copytext=pCopyText;

        str.data=copytext;
        trans.setTransferData("text/unicode",str,copytext.length*2);

        var clipid=Components.interfaces.nsIClipboard;

        if (!clip) return false;

        clip.setData(trans,null,clipid.kGlobalClipboard);
    }
    alert("The following info was copied to your clipboard:\n\n" + pCopyText);
    return false;
}

// E-Mail

//just retruns decoded email address
function pdDecodeEmail(address){
    var aryAddress = new Array
    var mailTo = new String;
    address = address.replace(/x/g, ',64');address = address.replace(/y/g, ',46');address = address.replace(/z/g, ',');
    aryAddress = address.split(',') 
    for (i=1; i<aryAddress.length;i++) {  
          mailTo = mailTo + String.fromCharCode(aryAddress[i]);   
    }
    return mailTo;
}

function pdSendEmail(address,mode,subject) {
    var aryAddress = new Array
    var mailTo = new String;
    address = address.replace(/x/g, ',64');address = address.replace(/y/g, ',46');address = address.replace(/z/g, ',');
    aryAddress = address.split(',') 
    for (i=1; i<aryAddress.length;i++) {  
          mailTo = mailTo + String.fromCharCode(aryAddress[i]);   
    }
    
    var locStr = '';
    switch (mode) {
       case 'normal': //normal
            if(subject.length > 0){
                locStr='mailto:'+mailTo+'?subject='+subject;
            }
            else{
                locStr='mailto:'+mailTo;
            }
            window.location.replace(locStr);
            break;
       case 'cc': //cc
            if(subject.length > 0){
                locStr='mailto:?cc='+mailTo+'&subject='+subject;
            }
            else{
                locStr='mailto:?cc='+mailTo;
            }
            window.location.replace(locStr);
            break;
       case 'bcc': //bcc
            if(subject.length > 0){
                locStr='mailto:?bcc='+mailTo+'&subject='+subject;
            }
            else{
                locStr='mailto:?bcc='+mailTo;
            }
            window.location.replace(locStr);
            break;
      default:
            locStr='mailto:'+mailTo;
            break;
        //window.alert('Error in pdSendEMail: A valid mode was not specified.');
    }
    //linkto.href = 'mailto:'+mailTo;
    //window.location.replace(locStr) //'mailto:'+qstr+mailTo);
    //window.location.replace('mailto:'+mailTo);
    
}  

//validates an inputed condition before showing confirm message
function conditionalConfirm(value1, value2, operator, confirmMsg){
    var show_confirm = false;
  
    switch (operator)
    {
        case '==' :
            if (value1 == value2){ show_confirm = true; }else{ show_confirm = false; }
            break;
        case '!=' :
            if (value1 != value2){ show_confirm = true; }else{ show_confirm = false; }
            break;
        case '<' :
            if (value1 < value2){ show_confirm = true; }else{ show_confirm = false; }
            break;
        case '<=' :
            if (value1 <= value2){ show_confirm = true; }else{ show_confirm = false; }
            break;
        case '>' :
            if (value1 > value2){ show_confirm = true; }else{ show_confirm = false; }
            break;
        case '>=' :
            if (value1 >= value2){ show_confirm = true; }else{ show_confirm = false; }
            break;
        default:
    }
    
    if(show_confirm == true){
        if(window.confirm(confirmMsg)){
            return true;
        }
        else{
            return false;
         }
    }
    else{
        return true;
    }
}

//selects appropriate event location option
function change_ev_loc_opt(LocItemToSel,OtherItem){
    getObj(LocItemToSel);
    this.obj.disabled = false;;
    getObj(OtherItem);
    this.obj.disabled = true;
   
}


//fcRegistration - reg item
function CheckItem2(id,txtObj){
    var val = txtObj.value; //document.getElementById(txtObj).value;
    val = val.replace(' ','');
    alert(val);
    var chk = new getObj(id); 
    if(isNaN(val) || val.length==0 || val==0){
       txtObj.value = '';
    }
}

function CheckItem(id,totVal,oneVal) {    
   var chk = new getObj(id); 
   chk.obj.checked = true;
   if(oneVal == true){
        ItemChangeOneVal(id,totVal);
   }
   else{
        ItemChange(id,totVal);
   }
}

/* don't need for now
function CheckItemClick(cbObj, item_att_str){
   try{  
         var cbArr = item_att_str.split(",");
         var re = new RegExp('inc',"gi");
         var tbIdBase = cbObj.id.replace(re,'num');
         var tbOjb = ''
         var tot = 0;
          
         for(i=0; i<cbArr.length; i++){
            tbObj = tbIdBase + '_' + cbArr[i].substr(cbArr[i].indexOf('_')+1) + '_txtnum_' + cbArr[i];
            val = document.getElementById(tbObj).value;
            if(!isNaN(val)){
                tot = tot + Number(val);
            }
         }
        alert('tot='+tot);
        if(tot < 1){
            cbObj.checked = false;
        }
        else{
            cbObj.checked = true;
         } 
   }
   catch(err){
       cbObj.checked = false;
       return 0;
   }
}*/

function ItemChange2(cbid,tbobj,item_att_str){
    var chk = new getObj(cbid);
    try{    
        var cbArr = item_att_str.split(",");
        var cbOBj='';
        var currObj='';
        var tot = 0;
        var val='';
        var tmpOut = '';
        for(i=0; i<cbArr.length; i++){
            if(tbobj.id.indexOf(cbArr[i]) > -1){
                currObj = cbArr[i];
                break;
            }    
        } 
        var re = new RegExp(currObj,"gi");
        for(i=0; i<cbArr.length; i++){
            cbObj = tbobj.id.replace(re,cbArr[i]);
            val = document.getElementById(cbObj).value;
            if(!isNaN(val)){
                tot = tot + Number(val);
            }
           // tmpOut = tmpOut + cbObj + ' = ' + val+'\n';
        }  
       //tmpOut = tmpOut + ' total: ' +tot+'\n';
       //alert('tot='+tot+'\n\n\n'+tbobj.id+'\n\n'+item_att_str+'\n\n\n\ncurrObj='+currObj+'\n\n'+tmpOut);
       
       if(tot < 1){
            chk.obj.checked = false;
         }
        else{
            chk.obj.checked = true;
        }
    }
    catch(err){
       chk.obj.checked = false;
       return 0;
   } 
}

function ItemChange(id,totIDs){
    //var itemTot = document.getElementById(totID);
    //alert(document.getElementById(totIDs).value.replace(',','\n'));
    var idArr = document.getElementById(totIDs).value.split(",")
    var chk = new getObj(id);
    var tot = 0;
    var dbStr = '';
    var tbObjVal
    //alert(idArr.length+'\n'+idArr[0]+'\n'+idArr[1]);
    for(i=0; i<idArr.length; i++){
        tbObjVal = document.getElementById(idArr[i]).value.replace(' ','');
        dbStr = dbStr + idArr[i]+' value='+tbObjVal+'\n';
        if(isNaN(tbObjVal) || tbObjVal.length==0 || tbObjVal==0){
            tot = Number(tot) + 0;
        }
        else{
            tot = Number(tot) + Number(tbObjVal);
        }
    }
     
    //alert(idArr.length+'\n'+dbStr+'\nitemTot='+tot); 
    //alert(dbStr);
    if(tot < 1){
        chk.obj.checked = false;
     }
    else{
        chk.obj.checked = true;
    } 
  
}

function ItemChangeOneVal(id,tbVal){
    //var itemTot = document.getElementById(totID);
    //alert(tbVal);
    var chk = new getObj(id);
    var tot = 0;
    tbVal = tbVal.replace(' ','');
    if(isNaN(tbVal) || tbVal.length==0 || tbVal==0){
        tot = Number(tbVal) + 0;
    }
    else{
        tot = Number(tot) + Number(tbVal);
    }
    //alert(idArr.length+'\n'+dbStr+'\nitemTot='+tot); 
    if(tot < 1){
        chk.obj.checked = false;
     }
    else{
        chk.obj.checked = true;
    }  
  
}


 //NS 20697 - found this function on the web.  Used to override
 //the 2 digit to 4 digit date conversion in DateTextBox to
 //fix issue with this not working in Firefox when client side
 //Compare Validator is used
 //
 //http://www.bennadel.com/blog/490-Ask-Ben-Cleaning-Two-Digit-Years-Using-Javascript-And-Regular-Expressions.htm
 //
 // This takes a date string that MIGHT have a two digit year
 // as the last two digits. If it does, this function replaces
 // the two digit year with what it *assumes* is the proper
 // four digit year.
 function CleanDate(strDate){
  
    // Return the cleaned date.
     return(
         strDate.replace(
             // This regular expression will search for a slash
             // followed by EXACTLY two digits at the end of
             // this date string. The two digits are being
             // grouped together for future referencing.
             new RegExp( "/(\\d{1,2})$", "" ),
              
             // We are going to pass the match made by the
             // regular expression off to this function literal.
             // Our arguments are as follows:
             // $0 : The entire match found.
             // $1 : The first group within the match.
             function( $0, $1 ){
                 
                 //If length of $1 is 1 char then replace
                 //with 200 (ie 2000 - 2009) so it will
                 //work like peter's DateTextBox.
                 //Then Check to see if our first group begins with
                 // a zero,1,2,3,or 4(peter's DateTextBox formats up   
                 //to 2049). If so, replace with 20 else
                 // replace with 19.
                 
                 if($1.length==1){
                    //Replace with 200
                    return("/200" + $1);
                 }
                 else{
                     if ($1.match( new RegExp( "^[01234]{1}", "" ) )){
                      
                        // Replace with 20.
                        return( "/20" + $1 );
                      
                     } 
                     else {
                      
                        // Replace with 19.
                         return( "/19" + $1 );
                      
                     }
                }
             }
         )
    );
  
 }
 
 
 //xml base object useful for handling client side xml string for Ajax
 //create new object creating an object new xml();

function xml(){
    this.data;
}

xml.prototype.loadXml = function(xml){
    if (window.ActiveXObject) {
       this.data = new ActiveXObject("Microsoft.XMLDOM"); 
       this.data.async = false; 
       this.data.loadXML(xml);
    } else if (document.implementation && document.implementation.createDocument) {
        this.data= document.implementation.createDocument("","",null);
        var xmlParser = new DOMParser(); 
        this.data = xmlParser.parseFromString(xml, 'text/xml'); 
    } 
}

xml.prototype.returnXml = function() {
    return (this.data.xml)?this.data.xml:this.getXml();
}

xml.prototype.getXml = function() {
    var s=new XMLSerializer();
    return s.serializeToString(this.data);
}

xml.prototype.addNode = function(name) {
    var n=this.data.createElement(name);
    this.data.firstChild.appendChild(n);
    return n;
}

xml.prototype.addAttr = function (n, v) {
    var a=this.data.createAttribute(n);
    a.nodeValue=v;
    return a;
}


//
// pdAjax.js
//


function pdAjaxOnLoad() {
    window.setTimeout("RunRefreshFunc()", 100);
}

function RunRefreshFunc() {
    if (theform.__PDAJAXREFRESHFUNC.value != '') {
        var isSafari = /Safari/.test(navigator.userAgent);
        if (!isSafari) {
            theform.__pdVIEWSTATE.value = theform.__PDAJAXREFRESHVS.value;
            fInitFormChange();
            eval(theform.__PDAJAXREFRESHFUNC.value);
        }
    }
}

function UpdateRefreshFunc(val) {
    theform.__PDAJAXREFRESHFUNC.value = val;
    theform.__PDAJAXREFRESHVS.value = theform.__pdVIEWSTATE.value;
    fInitFormChange();
}

function GetCallbackData(result, context) {
    var xmlDoc;
    if (window.ActiveXObject) {
       xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 
       xmlDoc.async = false; 
       xmlDoc.loadXML(result);
    } else if (document.implementation && document.implementation.createDocument) {
        xmlDoc= document.implementation.createDocument("","",null);
        var xmlParser = new DOMParser(); 
        xmlDoc = xmlParser.parseFromString(result, 'text/xml'); 
    } 
    var DATA = xmlDoc.getElementsByTagName('ITEM');
    for (var i=0;i<DATA.length;i++) {
        var objType = DATA[i].getElementsByTagName('TYPE')[0].firstChild.nodeValue;
        var objID = DATA[i].getElementsByTagName('ID')[0].firstChild.nodeValue;
        var objParam = DATA[i].getElementsByTagName('UPDATEPARAM')[0].firstChild.nodeValue;
        var objValue = DATA[i].getElementsByTagName('VALUE')[0].firstChild.nodeValue;
        if (objID == 'pdViewState') {
           // .Net 2.0 holds form data in __theFormPostData for sending to a callback post.
           // In order for pdViewState to be maintained between callback, we must
           // re-init __theFormPostData.  First set it to a blank value, then call WebForm_InitCallback
           // to populate with updated form values.
           theform.__pdVIEWSTATE.value = objValue;
           fInitFormChange();
        } else if (objType == 'js') {
            eval(objValue); 
        } else {
            var o = new getObj(objID);
            if (o.obj) {
                if(objParam == 'eval'){eval('o.obj'+objValue);} 
                    else {o.obj[objParam] = objValue;};
            }  
        }
         
    }        
}

function StartCallback(objid) { 
    fInitFormChange();
    var o = new getObj(objid); 
    if (o.obj) {
        o.obj.innerHTML = '<div style="padding:50px 0px 50px 9px;text-align:center;font-style:italic;">Loading...</div>';
    }
}

function StartCallbackCust(objid, CustText) { 
    fInitFormChange();
    var o = new getObj(objid); 
    if (o.obj) {
        o.obj.innerHTML = CustText
    }
}

function fInitFormChange() {
   __theFormPostData = '';
    fWebForm_InitCallback();
}

function ShowAjaxStatus() {
    ShowAjaxStatusMsg('Loading...');
}

function ShowAjaxStatusMsg(msg) {
    fInitFormChange();
    var pdAjax = document.getElementById('pdAjaxStatus');
    if ((pdAjax) && (pdAjax.style.display != 'block')) {
        pdAjax.innerHTML = '<div style="float:left;margin-right:5px;"><img src="/podium/images/spinner.gif" width="16px" height="16px" align="absmiddle"></div><div style="float:left;"><i>' + msg + '</i></div>';
        pdAjax.style.display = 'block';
        pdAjax.style.zIndex = '9999999';
        pdAjax.style.left = ((document.body.offsetWidth / 2) - (pdAjax.offsetWidth / 2));
        pdAjax.style.top = document.body.scrollTop + ((document.body.offsetHeight / 2) - (pdAjax.offsetHeight / 2));
    }
}

function HideAjaxStatus() {
    var pdAjax = document.getElementById('pdAjaxStatus');
    if (pdAjax) {
        pdAjax.innerHTML = '';
        pdAjax.style.display = 'none';
    }
}

// Created a custom version of this function to fix bug with muti-select list.
function fWebForm_InitCallback() {
    var count = theForm.elements.length;
    var element;
    for (var i = 0; i < count; i++) {
        element = theForm.elements[i];
        var tagName = element.tagName.toLowerCase();
        if (tagName == "input") {
            var type = element.type;
            if ((type == "text" || type == "hidden" || type == "password" ||
                ((type == "checkbox" || type == "radio") && element.checked)) &&
                (element.id != "__EVENTVALIDATION")) {
                WebForm_InitCallbackAddField(element.name, element.value);
            }
        }
        else if (tagName == "select") {
            var selectCount = element.options.length;
            for (var j = 0; j < selectCount; j++) {
                var selectChild = element.options[j];
                if (selectChild.selected == true) {
                    WebForm_InitCallbackAddField(element.name, selectChild.value);
                }
            }
        }
        else if (tagName == "textarea") {
            WebForm_InitCallbackAddField(element.name, element.value);
        }
    }
}



//
// mml.js
//
function openMML(consoleid, galleryid, mediaid, mediatype) {

	var pGallery = (galleryid > 0)?'&gallery_id=' + galleryid:'';
	var pMedia = (mediaid > 0)?'&mediatype=' + mediatype +'&mediaid=' + mediaid:'';
	
	window.open('/podium/MediaLibrary/player/default.aspx?console_id=' + consoleid + pGallery + pMedia + '&browse=yes&recent=yes', '_blank', 'location=no, menubar=no, scrollbar=no, status=no, resizable=no, height=497, width=700');
	
}


//
// pdMenu.js
//
// finds the top left position of an element
function findPos(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
		    curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function IETrueBody()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body 
}

function pdMenuSetMaxHeight(objid, height) {
	var d = new getObj(objid);
	if (d.obj.offsetHeight > height) d.style.height = height + 'px';
}

function pdMenuSetWidth(objid, width) {
	var d = new getObj(objid);
	d.style.width = width + 'px';
}

//get list of select elements on page
var CountSelects = document.getElementsByTagName('select');

// WH CONSOLE
var WHEXPIN = false;
function initWHEXPIN(val) {
    WHEXPIN = val;
}

function SetWHEXPIN() {
    var WHEXA = document.getElementById('WHEXPINA'); 
    if (WHEXPIN == false) {
        WHEXPIN = true;
        WHEXA.innerHTML = 'autohide';
    } else {
         WHEXPIN = false;
         WHEXA.innerHTML = 'lock';
    }
}

var WHConShow = false;
function ShowWHCon() {
    Show('whWrap');
    WHConShow = true;
}

function HideWHCon() {
    WHConShow = false;
    window.setTimeout("HideWHConDo()", 600);
}

function HideWHConDo() {
    if ((WHConShow == false) && (WHEXPIN == false)) {
        Hide('whWrap');
    }
}
                  

// IFrame //
function pdInitIF(ShowObjID) {
     if (CountSelects.length > 0) {
        var objShow = document.getElementById(ShowObjID);
        var objIF = document.getElementById('pdIFrameDD');
        var objIFStyle = objIF.style;
        objIFStyle.zIndex = objShow.style.zIndex - 10;
        objIFStyle.left = objShow.style.left;
        objIFStyle.top = objShow.style.top;
        objIFStyle.width = objShow.offsetWidth;
        objIFStyle.height = objShow.offsetHeight;  
    }
}

function pdShowIF() {
    if (CountSelects.length > 0) {
        var objIF = document.getElementById('pdIFrameDD');
        objIF.style.visibility = 'visible';
    }
}

function pdHideIF() {
    var objIF = document.getElementById('pdIFrameDD');
    objIF.style.height = '0px';
    objIF.style.width = '0px';
    objIF.style.visibility = 'hidden';
}

/* DROP MENU */
var openDrop = '';
var openDropButton = '';
function pdMenuShowDrop(ButtonID, DropDownID, AlignObjID, AlignType, PopulateFunction, OffSetTop, MyChannelID) {
    var objDrop = document.getElementById(DropDownID);
    var doShow = true;
    if (openDrop != '') {
        if (openDrop == DropDownID) doShow = false;
        pdMenuHideDrop(openDrop);
    }
    if (doShow == true) {
        var objDropStyle = objDrop.style;
        var objAlign = document.getElementById(AlignObjID);
        var pos = findPos(objAlign);
        var posLeft = pos[0];
        var posTop = pos[1]; 
        
                 
        openDropButton = ButtonID;
        openDrop = DropDownID;
        
        // show iframce before callback so it is visible and can be sized
        pdShowIF();
                
        if (PopulateFunction != '') eval(PopulateFunction);
        
        if(MyChannelID)var MyChannel=document.getElementById(MyChannelID);
        var ScrollTop=(MyChannel)?MyChannel.scrollTop:0;
        
        if(MyChannelID){
            objDrop.parentNode.removeChild(objDrop);
            document.body.appendChild(objDrop);
        }
        
        objDropStyle.display = '';
      
        posTop = posTop + objAlign.scrollHeight + OffSetTop - ScrollTop;
        if (AlignType == 'left') {
            posLeft = posLeft;
        } else if (AlignType == 'right') {
            posLeft = (posLeft + objAlign.offsetWidth) - objDrop.offsetWidth;
        }
        
        objDropStyle.left = posLeft;
        objDropStyle.top = posTop;
        objDropStyle.overflow = 'auto';
        objDropStyle.position = 'absolute';
        if(!objDropStyle.zIndex)objDropStyle.zIndex = '999999';
         
        if (PopulateFunction != '') {
            // if using AJAX, delay the sizing of the iframe so content is populated
            window.setTimeout("pdInitIF('" + DropDownID + "')", 500);
        } else {
             pdInitIF(DropDownID);
        }
    }
}

function pdMenuHideDrop(DropDownID) {
    var objDrop = document.getElementById(DropDownID);
    if (objDrop) {            
        objDrop.style.display = 'none';
        objDrop.style.overflow = '';
        pdHideIF();
     }
     openDropButton = '';
     openDrop = '';
}

function pdMenuCheckDrop(e) {
    if (openDrop != '') {
        var objDrop = document.getElementById(openDrop);
        if ((objDrop) && (objDrop.style.display == '')) {
            if (!e) var e = window.event;
            var tg = (window.event) ? e.srcElement : e.target;
            var HideDrop = true;
            var pos = findPos(objDrop);
            var posLeft = pos[0];
            var posTop = pos[1]; 
            var clickX;
            var clickY;
            var btnClicked = false;
            
            var btnObj = tg;
            if (btnObj.id == openDropButton) {
                HideDrop = true;
                btnClicked = true;
            } else {
                 if (btnObj.offsetParent) {
                   while (btnObj = btnObj.offsetParent) {
                        //alert(tmpObj.id + ',' + openDrop);
		                if (btnObj.id == openDropButton) {
		                    // set hidedrop to false if dropdown button click again
		                    // the showDrop function will then close it
		                    HideDrop = false;
		                    btnClicked = true;
		                    break;
		                }
	                }
                }
            }
                      
            if (btnClicked == false) {
            
                if (e.pageX) {
                    clickX = e.pageX;
                    clickY = e.pageY;
                } else {
                    clickX = event.x+IETrueBody().scrollLeft;
                    clickY = event.y+IETrueBody().scrollTop;
                }
                
               if ((clickX > posLeft) && (clickX < (posLeft + objDrop.offsetWidth))) {
                    if ((clickY > posTop) && (clickY < (posTop + objDrop.offsetHeight))) {
                        HideDrop = false;
                    }
                }
                        
                // prevent hiding dropdown when clicking on scrollbar
                if (HideDrop == true) {
                    if (clickX > document.body.clientWidth) HideDrop = false;
                }
                 if (HideDrop == true) {
                    if (clickY > document.body.clientHeight) HideDrop = false;
                }
                
                if (HideDrop == true) {
                    if ((tg.parentNode) && (tg.parentNode.type == 'select-one')) {
                        HideDrop = false;
                    } else if (tg.type == 'select-one') {
                        HideDrop = false;
                    } else if (tg.className.substring(0,6) == 'wheBtn') {
                        HideDrop = false;
                    } else if (tg.id == openDrop) {
                        HideDrop = false;
                    }
                }
                                    
                if (HideDrop == true) {
                   var tmpObj = tg;
                   if (tmpObj.offsetParent) {
                        while (tmpObj = tmpObj.offsetParent) {
                            //alert(tmpObj.id + ',' + openDrop);
			                if (tmpObj.id == openDrop) {
			                    HideDrop = false;
			                    break;
			                }
		                }
	                }
	             }
                   
                if (HideDrop == true) {
                    var t = 0;
                }
            
            }
                                           
            if (HideDrop == true) pdMenuHideDrop(openDrop);
         }
    }
}
document.onmousedown = pdMenuCheckDrop;


// EDIT MENU //
var pdEMObjs = new Array();
var pdEMOn = false;
function pdEMInit(MenuObjId) {
    var MenuObj = document.getElementById(MenuObjId);
    pdEMObjs[pdEMObjs.length] = MenuObj;
}

function pdEMPositionMenu() {
    var MenuObj = document.getElementById('pdEMMenu');
    var objAlign = document.getElementById('lPg');
    var pos = findPos(objAlign);
    var posLeft = pos[0];
    var posTop = pos[1]; 
    
    posTop = posTop - MenuObj.offsetHeight;
    posLeft = (posLeft + Math.floor(objAlign.offsetWidth / 2)) - Math.floor(MenuObj.offsetWidth / 2);
    
    MenuObj.style.top = posTop;
    MenuObj.style.left = posLeft;
    MenuObj.style.visibility = 'visible';
}

function pdEMShowAll(openString, closeString) {
    var LinkObj = document.getElementById('pdEML');
    if (pdEMOn == false) {
        for (var c=0; c < pdEMObjs.length; c++) {
            pdEMObjs[c].style.display = '';
        }
        pdEML.innerHTML = closeString;
        pdEMOn = true;
    } else {
        for (var c=0; c < pdEMObjs.length; c++) {
            pdEMObjs[c].style.display = 'none';
        }
        pdEML.innerHTML = openString;
        pdEMOn = false;
    }
}


// TASK MENU //
function TMTabOver(taskid) {
	for (var i = 1;i <= 4; i++) {
	    var objItem = document.getElementById('tmt' + i + '_' + taskid);
	    if (objItem && (objItem.className == 'tmt' + i)) objItem.className = 'tmt' + i + 'o';
	}
}

function TMTabOff(taskid) {
    for (var i = 1;i <= 4; i++) {
	    var objItem = document.getElementById('tmt' + i + '_' + taskid);
	    if (objItem && (objItem.className == 'tmt' + i + 'o')) objItem.className = 'tmt' + i;
    }
}

var tipOn = 'notset';
function TMShowTip(txt) {
    if (tipOn == 'notset') {
        var val = getCookieValue('TMTT');
        if (val == '') val = '1';
        tipOn = (val == '1') ? 'on' : 'off';
	 }
	 if (tipOn == 'on') ShowTip(txt);
}

function TMToolTipInit(objid) {
    var obj = document.getElementById(objid);
  	var value;
  	if (obj.checked == true) {
  	    value = '1';
  	    tipOn = 'on';
  	} else {
  	    value = '0';
  	    tipOn = 'off';
  	}
  	setCookieValue('TMTT', value);
}

//
// pdToolTip.js
// 
var tipobj = null
var tipifobj
var offsetxpoint=10 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
var gbX=0
var gbY=0

// For info popups (roster cards, equipment info cards, etc.)
// ECD - 18 Aug 2005
var infoWidth

//get list of select elements on page
var selCount = document.getElementsByTagName('select');
                                           
function GetTipObj() {
    if (tipobj == null) {
        if (ie||ns6)
        {
	        tipobj=document.all? document.all["tooltip"] : document.getElementById? document.getElementById("tooltip") : ""
	        tipifobj=document.all? document.all["pdIFrame"] : document.getElementById? document.getElementById("pdIFrame") : ""
        }
    }
}

function ietruebody()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body 
}
 
function ShowTip(thetext)
{ 
    if (ns6||ie)
	{
	    GetTipObj();
		tipobj.innerHTML=thetext;
		enabletip=true
		infoWidth=200
		return false
	}
}
 
function ShowTipNoWidth(thetext)
{ 
    if (ns6||ie)
	{
	    GetTipObj();
		tipobj.innerHTML=thetext;
		enabletip=true
		infoWidth=-1;
		return false
	}
}
 
function ShowTipGB(thetext, x, y)
{ 
   if (ns6||ie)
	{
	    GetTipObj();
	    gbX=x;gbY=y;
		tipobj.innerHTML=thetext;
		enabletip=true
		infoWidth=200
		tipifobj.style.zIndex=eval(tipobj.style.zIndex-1);
		return false
	}
}

// For info popups (roster cards, equipment info cards, etc.)
// ECD - 18 Aug 2005
function ShowInfoTip(pText, pWidth)
{
   if (ns6||ie)
	{
	    GetTipObj();
		tipobj.innerHTML=pText;
		enabletip=true
		infoWidth=pWidth
		return false
	}
}

function PositionTip(e)
{
	if (enabletip)
	{ 
	    GetTipObj();
		var curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft+gbX;
		var curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop+gbY;

		//Find out how close the mouse is to the corner of the window
		var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
		var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
		var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

		//if the horizontal distance isn't enough to accomodate the width of the context menu
		if (rightedge<tipobj.offsetWidth)
			//move the horizontal position of the menu to the left by it's width
			tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
		else if (curX<leftedge)
			tipobj.style.left="5px"
		else

		//position the horizontal position of the menu where the mouse is positioned
		tipobj.style.left=curX+offsetxpoint+"px"

        //same concept with the vertical position
        if (bottomedge < tipobj.offsetHeight)
		{
            tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
        }
		else
		{
            tipobj.style.top=curY+offsetypoint+"px"
         }
         
        tipobj.style.visibility="visible"

		// For info popups (roster cards, equipment info cards, etc.)
		// ECD - 18 Aug 2005
		
		if (infoWidth > 0)
		{
			tipobj.style.width = infoWidth;		
			infoWidth = 0;
		}else if (infoWidth == -1){
			tipobj.style.width='';		
			infoWidth = 0;
		}
        
        //if ie on pc and there are selects then use iframe (tipifobj) and set its dimensions and coordinates to those of the tool tip div
		//if (navigator.platform.indexOf('MacPPC') == -1 && ie && selCount.length>0)
		//{           
			tipifobj.style.visibility="visible";
			tipifobj.style.left = tipobj.style.left;
			tipifobj.style.top = tipobj.style.top;
			tipifobj.style.width = tipobj.scrollWidth;
			tipifobj.style.height = tipobj.scrollHeight;  
		//}		
	}
}

function HideTip()
{
	if (ns6||ie)
	{
        GetTipObj();
		enabletip=false;
        tipobj.style.visibility="hidden";
        tipifobj.style.visibility="hidden"; //hide iframe
        tipobj.style.left="-1000px";
        tipifobj.style.left="-1000px"; //set iframe to same position as tool tip div
	    gbX=0;gbY=0;
        
    }
}

document.onmousemove=PositionTip

//
// pdGallery.js
//
function GalleryChangeImage(galid, direction, showcaption) { 
    eval(galid + 'I += ' + direction); 
    var u = eval(galid + 'Images.length');
    if (eval(galid + 'I') < 0) { 
	    eval(galid + 'I = u'); 
    } 
    if (eval(galid + 'I') == (u + 1)) { 
	    eval(galid + 'I = 0'); 
    } 

    var strImage = eval(galid + 'Images[' + galid + 'I]'); 
    var strCaption = eval(galid + 'ImageCaptions[' + galid + 'I]');
    var objImage = new getObj(galid + 'image');
	
    if(!objImage.obj)return false;
	
    objImage.obj.innerHTML = strImage;
	
    if (u > 0) {
	    var objCount = new getObj(galid + 'count');
	    var strcount =  eval(galid + 'I + 1') + ' of ' + (u + 1); 
	    if (objCount.obj) {
	        var sExistingHTML = objCount.obj.innerHTML;
	        if (sExistingHTML.substring(0,5) == 'Image') {
	            objCount.obj.innerHTML = 'Image ' + strcount;
	        } else {
	            objCount.obj.innerHTML = strcount;
	        }
	    }
    }

    var objCaption = new getObj(galid + 'caption');
    if (objCaption.obj) {
	    if (showcaption == 'True' && strCaption != '') {
		    objCaption.obj.innerHTML = strCaption.replace(/\&#34;/g, '"').replace(/\<a/gi,"<a class='cchlnk'");
		    //.replace("<a ", "<a class='cchlnk' ");
		    objCaption.style.display = '';
	    } else {
		    objCaption.style.display = 'none';
	    }
    }
    return true;
} 
 
function GalleryShowZoom(galid) {
	var strZoom = eval(galid + 'ZImages[' + galid + 'I]');
	if (strZoom != '') {
		pdOpenWindow(strZoom,'', '');
	}
}

function GalleryShowTip(galid) {
	var strCaption = eval(galid + 'ImageCaptions[' + galid + 'I]');
	var strTip = strCaption;
	var strZoom = eval(galid + 'ZImages[' + galid + 'I]');
	if (strZoom != '') {
		var objImage = new getObj(galid + 'image');
		objImage.style.cursor = 'pointer';
		if (strTip != '') {
			strTip += '<br><br>';
		}
		strTip += 'Click for Zoom...';
	}
	if (strTip != '') {
	 //var objCaption = new getObj(galid + 'caption');
	  ShowTip('<div>' + strTip.replace(/\&#34;/g, '"').replace(/\<a/gi,"<a class='cchlnk'") + '</div>'); //style='font-size:inherit;'
	  //.replace("<a ", "<a class='cchlnk' ") + '</div>');
	}
}


//
// fcInquiry.js
//

function ColapseGroup(cell, id, name) { 
    var s=cell.innerHTML
    cell.innerHTML = (s.indexOf('collapse.gif')==-1)?s.replace('expand.gif', 'collapse.gif'):s.replace('collapse.gif', 'expand.gif');
    var o=document.getElementById(id)
    if(o){
        var list=o.getElementsByTagName('tr')
        for(i=0;i<list.length;i++){
            if(list[i].getAttribute('name')==name)
                list[i].style.display=(list[i].style.display=='none')?'':'none';
        }
    }
}


function GetAddress(checked, name) {

    var a1,a2,city,province,region,zip,phone;
    var o_a1,o_a2,o_city,o_province,o_region,o_zip,o_phone;
    var statetb,o_statetb,o_statedd,o_kidstatedd,x,countryCode;
     
    var list=document.getElementsByTagName('input')
    for(i=0;i<list.length;i++){
        if(list[i].id.indexOf('txtf_'+name)>0){
           if (list[i].id.indexOf('txtf_'+name+'_address_1')>0){
                o_a1=list[i]
            }
            else if (list[i].id.indexOf('txtf_'+name+'_address_2')>0){
                o_a2=list[i];
            }
            else if (list[i].id.indexOf('txtf_'+name+'_city')>0){
                o_city=list[i];
            }
            else if (list[i].id.indexOf('txtf_'+name+'_province')>0){
                o_province=list[i];
            }
            else if (list[i].id.indexOf('txtf_'+name+'_region')>0){
                o_region=list[i];
            }
            else if (list[i].id.indexOf('txtf_'+name+'_zip')>0){
                o_zip=list[i];
            }
            else if (list[i].id.indexOf('txtf_'+name+'_phone')>0){
                o_phone=list[i];
            }
            else if (list[i].id.indexOf('txtf_'+name+'1_phone')>0){
                o_phone=list[i];
            }
        }
        else if (list[i].id.indexOf('txtf_address_1')>0){
            if(checked)a1=list[i].value;
        }
        else if (list[i].id.indexOf('txtf_address_2')>0){
            if(checked)a2=list[i].value;
        }
        else if (list[i].id.indexOf('txtf_city')>0){
            if(checked)city=list[i].value;
        }
        else if (list[i].id.indexOf('txtf_province')>0){
            if(checked)province=list[i].value;
        }
        else if (list[i].id.indexOf('txtf_region')>0){
            if(checked)region=list[i].value;
        }
        else if (list[i].id.indexOf('txtf_zip')>0){
            if(checked)zip=list[i].value;
        }
        else if (list[i].id.indexOf('txtf_phone_home')>0){
            if(checked)phone=list[i].value;
        }
        else if (list[i].id.indexOf('f_state_tbProvince')>0){
            if(checked)statetb=list[i].value;
        }
        else if (list[i].id.indexOf('f_' + name + '_state_tbProvince')>0){
            o_statetb=list[i];
        }
    }
   
    var country,o_country;
    list=document.getElementsByTagName('select')
    for(i=0;i<list.length;i++){
        if(list[i].name.indexOf('f_'+name + '_country')>0){
            o_country=list[i]
        }
        else if (list[i].name.indexOf('f_country')>0){
            if(checked)country=list[i].selectedIndex;
            if(checked)countryCode = list[i].value;
        }
        else if (list[i].name.indexOf('f_'+name + '_state')>0){
            o_statedd=list[i]
        }
        else if (list[i].name.indexOf('f_state')>0){
            o_kidstatedd=list[i]
        }
    }

//have 2 state fields
    if (o_kidstatedd&&o_statedd){
        //add try catch to mult state field section to handle wierd bug
        //with ie 6 
        try
        {
            if(checked){
                if (o_kidstatedd.style.display=='none'){
                    //show and populate the textbox
                    o_statetb.style.display='';
                    o_statetb.value=(statetb)?statetb:'';
                    //clear and hide the dropdown
                    for (var q=o_statedd.options.length;q>=0;q--) o_statedd.options[q]=null;
                    o_statedd.style.display = 'none';
                }
                else{
                   //show and populate dropdown from kids dropdown
                   o_statedd.style.display = '';
                   for (var q=o_statedd.options.length;q>=0;q--) o_statedd.options[q]=null;
                   var myEle ;
                   for (var q=0; q<o_kidstatedd.options.length;q++){
                    // alert(o_kidstatedd.options[q].text+'|'+o_kidstatedd.options[q].text);
                    //if (o_kidstatedd.options[q]) alert(o_kidstatedd.options[q].text+'|'+o_kidstatedd.options[q].text);
                        myEle = document.createElement("option") ;
                        myEle.setAttribute("value",o_kidstatedd.options[q].value);
                        var txt = document.createTextNode(o_kidstatedd.options[q].text);
                        myEle.appendChild(txt);
                        o_statedd.appendChild(myEle); 
                   }
                       o_statedd[o_kidstatedd.selectedIndex].selected = true;
                       //clear and hide textbox
                       o_statetb.value = ''
                       o_statetb.style.display = 'none';
                }
            }
           else{
                //clear correct state province control based on which is visible
                if (o_statedd.style.display=='none'){
                    o_statetb.value = ''
                }
                else{
                    o_statedd[0].selected=true;
                }
            }
       }
       catch(err)
       {
          //do noting. we're just supressing the error
       }
     }   
     else if (o_statedd&&o_country&&checked&&country){
        if(country!=o_country.selectedIndex){
            //state not visible for kid, but country changed, synch state/prov for new country
            for (var q=o_statedd.options.length;q>=0;q--) o_statedd.options[q]=null;            
            if (countryCode=="AU"||countryCode=="CA"||countryCode=="GB"||countryCode=="US") 
            {
                o_statetb.value=''
                o_statetb.style.display = 'none';
                o_statedd.style.display = '';
                myEle=document.createElement("option");
                var theText=document.createTextNode("");
                myEle.appendChild(theText);
                myEle.setAttribute("value","");
                o_statedd.appendChild(myEle);
                for ( x = 0 ; x < arrProvince.length  ; x++ ) {
                    prov = arrProvince[x]
                    if ( prov[0] == countryCode ) {
                        myEle = document.createElement("option") ;
                        myEle.setAttribute("value",prov[2]);
                        var txt = document.createTextNode(prov[1]);
                        myEle.appendChild(txt);
                        o_statedd.appendChild(myEle);
                    }
                }
            }
            else{
                o_statetb.style.display = '';
                o_statedd.style.display = 'none';
            }
        }      
     }
     
    if(o_a1)o_a1.value=(a1)?a1:'';
    if(o_a2)o_a2.value=(a2)?a2:'';
    if(o_city)o_city.value=(city)?city:'';
    if(o_province)o_province.value=(province)?province:'';
    if(o_region)o_region.value=(region)?region:'';
    if(o_zip)o_zip.value=(zip)?zip:'';
    if(o_phone)o_phone.value=(phone)?phone:'';    
    if(o_country)o_country[(country)?country:0].selected=true;

    
}



function inquiry_checkall(o, checked, name) {
    
        while(o) {
            if (o.tagName.toLowerCase()=='table') 
                break;
            o=o.parentNode;
        } 
        
        list=o.getElementsByTagName('input')
        for(i=0;i<list.length;i++)
            if(list[i].type=='checkbox')
                if(!list[i].disabled)                  
                    if(list[i].id.indexOf(name)>0)
                        list[i].checked=checked;

}

//
// pdAddress.js
//
function countryChange(countryID, ddID, tbID, txtID, stateID) {
    var ddCountry, dd, tb, txtbox ;
    var hasItems = false ;
    var myEle ;
    var x ;
    var prov = new Array();
    var curVal;
    
    //get the controls
    ddCountry = document.getElementById(countryID);
    dd = document.getElementById(ddID);
    tb = document.getElementById(tbID);                    
    txtbox = document.getElementById(txtID);

    curVal = dd.value;
    
    //clear the dropdown
    for (var q=dd.options.length;q>=0;q--) dd.options[q]=null;
    
    //blank item for dropdown if one of countries we show state/province dd for
    var country;
    country = ddCountry.value;
    if (country=="AU"||country=="CA"||country=="GB"||country=="US") 
    {
        myEle=document.createElement("option");
        var theText=document.createTextNode("");
        myEle.appendChild(theText);
        myEle.setAttribute("value","");
        dd.appendChild(myEle);
    }
    
    //loop through provinces to see if any apply for this country
    for ( x = 0 ; x < arrProvince.length  ; x++ ) {
        prov = arrProvince[x]
        if ( prov[0] == country ) {
            myEle = document.createElement("option") ;
            myEle.setAttribute("value",prov[2]);
            var txt = document.createTextNode(prov[1]);
            myEle.appendChild(txt);
            dd.appendChild(myEle);
            hasItems = true;
            if (curVal == prov[2]) dd.value = curVal;
        }
    }

    //toggle visibility of dropdown and textbox
    if (hasItems == true)
        {
            dd.style.display = '';
            txtbox.style.display = 'none';
            txtbox.value = '';
        }
    else
        {
            txtbox.style.display = '';
            dd.style.display = 'none';
        }

    }



    // Detect Flash
    function HasFlash() {
        var hasFlash = false;
        if (navigator.plugins && navigator.mimeTypes.length) {
            var x = navigator.plugins["Shockwave Flash"];
            if (x && x.description) {
                hasFlash = true;
            }
        } else { 
            try {
                var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
            } catch (e) {
                try {
                    var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
                } catch (e) { }
                try {
                    axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
                } catch (e) { }
            }
            if (axo != null) {
                hasFlash = true;
            }
        }
        return hasFlash;
    }