//<![CDATA[

function toggleDisplay(numRanges,num) {
       
	//Set Range ID to check if it exists
	var temp = document.getElementById('Range' + num)
	
	if(temp) {
		var row = document.getElementById('Range' + num);
	}
	//alert('hello'+num);
	
	//Let's assume there are 10 job status at the max and reset all of it's layers display to none
	for(var j=0; j < 10; j++)
	{ 
        if(document.getElementById('Range'+j))
        {
        b=document.getElementById('Range'+j);
        
        b.style.display = 'none'; 
        
        } 
    }
	
    if(temp) {
    //Let's show the layer corresponding to the option checked.
    row.style.display = "inline";
    }
}

function toggleJobStatus() {
	/*
	var comboValue
    var selIndex = document.frmJobPowerSearch.strCategories.selectedIndex;
    comboValue = document.frmJobPowerSearch.strCategories.options[selIndex].value;
    */
    
	//get the count of Selected items
	count = 0;
    for (var i = 0; i<=document.frmJobPowerSearch.strJobStatus.length-1; i++) {
        if (document.frmJobPowerSearch.strJobStatus.options[i].selected) {
        count = count + 1;
      }
    }  
    
    //select salary only when single status is selected
    if (count == 1)
    {
        //alert("Now show salary")   
        num = (document.frmJobPowerSearch.strJobStatus.selectedIndex); 
        
        //Set Range ID to check if it exists
	    var temp = document.getElementById('Range' + num)
    	
	    if(temp) {
		    var row = document.getElementById('Range' + num);
	    }
	    //alert('hello'+num);
    	
	    //Let's assume there are 10 job status at the max and reset all of it's layers display to none
	    for(var j=0; j < 10; j++)
	    { 
            if(document.getElementById('Range'+j))
            {
            b=document.getElementById('Range'+j);
            
            b.style.display = 'none'; 
            
            } 
        }
    	
        if(temp) {
        //Let's show the layer corresponding to the option checked.
        row.style.display = "inline";
        }
    }
    else
    {
        //alert("Hide Salary")
        for(var j=0; j < 10; j++)
	    { 
            if(document.getElementById('Range'+j))
            {
            b=document.getElementById('Range'+j);
            
            b.style.display = 'none'; 
            
            } 
        }
    }
}

function SwitchTabs(num,strDivID) {
	//Set Range ID to check if it exists
	var temp = document.getElementById(strDivID + num)
	
	if(temp) {
		var row = document.getElementById(strDivID + num);
	}
	//hide all existing divs - up to 10
	for(var j=0; j < 10; j++) { 
        if(document.getElementById(strDivID+j)) {
			b=document.getElementById(strDivID+j);   
			b.style.display = 'none'; 
        } 
    }
    if(temp) {
    //Let's show the layer corresponding to the option checked.
    row.style.display = "block";
    }
}


/* ==========================
Script for tabs on homepage. Used for Categories and Locations module
=========================== */

//global var for tabs id. needed in a few functions
tab = 'tabLink'

function getSearchInfo(numType) {
	if(!isNaN(numType)) {
		SwitchTabs(numType,'ColList');
		ChangeSearchTabs(tab,numType);
	}
	else {
		return false
	}
}

function ChangeSearchTabs(strTabs,numTab) {
	if(strTabs) {
		var i;
		for(i=0;i<2;i++) {
			document.getElementById(tab+i).style.backgroundColor = getStyle(tab+numTab,'background-color');
			document.getElementById(tab+i).style.borderBottomColor = getStyle(tab+numTab,'border-color');
		}
		document.getElementById(tab+numTab).style.backgroundColor = '#F5F5F5';
		document.getElementById(tab+numTab).style.borderBottomColor = '#F5F5F5';
	}
}
//This reads CSS styles for whatever property it is parsed.
function getStyle(el,styleProp)
{
	var x = document.getElementById(el);
	if (x.currentStyle) {
		var numPosDash = styleProp.indexOf('-')
		var strDash = styleProp.charAt(numPosDash)
		var str1stChr = styleProp.charAt(numPosDash+1)
		var temp
		if(numPosDash) {
			temp = styleProp.replace(strDash+str1stChr,str1stChr.toUpperCase());
		}
		var y = x.currentStyle[temp];
	}
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}

function TabInit() {
	var tab0 = document.getElementById(tab+'0')
	var tab1 = document.getElementById(tab+'1')
	var i
	
	for(i=0;i<2;i++) {
		if(document.getElementById(tab+i)) {
			ChangeSearchTabs(tab,i);
			break
		}
	}
}

//]]>
