﻿// JScript File


var hastableCnt = 0;
//var jobTitleWithRate = 0;
//var jobTitleWithoutRate = 0;
var jobTitleWithout = "";

// use to set current att "key" used in hashtable
var currentke = 0;

// max salary
var maxSalaryIfNotReturnedByPayScale = 300000;

// min salary 
var minSalaryIfNotReturnedByPayScale = 0;

// max hourly rates
var maxHourlyRateIfNotReturnedByPayScale = 150.00;

// min hourly rates
var minHourlyRateIfNotReturnedByPayScale = 0;


// innerHTML for initial edit att
var divEditAttInitial = '<table cellpadding="0" cellspacing="0"  border="0"><tr style="height:181px;"> ' +
'<td style="width:219px" valign="top" > <div class="divEditAtt" > ' +
'<table cellpadding="0"  cellspacing="0" width="100%"   > ' +
'<tr><td><div id="divEditlblAttEditCase"> ' +
'<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr>' +
'<td align="left" valign="middle" style=" width:25px ; text-align:right"><div id="diveditAttImage"><img src="image/InButton.gif" alt="" /></div>' + 
'</td><td id="editabletitle"  style="padding: 0px 0px 0px 0px;width:195px" valign="top"> ' +
'<div id="diveditAttjobTitle" class="jobtitle" ></div></td> ' +
'<td style="width:1" align="right"></td></tr></table></div></td></tr><tr> ' +
'<td style=" height:10px"></td></tr>' +
'<tr><td> ' +
'<div id="divEditAttSalary"> ' +
'<table cellpadding="0" cellspacing="0" border="0" width="100%">' +
'<tr> ' +
'<td align="left" valign="middle" style=" width:25px ; text-align:right"><div id="divEditAttSalarySelected"><img src="image/meetingmiserselectedradiobtn.PNG" alt="" /></div> ' +
'</td><td style="width:3px"></td> ' +
'<td style=" width:174px; text-align:left " class="jobtitle" >Annual Salary</td> ' +
'<td style="width:19" align="right"></td></tr> ' +
'<tr>' +
'<td colspan="3" style="height:5px"></td>' +
'</tr>' +
'<tr><td colspan="3" style="text-align:left" id="divSalarySlider"> ' +
'</td></tr></table>' +
'</div>' +
'</td></tr><tr><td style=" height:10px"></td></tr>' +
'<tr>' +
'<td ><div id="divEditHourlySalary">' +
'<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr> ' +
'<td align="left" valign="middle" style=" width:25px ; text-align:right"><div id="divEditHourlyImage"><img src="image/meetingmiserunselectedradiobtn.PNG" alt="" onClick="showHourlyRates();" /></div>' +
'</td> ' +
'<td style="width:3px"></td>' +
'<td style=" width:174px; text-align:left" class="jobtitle" >Hourly Rate ' +
'</td>' +
'<td style="width:19" align="right"></td>' +
'</tr><tr><td colspan="3" style="height:5px"></td>' +
'</tr><tr> ' +
'<td colspan="3" id="divHourlyRateSlider"></td></tr></table></div>' +
'</td></tr><tr><td style="height:5px"></td></tr>' +
'<tr><td><table cellpadding="0" cellspacing="0" border="0" width="100%"> ' +
'<tr><td style=" width:100px;text-align:right"><input type="image" alt=""  src="image/meetingmisersavetbtn.PNG" onclick="saveAttEdit();" /></td><td style=" width:10px"></td><td><input type="image" alt=""  src="image/meetingmisercanceltbtn.gif" onclick="cancelAttedit();" /></td> ' +
'</tr><tr><td style="height:4px"></td></tr></table></td></tr></table></div></td> ' +
'</tr></table>' ;

