<!--//

/*'##############################################################
'-- Create Global Variables for checking status of open windows
'##############################################################*/

var winVenApptRequest;
var winPrintFriendlyExList;
var winPrintFriendlySesList;
var winAddRemovePEX;
var winAddRemovePSes;
var browser = getBrowserVersion()
//icon for adding/removing personal exhibitors
var iconAdd = '[+]';
var iconRemove = '[-]';
//defaultErrorPage will be used when scripts are not executed as intended
var defaultErrorPage = '/vtbin/jsScripts/_error.asp';

var defaultPopUpBGColor = '#3f3f3f';//set default pop up bgcolor
//set browser specific variables
switch(browser)
{
    case 'IE':
        var mouseEvent = window.event;
	    var visible = 'visible';
	    var hidden = 'hidden';    
	    break;
    case 'Firefox' :
        var visible = 'show';
        var hidden = 'hide';
	    var mouseEvent = window.Event;
	    break;
    default:
        var visible = 'show';
        var hidden = 'hide';
	    var mouseEvent = window.Event;
	    break;
}
//--END GLOBAL JS VARIABLES--//

//***BEGIN iMapV4 Scripts***//

var winProgressBar;
function displayProgress(){
    if(winProgressBar == null || winProgressBar.closed)	{
        winProgressBar = window.open('/_Incbin/javascript/progressbar.htm','winProgressBar','width=200, height=100');
       
    }
}
function hideProgress(){
    if(!winProgressBar == null)	{
        winProgressBar.close();
    }
}
function hideProgressBarVer4(){
    progressBar = document.getElementById('progBar');
    //alert(progressBar.innerHTML);
    progressBar.style.visibility = hidden;
    progressBar.style.display = 'none';
    if(document.getElementById('progBar')){
        }
}
function showHideVTSection(e, section, action){

    if(action == 'hide'){
        document.getElementById(section).style.display = 'none';
    }
    else{
        document.getElementById(section).style.display = 'block';
    }
}


/*'##############################################################
'-- removeExhibitorFromMyConferencePage()
'##############################################################*/
function removeExhibitorFromMyConferencePage(e, id, venID, popUpBGColor){
    var msg = 'Do you really want to remove this from your list?';
    if (popUpBGColor ==''){
        popUpBGColor = defaultPopUpBGColor;
    }
    //make sure function is called from element
    if (e == '' || id == ''){
        //exit function
        return false();
    }
    if(confirm(msg)){
        var sourcePage = 'personalExList';
        var urlAnchor = '?id=' + id + '&sourcePage=' + sourcePage + '&bgcolor=' + popUpBGColor;
        var url = '/vtBin/PopUps/removePEX.asp' + urlAnchor;
        //var pExRow = document.getElementById(row);
        var personalExListRow  = document.getElementById('personalExListRow'+venID);
        
        //return;
        //alert(url);
        //return;
        if(personalExListRow){
            //alert(personalExListRow.style.visibility);
            personalExListRow.style.display = 'none';
        }
        if(winAddRemovePEX == null || winAddRemovePEX.closed)	{
           
		    winAddRemovePEX = window.open(encodeURI(url), 'winAddRemovePEX', 'width=10,height=10,left=800,top=1000,scrollbars=no');
        }
        else{
            winAddRemovePEX.close();
            winAddRemovePEX = window.open(encodeURI(url), 'winAddRemovePEX', 'width=10,height=10,left=800,top=1000,scrollbars=no');
        }
   }
}
/*--------------------------------
--- FUNCTION addRemoveExhibitor()
--------------------------------*/

