function validateForm(rf)
{
    var requiredFields = (rf != null) ? rf : document.getElementById("RequiredFields").value;
    if(requiredFields == "" || requiredFields == null)
    {
        alert("An error occured!");
        return;
    }
    
    var arrFields = new Array();
    if(requiredFields.indexOf(";") > -1)
    {
        arrFields = requiredFields.substring(0, requiredFields.length-1).split(";");
    }
    else
    {
        arrFields[0] = requiredFields;
    }
    
    for(var f = 0; f < arrFields.length; f++)
    {
        if(document.getElementById(arrFields[f]))
        {
            if(document.getElementById(arrFields[f]).tagName.toLowerCase() == "TEXTAREA")
            {
                document.getElementById(arrFields[f]).style.background = "url(images/ctxtabg_required.png)";
            }
            else
            {
                document.getElementById(arrFields[f]).style.background = "url(images/cfieldbg_required.png)";
            }
        }
    }
    
}

function checkBrowser()
{   
		
		if(navigator.userAgent.indexOf("MSIE") != -1 && parseFloat(navigator.userAgent.substring (navigator.userAgent.indexOf("MSIE") + String("MSIE").length + 1)) < 7)
		{    		
        var msgbox = '';
    		msgbox += '<div id = "getie7" style = "left:' + ((screen.width / 2)-125)  + 'px;">';
    		msgbox += '<div class = "ielogo"><img src = "images/icon_ie7.gif" alt = "Internet Explorer 7" /></div>';
    		msgbox += '<div class = "text">';
    		msgbox += '<h5>Hi There, and welcome to WhichDoctor&trade;!</h5>';
    		msgbox += '<p>We noticed that you are still using an old version of Internet Explorer to view WhichDoctor&trade;.</p>';
    		msgbox += '<p><b>We highly recommend upgrading to<br />Internet Explorer 7</b></p>';
    		msgbox += '<p>Internet Explorer 7 has a bunch more useful and security features that will make using WhichDoctor&trade; and browsing the internet in general much easier and safer.</p>';
    		msgbox += '</div>';
    		msgbox += '<div class = "buttons">';
    		msgbox += '<button onclick = "popIe7Win();" onmouseover = "this.className = \'hov\'" onmouseout = "this.className = \'\'" style = "margin-right:5px;">Get Upgrade</button>';
    		msgbox += '<button onclick = "closeBrowserCheck();" onmouseover = "this.className = \'hov\'" onmouseout = "this.className = \'\'">Ignore</button>';
    		msgbox += '</div>';
    		msgbox += '</div>';
    		
    		document.getElementById("footer").innerHTML = msgbox; 
		}
}

function closeBrowserCheck()
{
    document.getElementById("getie7").style.display = "none";
}

function popIe7Win()
{
    window.open("http://www.microsoft.com/windows/downloads/ie/getitnow.mspx");
		window.open("http://www.microsoft.com/windows/products/winfamily/ie/features.mspx");
}

function bookmark()
{
    if(window.sidebar)
  	{ 
  		  window.sidebar.addPanel(document.title, window.location, "");
    }
  	
		if (window.external)
  	{ 
  		  window.external.AddFavorite(window.location, document.title); 
    }
}