// innnerHTML of slider bar
var sliderBar = '<table cellpadding="0" cellspacing="0" border="0" width="100%" style="text-align:left;"><tr><td>&nbsp;&nbsp;</td><td colspan="3" style="width:130px" id="divSlider">' +
'</td>' +
'<td style=" width:5px ; text-align:right " id="divSliderCurrency" class="slidervalue">$</td>' +
'<td style="text-align:left; width:81px " id="divSliderValue" class="slidervalue" ></td></tr><tr>' +
'<td>&nbsp;&nbsp;&nbsp;</td><td style="width:35px ; text-align:left" class="jobtitle" >&nbsp;Low</td><td style="width:39px" class="jobtitle" >Median</td><td style="width:30px ; text-align:right" class="jobtitle" >High</td><td colspan="2"></td><td></td>' +
'</tr></table>';

// innerHTML for job title in Edit mode, need to show text box, instead of Div tag
var divJobTitle = '<div id="attedit" class="yui-ac"  >' +
'   <input id="attinputedit1" type="text" class="yui-ac-input1" onfocus="refreshJobTitle(this);" />' +
'  <div id="attdatasourceedit1" class="yui-ac-container"></div></div>' ;

// innerHTML before edit att, if user click on cancel button, same innerHTML will be shown
var divAttBeforeEdit = '';

// show again jobtitle after editing job title
var divJobTitleAfterEdit = '<div id="diveditAttjobTitle" class="jobtitle" ></div>';

// current Job title
var currentJobTitle = '';

// check if anuuual salary slider bar is visible OR hourly slider bar is visibile, 
var isAnnualSalaryVisible ='yes';

// quoteValue in edit att case
var quoteValueEditCase ;

// used to show alert when no rates available on PayScale
var needToShowNoRateMessage = 'no';

// used to set JOb title again if net is not working

var editJobTitle = '';

// att in
function attIn()
{
    CloseDropdownWindow();   // close edit window
    CloseAlarmDropdownWindow();
    var imageId = currentattEdit;
    var image =document.getElementById(imageId);
    image.src = imageAttInSrc // change image, if image is out
    inOutHashtable.put(currentattEdit, "In"); // chanage value in hashtable, set it to "In"
    updateAccrualRates(); // updated Accrual rates shown in money counter

}

// att out
function attOut()
{
    CloseDropdownWindow(); // close edit window
    CloseAlarmDropdownWindow();
    var imageId = currentattEdit;
    var image =document.getElementById(imageId);
    image.src = imageAttOutSrc  // change image, if image is In   
    inOutHashtable.put(currentattEdit, "Out");// chanage value in hashtable, set it to "Out"
    updateAccrualRates(); // updated Accrual rates shown in money counter    
}

// add new att
function addAttendeedes(ke ,pJobTitle, pCity, pState, pCountry)
{
    try
    {
        jobTitleConnectivityMessage = 'no';
        var url ="../syndication/simplequote.asmx";
        var pl = new SOAPClientParameters();
        pl.add("jobTitle", pJobTitle);
        pl.add("city", pCity);
        pl.add("state", pState);
        pl.add("country", pCountry);
        currentke = ke;
        attendeesJobTitle.put(currentke, pJobTitle);
        if(! attendeesHashtable.containsKey(ke) )
        {
            attendeesHashtable.put(ke, 0); // add key if not in hashtable
        }
        
        objattloading = document.getElementById("attloading");
        if(objattloading != null)
        {
            objattloading.style.display = 'block';
        }
        objattinput1 = document.getElementById("attinput1");
        if(objattinput1 != null)
        {
            objattinput1.style.display = 'none';
        }
            
        SOAPClient.invoke(url, "GetQuote", pl, true, addQuotesToParticipantsList,ke);
    }
    catch(exception)
    {
        jobTitleConnectivityMessage ='yes';
    }
}

