/*requires jquery-1.3.2.min.js*/

$(function() {
	$(".PPagePopup").click(function(){
		 return openWin("Popup" + $(this).attr("href"), "PPage", "width=510,height=550");
	});
	$(".CertPopup").click(function(){
		return openWin("Popup" + $(this).attr("href"), "Cert", "width=510,height=550");
	});
	$(".CompareLinkPopup").click(function(){
		var noOfCheckedCBs = $("tbody input:checked").length;
		if (noOfCheckedCBs > 0) {
			$("#LeastOneMarkedAlert").hide();
			openWin($(this).attr("href"), "Popup", "width=890,height=550");
		} else {
			$("#LeastOneMarkedAlert").show();
		}
		return false;
	});
	$(".OpenPasswordSendPopup").click(function(){
		return openWin("Popup" + $(this).attr("href"), "Popup", "width=510,height=300");
	});
	$(".PrintPopup").click(function(){
		return openWin($(this).attr("href"), "Popup", "width=510,height=500");
	});
	$(".ExamplePopup").click(function(){
		return openWin($(this).attr("href"), "Popup", "width=510,height=500");
	});
	$(".ComparePresTypesPopup").click(function(){
		return openWin("PopupComparePresTypes.aspx", "Popup", "width=580,height=600");
	});
	$(".Popup").click(function(){
		window.open($(this).attr("href"));
		return false;
	});
});

// Opens a new window with specific parameters
function openWin(url, name, params) {
	params = params + ",location=0,menubar=0,resizable=1,scrollbars=1,toolbar=0,status=0";
	var winOpener = window.open(url, name, params);
	winOpener.focus();
	return false;
}

/* The following code covers features not yet implemented

//	Adds functions to the onclick event of certificate verification icons
function initCertVerificationIcons() {
	if (document.getElementsByTagName) {
		var parent = document.getElementById("CertificationsField");
		var DIVs = parent.getElementsByTagName("div");

		for (i=0; i<DIVs.length; i++) {
			if ((DIVs[i].className.indexOf("Verification") != -1) &&
				(DIVs[i].className.indexOf("Mandatory") != -1) || DIVs[i].className.indexOf("Verifiable") != -1) {
				DIVs[i].onclick = openCertInfo;
			}
		}
	}
}

function openCertInfo(e) {
	var params = "width=488,height=250";
	openWin("PopupCertificationInfo.aspx", "CertVerInfo", params);
	return false;
}
*/