var sLastColorUsed;

function highlightRow(oRow, bIsHighlighted, colorHL, colorFont)
{   
	if (bIsHighlighted)
	{
		sLastColorUsed = oRow.style.backgroundColor;
		oRow.style.cursor = "pointer";
		oRow.style.backgroundColor = colorHL;
		oRow.style.color = colorFont;
	}
	else
	{
		oRow.style.backgroundColor = sLastColorUsed;
		oRow.style.color = '#000000';
	}
}


function PrintDiv(elementId, printId, closeId)
{

    try
    { 
        var oIframe = document.getElementById('ifrmPrint');
        var oContent = document.getElementById(elementId).innerHTML;
        var oDoc = (oIframe.contentWindow || oIframe.contentDocument);

        if (oDoc.document) oDoc = oDoc.document;

        oContent = oContent.replace("id=imgPrint", "id=imgPrint style=\"visibility:hidden;\"")
	    oContent = oContent.replace("id=imgClose", "id=imgClose style=\"visibility:hidden;\"")
	    oContent = oContent.replace("#666666", "#ffffff");
	    oContent = oContent.replace("#666666", "#ffffff");
	    oContent = oContent.replace("#666666", "#ffffff");
	    oContent = oContent.replace("#666666", "#ffffff");
	
        oDoc.write('<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">');
        oDoc.write('<html><head>');
        oDoc.write('<link rel=\"stylesheet\" type=\"text/css\" href=\"../CSS/styles.css\" />');
        oDoc.write('<link rel=\"stylesheet\" type=\"text/css\" href=\"../CSS/BecomeTeacherInternational.css\" />');
        oDoc.write('</head><body class=\"section1\" onload=\"self.focus(); self.print();\">');
        oDoc.write('<div id="divCountrySpecInfoContents">');
        oDoc.write(oContent);
        oDoc.write('</div></body></html>');
        oDoc.close(); 
        	 
    }
    catch(e)
    {
        var txt="There was an error on this page.\n\n";
        txt+="Error description: " + e.description + "\n\n";
        txt+="Error message: " + e.message + "\n\n";
        txt+="Click OK to continue.\n\n";
        alert(txt);
    }

} 

//function used to show/hide divs
function displayCountryAreaList (IDbase, IDnum, numSections) {
	
	// declare some variables
	var styleCurrent = 'block';
	var ID;
	var ImgID;

	// Loop through each block
	for (count=1; count<=numSections; count++) 
	{
		ID = IDbase + count;
		ImgID = 'img_' + ID
		
		// if the block is the same as the ID, change its state
		if (count == IDnum) 
		{
			// check its state and then change it
			state = document.getElementById(ID).style.display;

			if (state == 'none') 
			{
				document.getElementById(ID).style.display = 'block' ;
				document.getElementById(ImgID).src = '/images/Countries/CollapseIcon.png'; 
			}
			else
			{
				document.getElementById(ID).style.display = 'none'
				document.getElementById(ImgID).src = '/images/Countries/ExpandIcon.png';
			}

		}
		else
		{
			document.getElementById(ID).style.display = 'none';
			document.getElementById(ImgID).src = '/images/Countries/ExpandIcon.png';
		}
	}
}
	
//function used to show/hide divs
function displayContent (IDbase, IDnum, numSections) {
	// declare some variables
	var styleCurrent = 'block';
	var ID;
	
	/*
	Jan 15th, 2008 - Lee Beckman - The way this function works now, you can remove the following for loop, if
	statement, change ID = IDbase + count to ID = IDbase + IDnum, and drop the numSections argument of achieve
	the same effect faster.
	*/
	// Loop through each block
	for (count=1; count<=numSections; count++) {
		ID = IDbase + count;
		// if the block is the same as the ID, change its state
		if (count == IDnum) 
		{
			// check its state and then change it
			state = document.getElementById(ID).style.display;
			(state == 'block') ? document.getElementById(ID).style.display = 'none' : document.getElementById(ID).style.display = 'block' ; 
		}
		else
		{
			document.getElementById(ID).style.display = 'none';
		}
	}
}

//function used to show/hide divs with id source click
function displayContentSource(IDbase, IDnum, numSections, Source) {
		
	// declare some variables
	var styleCurrent = 'block';
	var ID;
	var SourceID;
	
	// Loop through each block
	for (count=1; count<=numSections; count++) {
		ID = IDbase + count;
		SourceID = Source + count;
		
		 	
		// if the block is the same as the ID, change its state
		if (count == IDnum) 
		{
			document.getElementById(SourceID).style.fontWeight = 'bold';	
			
			// check its state and then change it
			state = document.getElementById(ID).style.display;
			if (state != 'block') 
			{
				document.getElementById(ID).style.display = 'block' ; 
			}
		}
		 
		// otherwise we will always want it hidden
		else 
		{
			document.getElementById(ID).style.display = 'none';
			document.getElementById(SourceID).style.fontWeight = 'normal'; 
		}
	}
}