// set new Quotes in edit case
function addQuotesToParticipantsListEditCase(resultDO)
{
    var vals = eval(resultDO);
    
    if(vals.Error == "None")
    {
        quoteValueEditCase = vals;	
    }
    if(vals.Error == "NotEnoughData")
	{
		vals.Type = "Salary";
		vals.Average = 0.0;
		vals.Percentile25 = 0;
		vals.Percentile75 = 150000.0;	
		vals.Median = 0.0;	
        quoteValueEditCase = vals;
        
        alert("Pay rate for this job is not available, set the pay rate in edit attendee box.");		
	}	   
    attEditSliderLocationChangeCase();	
}

// call back function when new att added
function addQuotesToParticipantsList(resultDO, responsexml, key)
{   
    var vals = eval(resultDO);
    var isFocusAllow='yes';
    var objattinput1 = document.getElementById("attinput1");
    
    if(isMeetingStarted == 'yes')
    {
        isEditTimerMsgShow = 'yes';
    }
    
    if(vals.Error == "None")
    {  
        combinedRates.put(key, vals);
        if(! inOutHashtable.containsKey(key))
        {
            inOutHashtable.put(key, "In");
        }
        else
        {
            inOutHashtable.put(key, "In");
        }
        
        
        var objimageId = document.getElementById(key);
		if(objimageId != null)
		{
		    objimageId.src="image/InButton.gif"
		}
        updateAccrualRates();
    }
    
    
    if(vals.Error == "NotEnoughData")
	{   
	    if(isCountryChangesTemp == 'yes')
        {
	        if(jobTitleWithout != "" && jobTitleWithout.indexOf(attendeesJobTitle.get(key)) == -1)
	        {
	            jobTitleWithout = jobTitleWithout + attendeesJobTitle.get(key)+ ","
	        }
	        else if(jobTitleWithout == "")
	        {
	          jobTitleWithout = attendeesJobTitle.get(key)+ ","
	        }    
	    }    
	     
		vals.Type = "Salary";
		vals.Average = 0.0;
		vals.Median = 0.0;
		vals.Percentile25 = 0;
		vals.Percentile75 = 150000.0;
		
		if(countryValue == "United States")
	    {
	        vals.Currency = "U.S. Dollar (USD)" ;
		    vals.CurrencySymbol = "${#}";
	    } 
	    if(countryValue == "Canada")
	    {
	        vals.Currency = "Canadian Dollar (CAD)";
		    vals.CurrencySymbol = "C${#}";
	    }
	    if(countryValue == "United Kingdom")
	    {
	        vals.Currency = "British Pound (GBP)";
		    vals.CurrencySymbol = "\243{#}";
	    }
	    if(countryValue == "Australia")
	    {
	        vals.Currency = "Australian Dollar (AUD)";
		    vals.CurrencySymbol = "AU${#}";
	    }
	    if(countryValue == "India")
	    {
	        vals.Currency = "Indian Rupee (INR)";
		    vals.CurrencySymbol = "Rs {#}";
	    }
		
		var objimageId = document.getElementById(key);
		if(objimageId != null)
		{
		    objimageId.src="image/OutButton.gif"
		}
		
		combinedRates.put(key, vals);
        if(! inOutHashtable.containsKey(key) )
        {
            inOutHashtable.put(key, "Out");
        }
        else
        {
            inOutHashtable.put(key, "Out");
        }
        
        needToShowNoRateMessage = 'yes';	
        
        
        // **********************
	    if(needToShowNoRateMessage =='yes' && rateRecomputeafterLocationchanged == 'no')
        {
            if(isEditAtt == 'yes')
            {
                cancelAttedit(); // cancel edit        
            } 
            
            currentattEdit = key;  
            attEdit();          
            needToShowNoRateMessage ='no';
            
            //alert("Pay rate for this job is not available, set the pay rate in edit attendee box.");
            ShowErrorMessage("divAttShow"+key,"Pay rate for this job is not available, set the pay rate in edit attendee box."); 
            isFocusAllow='no';
        }

        if(isEditAtt == 'yes')
        {
            attEditSliderLocationChangeCase();
        }
        updateAccrualRates();
        
        if(jobTitleConnectivityMessage =='yes')
        {
            //alert("PayScale.com is currently unavailable.");
            ShowErrorMessage("divAttShow"+key,"PayScale.com is currently unavailable."); 
            jobTitleConnectivityMessage = 'no';
        }
	}
	
    objattloading = document.getElementById("attloading");
    if(objattloading != null)
        objattloading.style.display = 'none';
    if(objattinput1 != null)
    {
        objattinput1.style.display = 'inline';
        objattinput1.disabled = false;
        objattinput1.value = "";
        if(isFocusAllow == 'yes')
            objattinput1.focus();
        if(BrowserDetect.browser =="Safari")
           getJobTitles();        
    }
	
	if(BrowserDetect.browser =="Safari")
    {
        if(isCountryChangesTemp == 'yes' && hastableCnt == 2)
	    {
            if(jobTitleWithout != "")
            {
                var str1 = jobTitleWithout;
                jobTitleWithout = "";
                isCountryChangesTemp = 'no';
                str1 = str1 + "|";
                str1 = str1.replace(",|",""); 
                
                var divMeetingAtt = document.getElementById("divMeetingAttWhole");
                showChangeCountryMsg(divMeetingAtt,str1)
             }
        }  
    }
	
	else if(isCountryChangesTemp == 'yes' && hastableCnt == 1)
	{
        if(jobTitleWithout != "")
        {
            var str1 = jobTitleWithout;
            jobTitleWithout = "";
            isCountryChangesTemp = 'no';
            str1 = str1 + "|";
            str1 = str1.replace(",|",""); 
            
            var divMeetingAtt = document.getElementById("divMeetingAttWhole");
            showChangeCountryMsg(divMeetingAtt,str1)
         }
    } 
    hastableCnt = hastableCnt - 1; 
	
}

