﻿function Browser() {
	var ua, s, i;
	ua = navigator.userAgent;
	s = "MSIE";
	if ((i = ua.indexOf(s)) >= 0) {		
		return true; // if browser is IE
	}
	return false; // if browser is not IE
}

function writeEmail(name, domain, ext) {
    var at = "@";
    var dot = ".";
    var email = name + at + domain + dot + ext;
    document.write('<a href="mailto:' + email + '" title="' + email + '">' + email + '<\/a>');
}

function toggleLrgImg(id,show) {
    var src = document.getElementById("lrg"+id).src.toLowerCase();
    if(src.indexOf(".jpg") == -1 && src.indexOf(".gif") == -1 && src.indexOf(".png") == -1 && src.indexOf(".bmp") == -1) {
        return;
    }
	
	var width = document.getElementById(id).width + 5 + "px";		
	document.getElementById("lrg"+id).style.display = "none";
	if(show) {
		document.getElementById("lrg"+id).style.display = "block";
		// if browser is not IE
		if(!Browser()) {
			document.getElementById("lrg"+id).style.marginLeft = width;
		}
	}
}


function PopEmailLink()
{

    // prepare the modal window...this is the window that welcomes users to the 
    // view classes page.
    var popString = "/RevealEmail/?height=210&width=450&modal=true&KeepThis=true&TB_iframe=true";
    
  //pop the window
    var modalWindow = tb_show("", 
        popString, 
        ""); 
        
}

function checkMe(chk) {
    var ids = document.getElementById("ctl00_ContentPlaceHolder1_hidIds").value;
    ids = ids.replace("|" + chk.value + "|","");
    ids = ids.replace(",,",",");
    if(ids.indexOf(",") == 0) {
        ids = ids.substring(1,ids.length);
    }
    if(ids.lastIndexOf(",") == 0) {
        ids = "";
    }
    if(chk.checked) {
        ids += "|" + chk.value + "|,";
    }
    document.getElementById("ctl00_ContentPlaceHolder1_hidIds").value = ids;
}

function checkEmAll(all) {
    var chk = document.getElementsByName("chk");
    for(var i=0; i<chk.length; i++) {
        chk[i].checked = false;
        if(all.checked) {
            chk[i].checked = true;            
        }
        checkMe(chk[i]);
    }
}