//--This function will update (add) a customer's personal exhibitor list
//--called from MyConference page, Virtual Booth Page, Exlist/Search Results page
function addRemoveExhibitor(e, id, rowHighlightColor, popUpBGColor){
     var msg;
     
    if (popUpBGColor ==''){
        popUpBGColor = defaultPopUpBGColor;
    }
    //make sure function is called from element
    if (e == '' || id == ''){
        //exit function
        return false();
    }
   
    //determine if we are adding or removing exhibitor
    var action;
    action = e.innerHTML;
    //action should equal  iconAdd or iconRemove
    
    var msg;
    var url;
    var elementName = e.id.toString();
    //determine which page called this function so we know how to update handling page
    //exlist/search results page - we will update icon. on MyConference Page we will remove the row altogether.
    var sourcePage = '';//possible choice; exList, personalExList, vtBooth
    var exList = 'exListRow';
    var personalExList = 'personalExListRow';
    var vtBooth = 'vtBooth';
    
    //see where this function is called from:
    var exListPattern = new RegExp (exList);//this is from the exhibitorlist/search results
    var personalExListPattern = new RegExp (personalExList);//this is on the MyConference page
    var vtBoothPattern = new RegExp (vtBooth);
    if (exListPattern.test(elementName)){
        sourcePage = 'exList';
    }
    
    if (personalExListPattern.test(elementName)){
        sourcePage = 'personalExList';
    }
    
    if (vtBoothPattern.test(elementName)){
        sourcePage = 'vtBooth';
    }
    
    var urlAnchor = '?id=' + id + '&sourcePage=' + sourcePage + '&bgcolor=' + popUpBGColor;
    //add or remove exhibitor based on value of 'action'
    switch(action){
        case iconAdd:
            url = '/vtBin/PopUps/addPEX.asp' + urlAnchor;
            
        break;
        
        case iconRemove:
            msg = 'Do you really want to remove this from your list?'
            url = '/vtBin/PopUps/removePEX.asp' + urlAnchor;
            
        break;
        
        default:
            location.href = defaultErrorPage;
        break;
    }
    
    

    if(winAddRemovePEX == null || winAddRemovePEX.closed)	{
       if(action == iconRemove){
            if(confirm(msg)){
		        winAddRemovePEX = window.open(encodeURI(url), 'winAddRemovePEX', 'width=10,height=10,left=800,top=1000,scrollbars=no');
		        updateHTML(e,id,action,sourcePage,rowHighlightColor)
            }
        }
        else{
         winAddRemovePEX = window.open(encodeURI(url), 'winAddRemovePEX', 'width=10,height=10,left=800,top=1000,scrollbars=no');
         updateHTML(e,id,action,sourcePage,rowHighlightColor)
        }
    }
    else{
        winAddRemovePEX.close();
        alert('An error has occurred. Please try again.');
        }
        
}
function updateHTML(e, id,action, sourcePage,rowHighlightColor){
    //update page that called function
    switch(sourcePage){
        case 'exList':
            if (action == iconAdd){
                e.innerHTML = iconRemove;
                document.getElementById('row'+id).style.backgroundColor = rowHighlightColor;
                e.title = 'Remove it!';
            }
            else{
                e.innerHTML = iconAdd;
                document.getElementById('row'+id).style.backgroundColor = 'white';
                e.title = 'Add it!';
            }
        break;
        
        case 'personalExList':
           if (action == iconRemove){
                //remove exhibitor from row
                document.getElementById('personalExListRow'+id).style.display.visibility = hidden;
           }
           break;
        
        case 'vtBooth':
            if (action == iconAdd){
                e.innerHTML = iconRemove;
                e.title = 'Remove it!';
            }
            else{
                e.innerHTML = iconAdd;
                e.title = 'Add it!';
            }
        break;
        
        default ://exit gracefully
        break;
    }
}
/*--------------------------------------
Begin Function openAppointmentRequest()
---------------------------------------*/
function openAppointmentRequest(e,id,companyName,companyInfo,rowColor,popUpBGColor,eventEmailFromAlias){
   //alert('e: ' + e.id + '\nid: ' + id + '\nrowcolor: ' + rowColor + '---' + popUpBGColor); 
    //set default
    if(popUpBGColor ==''){
        popUpBGColor = defaultPopUpBGColor;
    }
    var apptReqUrl = '/vtBin/popUps/venApptRequest.asp?id=' + id + '&companyName='+companyName+' & companyInfo='+companyInfo+'&popUpBGColor=' + popUpBGColor+'&eventEmailFromAlias='+eventEmailFromAlias;
    //alert(url);
    //return;
    if(winVenApptRequest == null || winVenApptRequest.closed){
        
        winVenApptRequest = window.open(apptReqUrl, 'winVenApptRequest', 'width=600,height=600,left=0,top=0,scrollbars=yes,reSizable=yes');
        winVenApptRequest.focus();
    }
    else{
     winVenApptRequest.focus();
    }
}
/*-------------------------------------------
BEGIN VALIDATION for Appointment Request form
---------------------------------------------*/
function validateVenApptRequestForm()
{
   
	var bValid = true;
	var name = document.getElementById('txtContactName').value;
	var email = document.getElementById('txtContactEmail').value;
	var org = document.getElementById('txtContactOrg').value;
	//set error messages to ''
	document.getElementById('spnEmailMsg').innerHTML = '';
	document.getElementById('spnOrgMsg').innerHTML = '';
	document.getElementById('spnNameMsg').innerHTML = '';
	
	if (email == '')
	{
		bValid = false;
		document.getElementById('spnEmailMsg').innerHTML = ' Required';
	}
	else//validate email address
	{
		var emailExp = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
		if (!(email.match(emailExp))) 
		{
			bValid=false;
			document.getElementById('spnEmailMsg').innerHTML = ' Invalid';
		}
	}
	
	if (org == '')
	{
		bValid = false;
		document.getElementById('spnOrgMsg').innerHTML = ' Required';
		
	}
	if (name == '')
	{
		bValid = false;
		document.getElementById('spnNameMsg').innerHTML = ' Required';
		
	}
	if(bValid == false)
	{
		return false;
	}
	
}
/*--------------------------------------------
function viewPrinterFriendlyExList(id){
-----------------------------------------------*/
function viewPrinterFriendlyExList(id,pageHeader){
    //alert(id);
    var  url = '/vtBin/PopUps/prnPEX.asp?id=' + id.toString()+'&pageHeader='+pageHeader;
    if(winPrintFriendlyExList == null || winPrintFriendlyExList.closed)	{
       
		winPrintFriendlyExList = window.open(url, 'winPrintFriendlyExList', 'width=400,height=400,left=0,top=0,scrollbars=yes,resizable=yes');
    }
    else
    {
        winPrintFriendlyExList.focus();
    }
}
//***END iMapV4 Scripts***//