function showChangeCountryMsg(source,csvtitle)
{
    
    var oCurrentNode=source;
    var iLeft=0;
    var iTop =0;
    while(oCurrentNode.tagName!="BODY")
    {
        iTop+=oCurrentNode.offsetTop;
        iLeft+=oCurrentNode.offsetLeft;
        oCurrentNode=oCurrentNode.offsetParent;
    }
    CreateCountryChangeMsgWnd(iLeft + 5 ,iTop + 5,csvtitle);
   
}




// cancel edit att
function cancelAttedit()
{
    var divId = "divAttShow" + currentattEdit;
    var showdivatt =document.getElementById(divId);     
    if(showdivatt != null)
    {
        showdivatt.innerHTML = divAttBeforeEdit ; // set back the same innnerHTML, that was before edit
        
        isEditAtt = 'no';
        currentJobTitle ='';
        quoteValueEditCase = null;
        
        objattloading = document.getElementById("attloading");
        if(objattloading != null)
            objattloading.style.display = 'none';
        objattinput1 = document.getElementById("attinput1");
        if(objattinput1 != null)
        {
            objattinput1.style.display = 'inline';
            objattinput1.value = "";
            objattinput1.focus();
        }
    }
}

// save att after edit
function saveAttEdit()
{
    var sliderValue =document.getElementById("divSliderValue");    // get slider value 
    var quotes = quoteValueEditCase;     
    
    var divResult = parseFloat(sliderValue.innerHTML.replace(",","")); // replace "," from slider value, "," has been used to format currency
    
    // check salary type and set required values
    if( isAnnualSalaryVisible == 'yes' && quotes.Type == "Salary" )
    {
        divResult = divResult;
    }

    if( isAnnualSalaryVisible == 'yes' && quotes.Type == "Hourly" )
    {
        divResult = divResult/totalHoursInYear;
    }

    if( isAnnualSalaryVisible == 'no' && quotes.Type == "Hourly" )
    {
        divResult = divResult;
    }
    if(isAnnualSalaryVisible == 'no' && quotes.Type == "Salary" )
    {
        divResult = divResult * totalHoursInYear;
    }

    quotes.Median = divResult; 	
    
    if(! attendeesEditList.containsKey(currentattEdit) )
    {
        attendeesEditList.put(currentattEdit, "In");
    }
    
    
    combinedRates.put(currentattEdit, quotes); // updated average salary
    
    attendeesJobTitle.put(currentattEdit, currentJobTitle);

    var divId = "divAttShow" + currentattEdit;
    var showdivatt =document.getElementById(divId);     
    showdivatt.innerHTML = divAttBeforeEdit ;
    var jobTitle  = document.getElementById("divDisplayattDesign" + currentattEdit);            
    jobTitle.innerHTML = currentJobTitle; 
    isEditAtt = 'no';     
    
    inOutHashtable.put(currentattEdit, "In");
    var objimageId = document.getElementById(currentattEdit);
	if(objimageId != null)
	{
	    objimageId.src="image/InButton.gif"
	}
    
    
    updateAccrualRates();   // chanage accrual rates after edit
    
    currentJobTitle ='';
    quoteValueEditCase = null;
    
    objattloading = document.getElementById("attloading");
    if(objattloading != null)
        objattloading.style.display = 'none';
    objattinput1 = document.getElementById("attinput1");
    if(objattinput1 != null)
    {
        objattinput1.style.display = 'inline';
        objattinput1.value = "";
        objattinput1.focus();
    }
}


