﻿
 function showDiv(id)
 {
     var div = document.getElementById(id);
     if (div)
        div.style.display = "block";
 }
 
 function hideDiv(id)
 {
     var div = document.getElementById(id);
     if (div)
        div.style.display = "none";
 }
 
 //checks all DataGrid CheckBoxes with the given name with the given value
function CheckAllDataGridCheckBoxes(aspCheckBoxID, checkVal) 
{		
	var re = new RegExp(aspCheckBoxID);
	
	for(i = 0; i < document.forms[0].elements.length; i++) 
	{
		element = document.forms[0].elements[i];

		if (element.type == 'checkbox') 
		{
			if (re.test(element.name)) 
			{
				element.checked = checkVal
			}
		}
	}
}

  //Uses ajax.js
 function GetHelpPage(pageId)
 {   
	var url = '../getPage.aspx?pageId='+pageId;
    var Ajax = new AJAX(url); 
    if (Ajax.get())
    {
	   showDiv('helpWrapper');
    
	   var helpDiv = document.getElementById('help');
	   helpDiv.innerHTML = Ajax.getResponse();
    }
 }
 
/* Gridview */
var lastClassName;
function gridViewRowOver(tableRow)
{
	if (tableRow != null)
	{
		lastClassName = tableRow.className;
		tableRow.className = 'gridViewRowOver';
	}
}

function gridViewRowOut(tableRow)
{
	if (tableRow != null)
	{
		tableRow.className = lastClassName;
	}
}

function email(address1, address2)
{
	location.href = 'mailto:' + address1 + '@' + address2;
}