/*####----------------####
--BEGIN iSelectV4 Scripts
####------------------####*/

//--This function will update (add) a customer's personal session list
//--called from MyConference page, SesList/Search Results page
function addRemoveSession(e, id, rowHighlightColor, popUpBGColor){
    if (popUpBGColor ==''){
        popUpBGColor = defaultPopUpBGColor;
    }
    //make sure function is called from element
    if (e == '' || id == ''){
        //exit function
        return false();
    }
    
    //determine if we are adding or removing exhibitor
    var action;
    action = e.innerHTML;
    //action should equal  iconAdd or iconRemove
    
    var msg;
    var url;
    var elementName = e.id.toString();
    //determine which page called this function so we know how to update handling page
    //exlist/search results page - we will update icon. on MyConference Page we will remove the row altogether.
    var sourcePage = '';//possible choice; exList, personalExList, vtBooth
    var sesList = 'sesListRow';
    var personalExList = 'personalExListRow';
    
    
    //see where this function is called from:
    var sesListPattern = new RegExp (sesList);//this is from the exhibitorlist/search results
    var personalExListPattern = new RegExp (personalExList);//this is on the MyConference page
    if (sesListPattern.test(elementName)){
        sourcePage = 'sesList';
    }
    
    if (personalExListPattern.test(elementName)){
        sourcePage = 'personalSesList';
    }
    
    
    
    var urlAnchor = '?id=' + id + '&sourcePage=' + sourcePage + '&bgcolor=' + popUpBGColor;
    //add or remove exhibitor based on value of 'action'
    switch(action){
        case iconAdd:
            url = '/vtBin/PopUps/addPSes.asp' + urlAnchor;
            
        break;
        
        case iconRemove:
            url = '/vtBin/PopUps/removePSes.asp' + urlAnchor;
            
        break;
        
        default:
            location.href = defaultErrorPage;
        break;
    }
    
   
  
    if(winAddRemovePSes == null || winAddRemovePSes.closed)	{
        if(action == iconRemove){
            if(!confirm('Do you really want to remove this from your list')){
            
            return false;
            }
        }
		winAddRemovePSes = window.open(encodeURI(url), 'winAddRemovePSes', 'width=10,height=10,left=800,top=1000,scrollbars=no');
		winAddRemovePSes.blur();
    }
    else{
        winAddRemovePSes.close();
        alert('There was a problem saving this record. please refresh the page and try again.');
    }
     //update page that called function
    switch(sourcePage){
        case 'sesList':
            if (action == iconAdd){
                e.innerHTML = iconRemove;
                document.getElementById('row'+id).style.backgroundColor = rowHighlightColor;
                e.title = 'Remove it!';
            }
            else{
               
                e.innerHTML = iconAdd;
                document.getElementById('row'+id).style.backgroundColor = 'white';
                e.title = 'Add it!';
            }
        break;
        
        case 'personalSesList':
           if (action == iconRemove){
                //remove exhibitor from row
                if(!confirm('Do you really want to remove this from your list')){
            
            return false;
            }
                document.getElementById('row'+id).style.display.visibility = hidden;
           }
           break;
        
              
        default ://exit gracefully
        break;
    }
}
/*---View Speaker Bio--*/
var winSpkBio;
function openBio(speakerID,conID,bgColor)
{
    
    if(winSpkBio == null || winSpkBio.closed){
        winSpkBio = window.open('/VTBin/popUps/speakerBio.asp?cid='+conID+'&speakerID='+speakerID+'&bgColor='+bgColor+'','winSpkBio','width=500px,height=400px,scrollbars=yes,resizable=yes');
    }
    else{
        winSpkBio = window.open('/VTBin/popUps/speakerBio.asp?cid='+conID+'&speakerID='+speakerID+'&bgColor='+bgColor+'','winSpkBio','width=500px,height=400px,scrollbars=yes,resizable=yes');

        winSpkBio.focus();
    }
	
}