// count att
function countParticipants()
{
    return attendeesHashtable.size();
}

function clearAllParticipants() 
{
    var objbtnClearAll = document.getElementById("btnClearAll");
    if(attendeesHashtable.size() == 1)
    {
        //alert("No participants to remove.")
        if(objbtnClearAll != null)
            ShowErrorMessage("btnClearAll","No participants to remove.");
            
        return;
    }
    showClearAllParticipantsMsg(objbtnClearAll);
    
    /*var agree=confirm("Do you really want to clear all participants?"); // alert before delete    
    if (agree)
    {
        CloseDropdownWindow(); // close window
        
        var attNum = 1;
        var divId = "divAttShow" + attNum;
        var showdivatt =document.getElementById(divId);
        
        do 
        {
            if(showdivatt != null)
            {
                removeKeyFromAllHashTables(attNum);   // update hashtable  
                showdivatt.innerHTML =littlespaceImage;          
                updateAccrualRates();  // chanage accrual rates after delete         
            }
            attNum++;
            divId = "divAttShow" + attNum;
            showdivatt =document.getElementById(divId);
        } while (showdivatt != null)
    }*/
}

function yesBtnClickClearAllParticipantsMsgWnd()
{
        CloseDropdownWindow(); // close window
        
        var attNum = 1;
        var divId = "divAttShow" + attNum;
        var showdivatt =document.getElementById(divId);
        
        do 
        {
            if(showdivatt != null)
            {
                removeKeyFromAllHashTables(attNum);   // update hashtable  
                showdivatt.innerHTML =littlespaceImage;          
                updateAccrualRates();  // chanage accrual rates after delete         
            }
            attNum++;
            divId = "divAttShow" + attNum;
            showdivatt =document.getElementById(divId);
        } while (showdivatt != null)
        
        updatemoneycounter();
        
        CloseClickClearAllParticipantsMsgWnd();
        
}

function showClearAllParticipantsMsg(source,messagetext)
{
    var oCurrentNode=source;
    var iLeft=0;
    var iTop =0;
    while(oCurrentNode.tagName!="BODY")
    {
        iTop+=oCurrentNode.offsetTop;
        iLeft+=oCurrentNode.offsetLeft;
        oCurrentNode=oCurrentNode.offsetParent;
    }
    createClearAllParticipantsMsg(iLeft + 5 ,iTop + 5,messagetext);
}


// detete att
function attDelete()
{
    
    var divId = "divAttShow" + currentattEdit;
    var source =document.getElementById(divId)
        
    var oCurrentNode=source;
    var iLeft=0;
    var iTop =0;
    while(oCurrentNode.tagName!="BODY")
    {
        iTop+=oCurrentNode.offsetTop;
        iLeft+=oCurrentNode.offsetLeft;
        oCurrentNode=oCurrentNode.offsetParent;
    }
    CreateDeleteMeetingAttMsgWnd(iLeft + 5 ,iTop + 5);
    
    if( countParticipants() == 2) // check if there is only one att
    {
        
        var objtdDeleMeetingAtt = document.getElementById("tdDeleMeetingAtt");
        if(objtdDeleMeetingAtt != null)
        {
            objtdDeleMeetingAtt.innerHTML = "At least one participant should be present.";
        }
        
        var objbtnYesDeleteMeetingAtt = document.getElementById("btnYesDeleteMeetingAtt");
        var objbtnNoDeleteMeetingAtt = document.getElementById("btnNoDeleteMeetingAtt");
        if(objbtnYesDeleteMeetingAtt != null)
        {
            objbtnYesDeleteMeetingAtt.style.display = 'none';
        }
        if(objbtnNoDeleteMeetingAtt != null)
        {
            objbtnNoDeleteMeetingAtt.style.display = 'none';
        }
        
        CloseDropdownWindow();
    }
}

function deleteMeetingAttMessageOkClick()
{
    CloseDropdownWindow(); // close window

    var divId = "divAttShow" + currentattEdit;
    var showdivatt =document.getElementById(divId);

    if(showdivatt != null)
    {
        removeKeyFromAllHashTables(currentattEdit);   // update hashtable  
        showdivatt.innerHTML =littlespaceImage;          
        updateAccrualRates();  // chanage accrual rates after delete         
    }
    CloseDeleteMeetingAttMessage();
}

// open job title input box, in edit case
function openJobTitleInput()
{
    var joblbldisplay  = document.getElementById("editabletitle");     
    joblbldisplay.innerHTML = divJobTitle;
    editJobTitle = currentJobTitle;
    getJobTitlesEditCase();
}

// Get job titles
function getJobTitlesEditCase()
{
    try
    {
        var txtMeetingAtt = document.getElementById("attinputedit1");
        if(txtMeetingAtt != null)
        {
            this.oACDS = new YAHOO.widget.DS_XHR("../complete.aspx", ["Answers","sv"]);
            this.oACDS.queryMatchContains = true;
            this.oACDS.scriptQueryParam  ="s"; 
            this.oACDS.scriptQueryAppend = "field=Job&sa=n&ss=n&min=5";    
            // Instantiate AutoComplete
            this.oAutoComp = new YAHOO.widget.AutoComplete("attinputedit1","attdatasourceedit1", this.oACDS);
            this.oAutoComp.itemSelectEvent.subscribe(showTempJobTitle);
            this.oAutoComp.typeAhead = true;
            if(currentJobTitle != '')
            {
                txtMeetingAtt.value = currentJobTitle;
            }
        } 
    } 
    catch(exception)
    {
        //alert("PayScale.com is currently unavailable.");
        ShowErrorMessage("attinputedit1","PayScale.com is currently unavailable.");
        currentJobTitle = editJobTitle;
        attEditSliderLocationChangeCase();
    }       
}

// Fix to allow this to be attached to the autocomplete event - otherwise displayTempJobTitle() destroys the autocomplete mid-process & breaks IE
function showTempJobTitle() 
{ 
    setTimeout("displayTempJobTitle();", 10);
}

// display temp job title when User edit job Title
function displayTempJobTitle()
{
    try
    {
        currentJobTitle = document.getElementById("attinputedit1").value;
        var url ="../syndication/simplequote.asmx";
        var pl = new SOAPClientParameters();
        pl.add("jobTitle", currentJobTitle);
        pl.add("city", cityValue);
        pl.add("state", stateValue);
        pl.add("country", countryValue);
        SOAPClient.invoke(url, "GetQuote", pl, false, addQuotesToParticipantsListEditCase);
    }
    catch(exception)
    {
        //alert("PayScale.com is currently unavailable.");
        ShowErrorMessage("attinputedit1","PayScale.com is currently unavailable."); 
        currentJobTitle = editJobTitle;
        attEditSliderLocationChangeCase();
    }
}