/*---showSesDescription()*/
function showSesDescription(e,id){

var descriptionText = document.getElementById('sesDescription'+id).value;
var container = document.getElementById('sesDescriptionContainer'+id);
if(e.innerHTML =='View Details'){
    container.style.visibility = visible;
    e.title = 'Hide Details';
    container.innerHTML = '<br>' + descriptionText;
    e.innerHTML = 'Hide Details';
}else{
    container.style.visibility = hidden;
    container.innerHTML = '';
    e.innerHTML = 'View Details';
    e.title = 'View Details';
   
}
//e.focus();

}
/*'##############################################################
'-- removeSessionFromMyConferencePage()
'##############################################################*/
function removeSessionFromMyConferencePage(e, id, row){
    
    var sourcePage = 'personalSesList';
    var url = '/vtBin/PopUps/removePSes.asp?id=' + id+'&sourcePage='+sourcePage;
    var personalExListRow  = document.getElementById(row);
    
    
   
    if(winAddRemovePSes == null || winAddRemovePSes.closed)	{
       if(!confirm('Do you really want to remove this from your list')){
            
            return false;
            }
       
		winAddRemovePSes = window.open(encodeURI(url), 'winAddRemovePSes', 'width=5,height=5,left=1200,top=0,scrollbars=no');
		if(personalExListRow){
        //alert(personalExListRow.style.visibility);
        personalExListRow.style.display = 'none';
    }
		winAddRemovePSes.blur();
    }
    else{
        winAddRemovePSes.close();
        }
}

/*--------------------------------------------
function viewPrinterFriendlySesList(id){
-----------------------------------------------*/
function viewPrinterFriendlySesList(id,pageHeader){
    //alert(id);
    var  url = '/vtBin/PopUps/prnSesList.asp?id=' + id.toString()+'&pageHeader='+pageHeader;
    if(winPrintFriendlySesList == null || winPrintFriendlySesList.closed)	{
       
		winPrintFriendlySesList = window.open(url, 'winPrintFriendlySesList', 'width=764,height=600,left=0,top=0,scrollbars=yes,resizable=yes');
    }
    else
    {
        winPrintFriendlySesList.focus();
    }
}
//***END iSelectV4 Script***//


//GLOBAL VT SCRIPTS
// JScript File

function getBrowserVersion() {
    var agt=navigator.userAgent.toLowerCase();
    if (agt.indexOf("opera") != -1) return 'Opera';
    if (agt.indexOf("staroffice") != -1) return 'Star Office';
    if (agt.indexOf("webtv") != -1) return 'WebTV';
    if (agt.indexOf("beonex") != -1) return 'Beonex';
    if (agt.indexOf("chimera") != -1) return 'Chimera';
    if (agt.indexOf("netpositive") != -1) return 'NetPositive';
    if (agt.indexOf("phoenix") != -1) return 'Phoenix';
    if (agt.indexOf("firefox") != -1) return 'Firefox';
    if (agt.indexOf("safari") != -1) return 'Safari';
    if (agt.indexOf("skipstone") != -1) return 'SkipStone';
    if (agt.indexOf("msie") != -1) return 'IE';
    if (agt.indexOf("netscape") != -1) return 'Netscape';
    if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
    if (agt.indexOf('\/') != -1) {
    if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
    return navigator.userAgent.substr(0,agt.indexOf('\/'));}
    else return 'Netscape';} else if (agt.indexOf(' ') != -1)
    return navigator.userAgent.substr(0,agt.indexOf(' '));
    else return navigator.userAgent;
}
//-->