// refresh slider bar after any changes in locations or others values if edit att is opened
function attEditSliderLocationChangeCase()
{
    var divId = "divAttShow" + currentattEdit;
    var showdivatt =document.getElementById(divId);

    if(showdivatt != null)
    {
        showdivatt.innerHTML =divEditAttInitial;            
        var jobTitle  = document.getElementById("diveditAttjobTitle");            
        jobTitle.innerHTML = currentJobTitle;            
        var jobInOut = document.getElementById("diveditAttImage");

        if(inOutHashtable.get(currentattEdit) == "In")
        {
            jobInOut.innerHTML = '<img src="image/InButton.gif" alt="" />'
        }
        else
        {
            jobInOut.innerHTML = '<img src="image/OutButton.gif" alt="" />' 
        }

        if(isAnnualSalaryVisible =='yes') // check which slider bar was opened before chnages made in location Or other values
        {
            showAnnualSalary(); 
        }
        else
        {
            showHourlyRates();               
        }
    }
}


// edit att , when user click on Edit image button in window
function attEdit()
{
    CloseDropdownWindow();   // close window   
    CloseAlarmDropdownWindow();   
    isEditAtt = 'yes'

    var divId = "divAttShow" + currentattEdit;
    var showdivatt =document.getElementById(divId);        
    divAttBeforeEdit = showdivatt.innerHTML;

    if(showdivatt != null)
    {
        showdivatt.innerHTML =divEditAttInitial;             
        var jobTitle  = document.getElementById("diveditAttjobTitle");  
        currentJobTitle = attendeesJobTitle.get(currentattEdit);            
        jobTitle.innerHTML = attendeesJobTitle.get(currentattEdit);            
        var jobInOut = document.getElementById("diveditAttImage");

        if(inOutHashtable.get(currentattEdit) == "In")
        {
            jobInOut.innerHTML = '<img src="image/InButton.gif" alt="" />'
        }
        else
        {
            jobInOut.innerHTML = '<img src="image/OutButton.gif" alt="" />' 
        }

        var quoteValue = combinedRates.get(currentattEdit);
        quoteValueEditCase = quoteValue;
        
        if(quoteValue != null)
        {
            if(quoteValue.Type == "Hourly")
            {
                showHourlyRates();
                isAnnualSalaryVisible ='no';
            }
            else
            {
                isAnnualSalaryVisible ='yes';
                showAnnualSalary();
            }
        }
        else
        {
            //quoteValue.Type = "Salary";
            isAnnualSalaryVisible ='yes';
            showAnnualSalary();
        }
    }
}

// show annual salary slider bar
function showAnnualSalary()
{
    isAnnualSalaryVisible ='yes';
    hourlySlider =  document.getElementById("divHourlyRateSlider");
    hourlySlider.innerHTML = "";

    var salarySlider = document.getElementById("divSalarySlider");
    salarySlider.innerHTML = sliderBar;

    var quoteValue = quoteValueEditCase;         
    var minSlider ;
    var maxiSlider ;
    var currentPoint ;
    if(quoteValue != null)
    {
        if(quoteValue.Type == "Salary")
        {
            minSlider = parseInt(round(quoteValue.Percentile25 * 0.5));
            maxiSlider = parseInt(round(quoteValue.Percentile75 * 2));	        
            currentPoint = parseInt(round(quoteValue.Median));
        }
        else
        {
            minSlider = parseInt(round(quoteValue.Percentile25 * 0.5) * totalHoursInYear);
            maxiSlider = parseInt(round(quoteValue.Percentile75 * 2) * totalHoursInYear);	        
            currentPoint = parseInt(round(quoteValue.Median) * totalHoursInYear);
        }
        displaySlider(minSlider,maxiSlider,currentPoint , 1);  
    }
    else
    {
        displaySlider(minSalaryIfNotReturnedByPayScale ,maxSalaryIfNotReturnedByPayScale ,minSalaryIfNotReturnedByPayScale  , 1);
    }
    var hourlyImage = document.getElementById("divEditHourlyImage" );
    hourlyImage.innerHTML = ' <img src="image/meetingmiserunselectedradiobtn.PNG" alt="" onClick="showHourlyRates();" />';

    var salaryImage = document.getElementById("divEditAttSalarySelected" );

    salaryImage.innerHTML = '<img src="image/meetingmiserselectedradiobtn.PNG" alt="" />' ;   
}


// common function used to call both slider bar, salary and hourly
function displaySlider(minSlider, maxiSlider, currentPoint , step)
{
    var displaytext = document.getElementById("divSlider" );
    var A_TPL = {
        'b_vertical' : false,
        'b_watch': true,
        'n_controlWidth': 117,
        'n_controlHeight': 22,
        'n_sliderWidth': 16,
        'n_sliderHeight': 21,
        'n_pathLeft' : 1,
        'n_pathTop' : 1,
        'n_pathLength' : 99,
        's_imgControl': 'image/sliderbuttonback.PNG',
        's_imgSlider': 'image/sliderbutton.PNG',
        'n_zIndex': 1
    }
    var A_INIT = {
        's_name': 'divSliderValue',
        'n_minValue' : minSlider,
        'n_maxValue' : maxiSlider,
        'n_value' : currentPoint,
        'n_step' : step 
    }

    new slider(A_INIT, A_TPL ,displaytext ); 	        
    var  sliderCurrency =  document.getElementById("divSliderCurrency");	       
    sliderCurrency.innerHTML= currentSelectedCurrency;
}

// show hourly slider bar
function showHourlyRates()
{
    isAnnualSalaryVisible ='no';
    var salaryImage = document.getElementById("divEditAttSalarySelected" );     
    salaryImage.innerHTML = '<img src="image/meetingmiserunselectedradiobtn.PNG" alt="" onClick="showAnnualSalary();" />' ;     
    var salarySlider = document.getElementById("divSalarySlider");     
    salarySlider.innerHTML = "";    
    hourlySlider =  document.getElementById("divHourlyRateSlider");
    hourlySlider.innerHTML = sliderBar;

    var quoteValue = quoteValueEditCase;

    var minSlider ;
    var maxiSlider ;
    var currentPoint ;
    if(quoteValue != null)
    {
        if(quoteValue.Type == "Salary")
        {
            minSlider = round((quoteValue.Percentile25 * 0.5)/ totalHoursInYear);
            maxiSlider = round((quoteValue.Percentile75 * 2)/ totalHoursInYear);	        
            currentPoint = round((quoteValue.Median)/ totalHoursInYear);
        }
        else
        {
            minSlider = round(quoteValue.Percentile25 * 0.5) ;
            maxiSlider = round(quoteValue.Percentile75 * 2) ;	        
            currentPoint =round(quoteValue.Median) ;
        }

        displaySlider(minSlider,maxiSlider,currentPoint , .5);
    }
    else
    {
        displaySlider(minHourlyRateIfNotReturnedByPayScale ,maxHourlyRateIfNotReturnedByPayScale ,minHourlyRateIfNotReturnedByPayScale  , .5);
    }
    var hourlyImage = document.getElementById("divEditHourlyImage" );
    hourlyImage.innerHTML = ' <img src="image/meetingmiserselectedradiobtn.PNG" alt="" />';
}

// remove all values when att deleted
function removeKeyFromAllHashTables(key)
{
    attendeesHashtable.remove(key);
    combinedRates.remove(key);
    inOutHashtable.remove(key);
    attendeesJobTitle.remove(key);
    attendeesEditList.remove(key);
}




