var now1 = new Date();

function P7_colH2(){ //v2.1.0 by PVII-www.projectseven.com
 var i,oh,h=0,tg,el,np,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){
 for(i=1;i<dA.length;i+=2){dA[i+1].style.paddingBottom='';}for(i=1;i<dA.length;i+=2){
 oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=1;i<dA.length;i+=2){oh=dA[i].offsetHeight;
 if(oh<h){np=h-oh;if(!an&&dA[0]==1){P7_eqA2(dA[i+1].id,0,np);}else{
 dA[i+1].style.paddingBottom=np+"px";}}}document.p7eqa=1;
 document.p7eqth=document.body.offsetHeight;
 document.p7eqtw=document.body.offsetWidth;}
}
function P7_eqT2(){ //v2.1.0 by PVII-www.projectseven.com
 if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth){P7_colH2();}
}
function P7_equalCols2(){ //v2.1.0 by PVII-www.projectseven.com
 var c,e,el;if(document.getElementById){document.p7eqc=new Array();
 document.p7eqc[0]=arguments[0];for(i=1;i<arguments.length;i+=2){el=null;
 c=document.getElementById(arguments[i]);if(c){e=c.getElementsByTagName(arguments[i+1]);
 if(e){el=e[e.length-1];if(!el.id){el.id="p7eq"+i;}}}if(c&&el){
 document.p7eqc[document.p7eqc.length]=c;document.p7eqc[document.p7eqc.length]=el}}
 setInterval("P7_eqT2()",10);}
}
function P7_eqA2(el,p,pt){ //v2.1.0 by PVII-www.projectseven.com
 var sp=10,inc=20,g=document.getElementById(el);np=(p>=pt)?pt:p;
 g.style.paddingBottom=np+"px";if(np<pt){np+=inc;
 setTimeout("P7_eqA2('"+el+"',"+np+","+pt+")",sp);}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


/************************* PAGE UNLOAD *****************************/

jQuery(window).unload(function(){
	if (document.getElementById("presentation")) {
		var later = new Date()
		timetimevar=(later.getTime() - now1.getTime())/1000;
	}
})


/************************* PAGE LOAD *****************************/


jQuery(document).ready(function(){

	//ajax settings
	jQuery.ajaxSettings.traditional = true;

	//datepicker
	jQuery(".datepicker").datepicker();

	//forms for adding category
	jQuery("form.catforms").each(function(){
		jQuery(this).submit(function(){
			var data=$(this).serialize();
			jQuery.ajax({
				type:'POST',
				url: 'catadd.asp',
				data: data,
				cache: false,
				success: function(data){
					var contentid = data.split("|")[0];
					var catfill = data.split("|")[1];
					elementid="categories_" + contentid
					jQuery("#"+elementid).html(catfill);
				}
			});
		return false;
		});
	});
	
	//notes link on homepage
	jQuery("#notespreviewlink").click(function(){
		MM_openBrWindow(jQuery(this).attr('href'),'frontwin','width=1040,height=600');
		return false;
	});
	
	//summary vs detailed in portfolio
	jQuery("#hidesummlink").toggle(function(){
		jQuery("p.hidesumm").hide();
		jQuery(this).text("Detailed View");
		createCookie('summportfolio','summary',7)
		return false;
	},function(){
		jQuery("p.hidesumm").show();
		jQuery(this).text("Summary View");
		createCookie('summportfolio','detailed',7)
		return false;
	});
	var x = readCookie('summportfolio')
	if (x) {
		if (x=="summary"){
			jQuery("#hidesummlink").trigger("click");
		}
	}

	preparecontentpage();
	checkcontentpagestatus();
	prepareForm();
	equalthecols();
	startList();
	jQuery("#portlink").find("a").click(function(){
		var query = jQuery(this).attr("href").split("?")[1];
		MM_openBrWindow('/presentation.asp?'+query,'preswin','width=1040,height=600');
		return false;
	});
	jQuery("#portlinkjv").find("a").click(function(){
		var query = jQuery(this).attr("href").split("?")[1];
		MM_openBrWindow('/presentationjv.asp?'+query,'preswin','width=1040,height=600');
		return false;
	});
	jQuery("#portlinkjournal").find("a").click(function(){
		var query = jQuery(this).attr("href").split("?")[1];
		MM_openBrWindow('/journalpresentation.asp?'+query,'journalwin','width=1040,height=600');
		return false;
	});
	jQuery("#portlinkabstract").find("a").click(function(){
		var query = jQuery(this).attr("href").split("?")[1];
		MM_openBrWindow('/abstractpresentation.asp?'+query,'abswin','width=1040,height=600');
		return false;
	});
	jQuery("#cmepurchases").find("a").click(function(){
		var query = jQuery(this).attr("href").split("?")[1];
		MM_openBrWindow('/receipt.asp?'+query,'rceiptwin','width=600,height=600,scrollbars=1');
		return false;
	});
});


function equalthecols(){
	if (document.getElementById("courses")) {
		P7_equalCols2(0,'courses','p','accreditation','p','portfolio','p');	
	}
}
function getHTTPObject2() {
	var request = false;
	if (window.XMLHttpRequest) {
		request = new window.XMLHttpRequest();
	} else if (window.ActiveXObject) {
		request = new window.ActiveXObject("Microsoft.XMLHTTP");
	}
	return request;
}
function getHTTPObject() {
	var xhr = false;
	if (window.XMLHttpRequest) {
		xhr = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		try {
			xhr = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				xhr = false;
			}
		}
	}
	return xhr;
}
function sendData(data) {
	var request = getHTTPObject();
	if (request) {
		request.onreadystatechange = function () {
			parseResponse(request);
		};
		request.open("POST","acgmembercheck.asp",true);
		request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		request.send(data);
		return true;
	} else {
		return false;
	}
}
function prepareForm() {
	if (!document.getElementById) {
		return;
	}
	if (!document.getElementById("acgmembercheck")) {
		return;
	}
	document.getElementById("acgmembercheck").onsubmit = function() {
		var data = "";
		for (var i = 0; i<this.elements.length; i++) {
			data+= this.elements[i].name;
			data+= "=";
			data+= escape(this.elements[i].value);
			data+= "&";
		}
		return !sendData(data);
	};
}
function parseResponse(request) {
	if (request.readyState ==4) {
		if (request.status == 200 || request.status == 304) {
			var container = document.getElementById("acgcheckform");
			container.innerHTML = request.responseText;
			getmemberinfo();
			prepareForm();
		}
	}
}
function getmemberinfo() {
	var request = getHTTPObject();
	if (request) {
		request.onreadystatechange = function () {
			parsememberinfo(request);
		};
		var filestring='/acgmemberjson.asp'+'?dummy='+new Date().getTime();
		request.open("get",filestring,true);
		request.send(null);
		return true;
	} else {
		return false;
	}
}
function parsememberinfo(request) {
	if (request.readyState ==4) {
		if (request.status == 200 || request.status == 304) {
			var data = eval('('+request.responseText+')');
			var firstname = data.person.firstname;
			var lastname = data.person.lastname;
			var company = data.person.company;
			var add1 = data.person.add1;
			var add2 = data.person.add2;
			var cirt = data.person.cirt;
			var state = data.person.state;
			var zip = data.person.zip;
			var country = data.person.country;
			var email = data.person.email;
			var fax = data.person.fax;
			var phone = data.person.phone;
			if (document.getElementById("firstname") && (document.getElementById("firstname").value=='')){
				document.getElementById("firstname").value=firstname;
			}
			if (document.getElementById("lastname") && (document.getElementById("lastname").value=='')){
				document.getElementById("lastname").value=lastname;
			}
			if (document.getElementById("company") && (document.getElementById("company").value=='')){
				document.getElementById("company").value=company;
			}
			if (document.getElementById("address1") && (document.getElementById("address1").value=='')){
				document.getElementById("address1").value=add1;
			}
			if (document.getElementById("address2") && (document.getElementById("address2").value=='')){
				document.getElementById("address2").value=add2;
			}
			if (document.getElementById("city") && (document.getElementById("city").value=='')){
				document.getElementById("city").value=cirt;
			}
			if (document.getElementById("state") && (document.getElementById("state").value=='')){
				document.getElementById("state").value=state;
			}
			if (document.getElementById("zip") && (document.getElementById("zip").value=='')){
				document.getElementById("zip").value=zip;
			}
			if (document.getElementById("country") && (document.getElementById("country").value=='')){
				document.getElementById("country").value=country;
			}
			if (document.getElementById("email") && (document.getElementById("email").value=='')){
				document.getElementById("email").value=email;
			}
			if (document.getElementById("phone") && (document.getElementById("phone").value=='')){
				document.getElementById("phone").value=phone;
			}
			if (document.getElementById("fax") && (document.getElementById("fax").value=='')){
				document.getElementById("fax").value=fax;
			}
		}
	}
}
startList = function()
{
    if (document.all&&document.getElementById)
    {
        navRoot = document.getElementById("nav");
        if(navRoot)
        {
            for (i=0; i < navRoot.childNodes.length; i++)
            {
                node = navRoot.childNodes[i];
                if (node.nodeName == "LI")
                {
                    node.onmouseover = function()
                    {
                        this.className += " over";
                    }
                    node.onmouseout = function()
                    {
                        this.className = this.className.replace(" over", "");
                    }
                }
            }
        }
    }
}
function getcmebank() {
	if (!document.getElementById) {
		return;
	}
	if (!document.getElementById("portstats")) {
		return;
	}
	var request = getHTTPObject();
	if (request) {
		request.onreadystatechange = function () {
			parsecmebank(request);
		};
		request.open("GET","/includes/portcalc.asp"+"?dummy="+new Date().getTime(),true);
		request.send(null);
		return true;
	} else {
		return false;
	}
}
function parsecmebank(request) {
	if (request.readyState ==4) {
		if (request.status == 200 || request.status == 304) {
			var container = document.getElementById("portstats");
			//alert(request.responseText);
			container.innerHTML = request.responseText;
		}
	}
}
jQuery(document).ready(function(){
	jQuery("a.itempreviewlink,a.itempreviewlinkjv").click(function(){
		var $this = jQuery(this)
		var thehref=$this.attr("href")
		var query = thehref.split("?")[1];
		var previewalways = $this.hasClass("previewalways")
		if(!previewalways){
			var answer = confirm("Are you sure you want to open this preview? You will only be able to preview it once.")
			if (answer){
				var itemid = thehref.split("c=")[1];
				spantochange=document.getElementById("preview_"+itemid);
				previewwin = window.open(thehref,'preswin','width=1040,height=600');
				if (previewwin==null) {
					var spanerror = document.createElement("span");
					spanerror.setAttribute("class","error");
					spanerror.setAttribute("className","error");
					var texterror = document.createTextNode(" Please make sure you do not have popup windows blocked.");
					spanerror.appendChild(texterror);
					spantochange.appendChild(spanerror);
				}else{
					spantochange.innerHTML='Item already previewed';
				}
			}
		}else{
			var itemid = thehref.split("c=")[1];
			spantochange=document.getElementById("preview_"+itemid);
			previewwin = window.open(thehref,'preswin','width=1040,height=600');
			if (previewwin==null) {
				var spanerror = document.createElement("span");
				spanerror.setAttribute("class","error");
				spanerror.setAttribute("className","error");
				var texterror = document.createTextNode(" Please make sure you do not have popup windows blocked.");
				spanerror.appendChild(texterror);
				spantochange.appendChild(spanerror);
			}
		}
		return false;
	})
})

function getElementsByClassNametemp(className, tag, elm){
	var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");
	var tag = tag || "*";
	var elm = elm || document;
	var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
	var returnElements = [];
	var current;
	var length = elements.length;
	for(var i=0; i<length; i++){
		current = elements[i];
		if(testClass.test(current.className)){
			returnElements.push(current);
		}
	}
	return returnElements;
}

var pageids = [];
function preparecontentpage() {
	if (!document.getElementById) {
		return;
	}
	if (!document.getElementById("browsecontent")) {
		return;
	}
	if (!getElementsByClassNametemp('contentitem','div',document.getElementById("browsecontent"))) {
		return;
	}
	//first get an array of all the ids of content showing on current page
	var contentdivs = getElementsByClassNametemp('contentitem','div',document.getElementById("browsecontent"));
	for (var i=0; i<contentdivs.length; i++) {
		var itemid=contentdivs[i].id.split("div_content_")[1];
//		pageids[i]=parseInt(itemid);
		pageids[i]=itemid;
	}
	var cmevalues = [];
	for (x in pageids)
	{
		var idtopass="cmevalue_" + pageids[x];
		cmevalues[x]=document.getElementById(idtopass).firstChild.nodeValue;
	}
	//take over all add to portfolio links
	var addlinks = getElementsByClassNametemp('addlink','a',document.getElementById("browsecontent"));
	for (var i=0; i<addlinks.length; i++) {
		addlinks[i].onclick = function(){
			var itemadding = this.href.split("additem=")[1]
			itemadding = itemadding.split("#")[0]
			//alert(itemadding);
			var noticetoupdate="item_notice_" + itemadding
			//alert(noticetoupdate);
			document.getElementById(noticetoupdate).className="noticealert";
			document.getElementById(noticetoupdate).innerHTML="<strong>NOTE:<\/strong> Once you add this piece of content, it will be added to your portfolio, and you will not be able to delete it.<br/><a href=\"browse.asp?a=1&confirmitem=" + itemadding + "#content_" + itemadding + "\" class=\"confirmlink\">CONTINUE<\/a> or <a href=\"browse.asp?a=1#content_" + itemadding + "\" class=\"cancellink\">CANCEL<\/a>";
			var confirmlinks = getElementsByClassNametemp('confirmlink','a',document.getElementById(noticetoupdate));
			for (var i=0; i<confirmlinks.length; i++) {
				confirmlinks[i].onclick = function(){
					var itemconfirming = this.href.split("confirmitem=")[1]
					itemconfirming = itemconfirming.split("#")[0]
					addtoport(itemconfirming);
					checkcontentpagestatus();
					return false;
				}
			}
			var cancellinks = getElementsByClassNametemp('cancellink','a',document.getElementById(noticetoupdate));
			for (var i=0; i<cancellinks.length; i++) {
				cancellinks[i].onclick = function(){
					checkcontentpagestatus();
					return false;
				}
			}
			return false;
		}
	}
	preparecontentpagedirector();
}
function checkcontentpagestatus(){
	if (!document.getElementById) {
		return;
	}
	if (!document.getElementById("browsecontent")) {
		return;
	}
	jQuery.get("/cmebank.asp",{dummy: new Date().getTime()},function(data){
			jQuery("#portremaining").text(data.split("|")[0]);
			jQuery("#portavailable").val(data.split("|")[1]);
			var idspassing=pageids.join(",")
			jQuery.get("/contentcheck.asp",{
				idspassing: idspassing,
				portavailable: jQuery("#portavailable").val(), 
				portremain: jQuery("#portremaining").text(),
				dummy: new Date().getTime()
				},function(data){

					var itemstatus = data.split("|");
					for (x in pageids)
					{
						var statustochange="item_notice_" + pageids[x];
						if (itemstatus[x]=="will be free with minutes in bank"){
							document.getElementById(statustochange).className="notice";
							document.getElementById(statustochange).innerHTML="<strong>NOTE:<\/strong>This content type will be available for free once you have <a href=\"/getcredits.asp\" title=\"Get Credits\">added minutes to your cme bank<\/a>.";
						}else if(itemstatus[x]=="free to members"){
							document.getElementById(statustochange).className="notice";
							document.getElementById(statustochange).innerHTML="<strong>NOTE:<\/strong>This content is available for free to ACG members, for information on becoming an ACG member <a href=\"http://www.acg.gi.org/physicians/meminfo.asp\" title=\"ACG Membership Information\" target=\"_blank\">click here<\/a>.";
						}else if(itemstatus[x]=="you dont have enough"){
							document.getElementById(statustochange).className="notice";
							document.getElementById(statustochange).innerHTML="<strong>NOTE:<\/strong>You do not have enough available minutes for this item, <a href=\"\/getcredits.asp\" title=\"Get Credits\">you can buy more<\/a>.";
						}else if(itemstatus[x]=="can add"){
							document.getElementById(statustochange).className="";
							document.getElementById(statustochange).innerHTML="<span class=\"label\">&nbsp;<\/span><span class=\"value\"><a href=\"browse.asp?additem=" + pageids[x] + "#content_" + pageids[x] + "\" class=\"addlink\"><img alt=\"add to portfolio\" src=\"\/i\/addtoportfolio.gif\" width=\"177\" height=\"25\" border=\"0\" \/><\/a><\/span>";
						}else if(itemstatus[x]=="already in port"){
							document.getElementById(statustochange).className="inportfolio";
							document.getElementById(statustochange).innerHTML="<span class=\"label\"><img alt=\"checkmark\" src=\"\/i\/checkmark.gif\" width=\"14\" height=\"17\" /><\/span> <span class=\"value\">This item is in your portfolio - <a href=\"contentitem.asp?c=" + pageids[x] + "\">view it<\/a><\/span>";
						}
						preparecontentpage();
					}
						
			});
	});

}
function addtoport(itempass) {
	jQuery.get("/confirmitem.asp",{confirmitem: itempass,dummy: new Date().getTime()},function(data){
		checkcontentpagestatus();	
	});
}
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
function preparecontentpagedirector(){
	if (!document.getElementById) {
		return;
	}
	if (!document.getElementById("browsecontent")) {
		return;
	}
	//take over all add to homework links
	var addhwlinks = getElementsByClassNametemp('addhwlinks','a',document.getElementById("browsecontent"));
	for (var i=0; i<addhwlinks.length; i++) {
		addhwlinks[i].onclick = function(){
			var directoritemadding = this.parentNode.id.split("pdgroup")[1];
			var directoritemaddingyear = directoritemadding.split("_")[0];
			var directoritemaddingid = directoritemadding.split("_")[1];
//			alert("Year " + directoritemaddingyear + ";Id: " + directoritemaddingid);
			var hwtoupdate="pdgroup" + directoritemaddingyear + "_" + directoritemaddingid
//			alert(hwtoupdate);
			document.getElementById(hwtoupdate).className="outhw hwalert";
			document.getElementById(hwtoupdate).innerHTML="Once you add this piece of content it will be added as homework for all of your year " + directoritemaddingyear + " trainees.<br /><a href=\"browse.asp?g" + directoritemaddingyear + "confirmitem=" + directoritemaddingid + "#\" class=\"hwconfirmlink\">CONTINUE</a> or <a href=\"browse.asp?\" class=\"hwcancellink\">CANCEL</a>";
			var hwconfirmlinks = getElementsByClassNametemp('hwconfirmlink','a',document.getElementById(hwtoupdate));
			for (var i=0; i<hwconfirmlinks.length; i++) {
				hwconfirmlinks[i].onclick = function(){
					var yearconfirming = this.href.split("?g")[1]
					yearconfirming = yearconfirming.split("confirmitem=")[0]
					var itemconfirming = this.href.split("confirmitem=")[1]
					itemconfirming = itemconfirming.split("#")[0]
					//alert("Year " + yearconfirming + ";Id: " + itemconfirming);
					addtohw(itemconfirming,yearconfirming);
					checkhwcontentpagestatus();
					return false;
				}
			}
			var hwcancellinks = getElementsByClassNametemp('hwcancellink','a',document.getElementById(hwtoupdate));
			for (var i=0; i<hwcancellinks.length; i++) {
				hwcancellinks[i].onclick = function(){
					checkhwcontentpagestatus();
					return false;
				}
			}
			return false;
		}
	}
}
function addtohw(itempass,yearpass) {
	var filestring='/confirmhw.asp?confirmitem='+itempass+'&confirmyear='+yearpass+'&dummy='+new Date().getTime(); 
	var request = getHTTPObject();
	if (request) {
//		request.onreadystatechange = function () {
//			parseResponsesendtime(request);
//		};
		request.open("GET",filestring,true);
		request.send(null);
		return true;
	} else {
		return false;
	}
}
function checkhwcontentpagestatus(){
	if (!document.getElementById) {
		return;
	}
	var firstdirector="directorcontent_" + pageids[0]
	if (!document.getElementById(firstdirector)) {
		return;
	}
	var idspassing=pageids.join(",")
	var filestring='/hwcontentcheck.asp?idspassing=' + escape(idspassing) + '&dummy='+new Date().getTime(); 
	var request = getHTTPObject();
	if (request) {
		request.onreadystatechange = function () {
			parsecheckhwcontent(request);
		};
		request.open("GET",filestring,true);
		request.send(null);
		return true;
	} else {
		return false;
	}
}
function parsecheckhwcontent(request) {
	if (request.readyState ==4) {
		if (request.status == 200 || request.status == 304) {
//			alert(request.responseText);
			var itemstatus = request.responseText.split("|");
			for (x in pageids)
			{
				var statustochangeg1="pdgroup1_" + pageids[x];
				var statustochangeg2="pdgroup2_" + pageids[x];
				var statustochangeg3="pdgroup3_" + pageids[x];
				var firstindex=x*3
				for (var i=0; i<3; i++){
					insideindex=firstindex+i
					var yearpass=i+1
					var statustochange="pdgroup" + yearpass + "_" + pageids[x];
					if (itemstatus[insideindex]=="can add"){
						document.getElementById(statustochange).className="outhw";
						document.getElementById(statustochange).innerHTML="<a href=\"browse.asp?g" + yearpass + "additem=" + pageids[x] + "#content_" + pageids[x] + "\" class=\"addhwlinks\">add to year " + yearpass + " homework</a>.";
					} else if (itemstatus[insideindex]=="assigned"){
						document.getElementById(statustochange).className="inhw";
						document.getElementById(statustochange).innerHTML="Assigned to Year " + yearpass + " trainees.";
					}
				}
			}
			preparecontentpagedirector();
		}
	}
}
function preview1(){
	preview1win = window.open('/fp1.asp','fpwin','width=1040,height=600');
	if (preview1win==null) {
		var spanerror = document.createElement("p");
		spanerror.setAttribute("class","error");
		spanerror.setAttribute("className","error");
		var texterror = document.createTextNode(" Please make sure you do not have popup windows blocked.");
		spanerror.appendChild(texterror);
		document.getElementById("flashmarketing").appendChild(spanerror);
	}else{
//		spantochange.innerHTML='Item already previewed';
	}
}
function preview2(){
	preview1win = window.open('/fp2.asp','fpwin','width=1040,height=600');
	if (preview1win==null) {
		var spanerror = document.createElement("p");
		spanerror.setAttribute("class","error");
		spanerror.setAttribute("className","error");
		var texterror = document.createTextNode(" Please make sure you do not have popup windows blocked.");
		spanerror.appendChild(texterror);
		document.getElementById("flashmarketing").appendChild(spanerror);
	}else{
//		spantochange.innerHTML='Item already previewed';
	}
}
function preview3(){
	preview1win = window.open('/fp3.asp','fpwin','width=1040,height=600');
	if (preview1win==null) {
		var spanerror = document.createElement("p");
		spanerror.setAttribute("class","error");
		spanerror.setAttribute("className","error");
		var texterror = document.createTextNode(" Please make sure you do not have popup windows blocked.");
		spanerror.appendChild(texterror);
		document.getElementById("flashmarketing").appendChild(spanerror);
	}else{
//		spantochange.innerHTML='Item already previewed';
	}
}
function preview4(){
	preview1win = window.open('/fp4.asp','fpwin','width=1040,height=600');
	if (preview1win==null) {
		var spanerror = document.createElement("p");
		spanerror.setAttribute("class","error");
		spanerror.setAttribute("className","error");
		var texterror = document.createTextNode(" Please make sure you do not have popup windows blocked.");
		spanerror.appendChild(texterror);
		document.getElementById("flashmarketing").appendChild(spanerror);
	}else{
//		spantochange.innerHTML='Item already previewed';
	}
}
jQuery(document).ready(function(){
	jQuery("ul#curriculum").click(function(e){
		var $thelink = jQuery(e.target)
		var $thediv = $thelink.nextAll("div:first")
		var $theli = $thelink.parents("li:first")
		var $hitarea = $theli.find(".hitarea:first")
		
		if($thelink.is("a.childcategory")){
			var category = $thelink.attr("rel")
			if($thelink.hasClass("expanded")){
				$theli.removeClass("collapsable").addClass("expandable")
				$hitarea.removeClass("collapsable-hitarea").addClass("expandable-hitarea")
				if($theli.hasClass("lastCollapsable")){
					$theli.removeClass("lastCollapsable").addClass("lastExpandable")
				}
				if($hitarea.hasClass("lastCollapsable-hitarea")){
					$hitarea.addClass("lastExpandable-hitarea").removeClass("lastCollapsable-hitarea")
				}
				$thediv.hide()
				$thelink.removeClass("expanded")
				return false;
			}
			if($thediv.find("div").length>0){
				$thediv.show()
				$thelink.addClass("expanded")
				$theli.addClass("collapsable").removeClass("expandable")
				$hitarea.addClass("collapsable-hitarea").removeClass("expandable-hitarea")
				if($theli.hasClass("lastExpandable")){
					$theli.addClass("lastCollapsable").removeClass("lastExpandable")
				}
				if($hitarea.hasClass("lastExpandable-hitarea")){
					$hitarea.removeClass("lastExpandable-hitarea").addClass("lastCollapsable-hitarea")
				}
			}else{
				jQuery.ajax({
					type: "POST",
					url: "getcurr.asp",
					data: {
						category: category
					},	
					success: function(data){
						if(data!=''){
							data=jQuery(data)
							jQuery("li:last",data).addClass("lastExpandable")
							jQuery("div.hitarea:last",data).addClass("lastExpandable-hitarea")
							$thediv.html(data)
							$thelink.addClass("expanded")
							$theli.addClass("collapsable").removeClass("expandable")
							$hitarea.addClass("collapsable-hitarea").removeClass("expandable-hitarea")
							if($theli.hasClass("lastExpandable")){
								$theli.addClass("lastCollapsable").removeClass("lastExpandable")
							}
							if($hitarea.hasClass("lastExpandable-hitarea")){
								$hitarea.removeClass("lastExpandable-hitarea").addClass("lastCollapsable-hitarea")
							}
						}
					}
				})
			}
			return false;
		}else if($thelink.is("a.parentcategory")){
			if($thelink.hasClass("expanded")){
				$theli.removeClass("collapsable").addClass("expandable")
				$hitarea.removeClass("collapsable-hitarea").addClass("expandable-hitarea")
				if($theli.hasClass("lastCollapsable")){
					$theli.removeClass("lastCollapsable").addClass("lastExpandable")
				}
				if($hitarea.hasClass("lastCollapsable-hitarea")){
					$hitarea.addClass("lastExpandable-hitarea").removeClass("lastCollapsable-hitarea")
				}
				$thediv.hide()
				$thelink.removeClass("expanded")
				return false;
			}
			var category = $thelink.attr("rel")
			if($thediv.find("ul").length>0){
				$thelink.addClass("expanded")
				$theli.addClass("collapsable").removeClass("expandable")
				$hitarea.addClass("collapsable-hitarea").removeClass("expandable-hitarea")
				if($theli.hasClass("lastExpandable")){
					$theli.addClass("lastCollapsable").removeClass("lastExpandable")
				}
				if($hitarea.hasClass("lastExpandable-hitarea")){
					$hitarea.removeClass("lastExpandable-hitarea").addClass("lastCollapsable-hitarea")
				}
				$thediv.show()
			}else{
				jQuery.ajax({
					type: "POST",
					url: "getchildcats.asp",
					data: {
						category: category
					},	
					success: function(data){
						data=jQuery(data)
						jQuery("ul",data).each(function(){
							jQuery("li:last",jQuery(this)).addClass("lastExpandable")
							jQuery("div.hitarea:last",jQuery(this)).addClass("lastExpandable-hitarea")
						});
						$thediv.html(data)
						$thelink.addClass("expanded")
						$theli.addClass("collapsable").removeClass("expandable")
						$hitarea.addClass("collapsable-hitarea").removeClass("expandable-hitarea")
						if($theli.hasClass("lastExpandable")){
							$theli.addClass("lastCollapsable").removeClass("lastExpandable")
						}
						if($hitarea.hasClass("lastExpandable-hitarea")){
							$hitarea.removeClass("lastExpandable-hitarea").addClass("lastCollapsable-hitarea")
						}
					}
				})
			}
			return false;
		}else if($thelink.is("a.typecategory")){
//			var $thediv = $thelink.nextAll("div:first")
//			if($thelink.hasClass("presentation")){
				if($thelink.hasClass("expanded")){
					$theli.removeClass("collapsable").addClass("expandable")
					$hitarea.removeClass("collapsable-hitarea").addClass("expandable-hitarea")
					if($theli.hasClass("lastCollapsable")){
						$theli.removeClass("lastCollapsable").addClass("lastExpandable")
					}
					if($hitarea.hasClass("lastCollapsable-hitarea")){
						$hitarea.addClass("lastExpandable-hitarea").removeClass("lastCollapsable-hitarea")
					}
					$thediv.hide()
					$thelink.removeClass("expanded")
					return false;
				}else{
					$thelink.addClass("expanded")
					$theli.addClass("collapsable").removeClass("expandable")
					$hitarea.addClass("collapsable-hitarea").removeClass("expandable-hitarea")
					if($theli.hasClass("lastExpandable")){
						$theli.addClass("lastCollapsable").removeClass("lastExpandable")
					}
					if($hitarea.hasClass("lastExpandable-hitarea")){
						$hitarea.removeClass("lastExpandable-hitarea").addClass("lastCollapsable-hitarea")
					}
					$thediv.show()
					return false;
				}
//			}else{
//			}
		}else if($thelink.is("div.hitarea")){
			var $thediv = $thelink.nextAll("div:first")
			if($thelink.hasClass("collapsable-hitarea")){
				$theli.removeClass("collapsable").addClass("expandable")
				$thelink.removeClass("collapsable-hitarea").addClass("expandable-hitarea")
				if($theli.hasClass("lastCollapsable")){
					$theli.removeClass("lastCollapsable").addClass("lastExpandable")
				}
				if($thelink.hasClass("lastCollapsable-hitarea")){
					$thelink.addClass("lastExpandable-hitarea").removeClass("lastCollapsable-hitarea")
				}
				$thediv.hide()
				$thelink.next("a").removeClass("expanded")
				return false;
			}
			var category = $thelink.next("a").attr("rel")
			if($thediv.find("ul").length>0||$thediv.find("div").length>0){
				$thelink.next("a").addClass("expanded")
				$theli.addClass("collapsable").removeClass("expandable")
				$thelink.addClass("collapsable-hitarea").removeClass("expandable-hitarea")
				if($theli.hasClass("lastExpandable")){
					$theli.addClass("lastCollapsable").removeClass("lastExpandable")
				}
				if($thelink.hasClass("lastExpandable-hitarea")){
					$thelink.removeClass("lastExpandable-hitarea").addClass("lastCollapsable-hitarea")
				}
				$thediv.show()
			}else{
				var url;
				if($thelink.next("a").is("a.childcategory")){
					url="getcurr.asp"
				}else{
					url="getchildcats.asp"
				}
				jQuery.ajax({
					type: "POST",
					url: url,
					data: {
						category: category
					},	
					success: function(data){
						if(data!=''){
							data=jQuery(data)
							jQuery("li:last",data).addClass("lastExpandable")
							jQuery("div.hitarea:last",data).addClass("lastExpandable-hitarea")
							$thediv.html(data)
							$thelink.next("a").addClass("expanded")
							$theli.addClass("collapsable").removeClass("expandable")
							$thelink.addClass("collapsable-hitarea").removeClass("expandable-hitarea")
							if($theli.hasClass("lastExpandable")){
								$theli.addClass("lastCollapsable").removeClass("lastExpandable")
							}
							if($thelink.hasClass("lastExpandable-hitarea")){
								$thelink.removeClass("lastExpandable-hitarea").addClass("lastCollapsable-hitarea")
							}
						}
					}
				})
			}
			return false;
		}
		else if($thelink.hasClass("curritempop")){
			MM_openBrWindow($thelink.attr('href'),'currwin','width=1040,height=600');
			return false;
		}else if($thelink.parents("a:first").hasClass("curritempop")){
			MM_openBrWindow($thelink.parents("a:first").attr('href'),'currwin','width=1040,height=600');
			return false;
		}

	})
	jQuery("li:last","ul#curriculum").addClass("lastExpandable")
	jQuery("div.hitarea:last","ul#curriculum").addClass("lastExpandable-hitarea")
	jQuery("div#simplelist").find("a").click(function(){
		var $thelink = jQuery(this); 
		MM_openBrWindow($thelink.attr('href'),'currwin','width=1040,height=600');
		return false;
	})
	var homeworkassignments = [];
/* 
	jQuery("ul#homeworkchoose li").draggable({
		appendTo:"body",
		helper:"clone"
	});
	jQuery("#homeworkassignment").droppable({
		drop:function(ev,ui){
			jQuery(ui.draggable).appendTo(jQuery(this).find("ul#chosenhomework"));
			homeworkassignments.push(jQuery(ui.draggable).attr("rel"));
		},
		hoverClass:'drophover',
		tolerance:'touch'
	})
*/
	var istraineeblock=false;
	var confirmportfolio = function(itemconfirm,assignid,containblock){
		jQuery.get("/confirmportfolio.asp",{confirmitem: itemconfirm,dummy: new Date().getTime()},function(data){
			if(!istraineeblock){
				var portid = jQuery.trim(data);
				jQuery.post("/homeworkassign.asp",{
					confirmitem: itemconfirm,
					action:'assignhw',
					assignid:assignid,
					portid:portid
				},function(data){
					var $assignedto = containblock.find(".assignedto")
					$assignedto.text(data.split("|~|")[1])
					containblock.find("p.message").remove();
					jQuery('<p class="message">' + data.split("|~|")[0] + '</p>').insertBefore($assignedto)
				});
			}else{
				containblock.html('<h4>Add to Portfolio</h4><p>Added to <a href="portfolio.asp">portfolio</a>.</p>')
			}
		});
	}
	jQuery("#assignhwform").submit(function(){
		jQuery("#portfolioitems",jQuery(this)).val(homeworkassignments.join(","));
		if(jQuery("#portfolioitems",jQuery(this)).val()==''){
			return false;
		}else{
			return true;
		}
	});
	jQuery("a.moreinfo").live("click",function(){
		var $moreinfobox = jQuery(this).closest("p").next("div.moreinfobox");
		if($moreinfobox.hasClass("expandedbox")){
			$moreinfobox.hide().removeClass("expandedbox");
			jQuery(this).text("More Info")
		}else{
			$moreinfobox.show().addClass("expandedbox");
			jQuery(this).text("Less Info")
		}
		return false;
	})
	jQuery(".assignto").live("click",function(){
		var $pblockcache = jQuery(this).closest("p").html()
		var $pblock = jQuery(this).closest("p");
		var $pblockdiv = jQuery(this).closest("div.pdselect");
		if($pblockdiv.hasClass("traineecurr")){
			istraineeblock=true;
		}
		var contentid = jQuery(this).attr("rel");
		var $pselect = $pblock.find("select");
		var pselectval = $pselect.val();
		var pselecttext = $pselect.find("option:selected").text();
		if($pselect.val()!==""){
			$pblock.addClass("hwalert");
			if(istraineeblock){
				$pblock.html('Once you add this piece of content it will be in your portfolio.<br /><a class="assignconfirmlink" href="#" rel="' + pselectval + '">CONTINUE</a> or <a class="assigncancellink" href="#">CANCEL</a>');
			}else{
				$pblock.html('Once you add this piece of content it will be added to the assignment called ' + pselecttext + ' and will be in your portfolio.<br /><a class="assignconfirmlink" href="#" rel="' + pselectval + '">CONTINUE</a> or <a class="assigncancellink" href="#">CANCEL</a>');
			}
		}
		$pblock.find("a.assigncancellink").click(function(){
			$pblock.html($pblockcache);
			return false;
		});
		$pblock.find("a.assignconfirmlink").click(function(){
			confirmportfolio(contentid,pselectval,$pblockdiv);
			$pblock.html($pblockcache);
			$pblock.removeClass("hwalert");
			return false;
		});
		return false;
	})
	jQuery("a.traineeselect").click(function(){
		var therel = jQuery(this).attr("rel");
		if(therel==='none'){
			jQuery(":checkbox","li.traineelisting").attr("checked",false);
		}else{
			var selector = ":checkbox[rel="+therel+"]";
			jQuery(selector,"li.traineelisting").attr("checked",true);
		}
		return false;
	})
	var traineesopened=[]
	var traineetree;
	jQuery("#traineetree").click(function(e){
		var $this = jQuery(this)
		var $target=jQuery(e.target);
		if($target.is("a.ahitarea")){
			$target=$target.prev("div.hitarea")
			var ev = jQuery.Event("click");
			ev.target=$target
			$this.trigger("click",ev)
		}
		if($target.is(".hitarea")){
			var $li = $target.closest("li");
			if($target.hasClass("expandable-hitarea")){
				$li.removeClass("expandable").addClass("collapsable");
				jQuery("ul ul",$li).show();
				$target.removeClass("expandable-hitarea").addClass("collapsable-hitarea");
				traineesopened.push($target.attr("id"))
				createCookie('traineeexpandcookie',traineesopened.join(","),false)
			}else{
				$li.addClass("expandable").removeClass("collapsable");
				jQuery("ul ul",$li).hide();
				traineesopened = jQuery.grep(traineesopened, function(n, i){
					return (n != $target.attr("id"));
		      	});
				$target.removeClass("collapsable-hitarea").addClass("expandable-hitarea")
				createCookie('traineeexpandcookie',traineesopened.join(","),false)
			}
			return false;
		}
		
	})
	jQuery("#traineetree > li:last").addClass("lastExpandable");
	if(document.getElementById("traineetree")){
		var traineeexpand = readCookie('traineeexpandcookie')
		if (traineeexpand) {
			if(traineeexpand!==''){
				var trainids = traineeexpand.split(",");
				jQuery.each(trainids,function(i,n){
					jQuery("#"+n).trigger("click")
				})
			}
		}
	}
	jQuery(".assignmenttree").each(function(){
		var $this = jQuery(this);
		$this.click(function(e){
			var $target=jQuery(e.target);
			if($target.is("a.ahitarea")){
				$target=$target.prev("div.hitarea")
				var ev = jQuery.Event("click");
				ev.target=$target
				$this.trigger("click",ev)
			}
			if($target.is(".hitarea")){
				var $li = $target.closest("li");
				if($target.hasClass("expandable-hitarea")){
					$li.removeClass("expandable").addClass("collapsable");
					jQuery("div.assigncontent",$li).show();
					$target.removeClass("expandable-hitarea").addClass("collapsable-hitarea");
					if($li.hasClass("lastExpandable")){
						$li.removeClass("lastExpandable").addClass("lastCollapsable");
					}
				}else{
					$li.addClass("expandable").removeClass("collapsable");
					jQuery("div.assigncontent",$li).hide();
					$target.removeClass("collapsable-hitarea").addClass("expandable-hitarea")
					if($li.hasClass("lastCollapsable")){
						$li.removeClass("lastCollapsable").addClass("lastExpandable");
					}
				}
				return false;
			}
		
		})
		jQuery("li:last",$this).addClass("lastExpandable");
	})
	if(jQuery(".hover-star").length>0){
		jQuery(".hover-star").rating({
			callback: function(value, link){
				var rating=value;
				if(rating===""){
					rating=0;
				}
				var ratinguser = jQuery("#ratinguser").val();
				var ratingcontent = jQuery("#ratingcontent").val();
				jQuery.post("/ratecontent.asp",{rating:rating,user:ratinguser,content:ratingcontent},function(){
					var ratemess=jQuery('<span style="padding-right: 10px;padding-left: 10px;background: yellow;">Rating Saved</span>')
					ratemess.insertAfter(jQuery(".star-rating-control"))
					setTimeout(function(){ratemess.fadeOut()},2000)
				})
			}
		});
	}
	jQuery("select.progressreport").each(function(){
		var $this=jQuery(this);
		jQuery("option:first",$this).attr("selected","selected");
	})
	jQuery("select.progressreport").change(function(){
		var aid=jQuery(this).val();
		var tid=jQuery(this).attr("rel");
		if(aid!==""){
			window.location = "/assignmentprogress.asp?aid="+aid+"&tid="+tid
		}
	})
	jQuery("a.togglequestions").live("click",function(){
		var $link=jQuery(this)
		var $questions=$link.closest("p").next("div.questions")
		if($link.text()==="Show Questions"){
			$questions.show()
			$link.text("Hide Questions")
		}else{
			$questions.hide()
			$link.text("Show Questions")
		}
		return false;
	})
	jQuery("#assigntotraineeform").submit(function(){
		var confirmform = confirm("Are you sure you would like to assign this assignment to the selected trainees?  You will not be able to unassign the assignment.  If this is the first trainee you have assigned the assignment to, you will not be able to modify the assignment.")
		if(!confirmform){
			return false;
		}
	});
	jQuery(".popwindowbrowse").click(function(){
		MM_openBrWindow(jQuery(this).attr('href'),'currwin','width=1040,height=600');
		return false;	
	})
	jQuery("a.markcompletelink").live("click",function(){
		var $this = jQuery(this);
		var therel = $this.attr("rel")
		var therelsplit = therel.split("|")
		var thecontent = therelsplit[0]
		var theassignment = therelsplit[1]
		var $parentp = $this.closest("p.markcomplete")
		var parentpcache = $parentp.html() 
		$parentp.html('Are you sure you want to mark this presentation as watched for all assignees? This should be done if you watched the presentation together.<br /><a href="#" class="yes">Yes</a> <a href="#" class="no">No</a>');
		$parentp.find("a.yes").click(function(){
			jQuery.ajax({
				url: "markcomplete.asp",
				data: {
					c:thecontent,
					a:theassignment
				},
				type: "POST",
				success: function(data){
					$parentp.html('Marked Watched')
				}
			})
			return false;
		})
		$parentp.find("a.no").click(function(){
			$parentp.html(parentpcache)
			return false;
		})
		return false;
	})
	if(document.getElementById("username")){
		jQuery("a.suggestedusername").click(function(){
			var texttopass = jQuery(this).text()
			jQuery("#username").val(texttopass)
			return false;
		})
	}
	if(document.getElementById("contentcomment")){
		var $contentcomment = jQuery('#contentcomment')
		var $currentchars = jQuery("#currentchars")
		var $savecontent = jQuery("#savecomment")
		var charlenload = $contentcomment.val().length
		var $commentresult = jQuery("#commentresult")
		$currentchars.html(charlenload)
		$savecontent.click(function(){
			var ratinguser = jQuery("#ratinguser").val();
			var ratingcontent = jQuery("#ratingcontent").val();
			jQuery.ajax({
				url: "ratecomment.asp",
				type: "POST",
				data: {comment:$contentcomment.val(),user:ratinguser,content:ratingcontent},
				success: function(data){
					data=jQuery.trim(data)
					$contentcomment.val(data)
					if(data.length===0){
						$commentresult.html("Error - Try Again")
					}else{
						$commentresult.html("Comment Saved")
					}
				},
				error: function(){
					$commentresult.html("Error - Try Again")
				}
			})
			return false;
		})
		if(charlenload<1||charlenload>300){
			$savecontent.hide()
		}else{
			$savecontent.show()
		}
		$contentcomment.keyup(function() {
			$commentresult.empty()
			var charlen = $contentcomment.val().length
			$currentchars.html(charlen);
			if(charlen<1||charlen>300){
				$savecontent.hide()
			}else{
				$savecontent.show()
			}
		}); 
	}
	if(document.getElementById("sortcontentdrop")){
		var thequery=getquerystring(window.location.href),$sortcontentdrop=jQuery("#sortcontentdrop");
		if(thequery){
			$sortcontentdrop.val(thequery["order"]);
		}
		$sortcontentdrop.change(function(){
			var $this=jQuery(this), thisval=$this.val(), temparray=[];
			if(!thequery){
				thequery={};
			}
			thequery["order"]=thisval;
			jQuery.each(thequery,function(i,n){
				temparray.push(i+"="+n);
			})
			window.location.href="browse.asp?"+temparray.join("&");
		});
	}
	if (document.getElementById("acgmembercheckinsite")) {
		jQuery("#acgmembercheckinsite").submit(function(){
			var $this=jQuery(this);
			var data={
				whichform:jQuery("#whichform",$this).val(),
				username:jQuery("#username",$this).val(),
				password1:jQuery("#password1",$this).val()
			};
			jQuery.ajax({
				url:$this.attr("action"),
				type:"POST",
				cache: false,
				data: data,
				success: function(datapass){
					jQuery("#acgmembercheck_messaging").html(datapass)
				}
			});
			return false;
		});
	}
	var getcertificates = function(){
		if (document.getElementById("getcertificates")) {
			jQuery.ajax({
				url: "listcertificates.asp",
				type: "POST",
				cache: false,
				success: function(datapass){
					jQuery("#getcertificates").html(datapass);
				}
			});
		}
	}
	if(document.getElementById("getcertificates")){
		getcertificates();
	}
	var listcmeready = function(){
		if(document.getElementById("getreadyforcertificate")){
			var listcmereadydata={}, $getreadyforcertificate = jQuery("#getreadyforcertificate"),$certificatemessaging = jQuery("#certificatemessaging"), checkedcertificates;
			$getreadyforcertificate.hasClass("generate") ? listcmereadydata["listmode"]="generate" : listcmereadydata["listmode"]="";
			jQuery.ajax({
				url:"/listcmeready.asp",
				type:"POST",
				cache: false,
				data: listcmereadydata,
				success: function(datapass){
					$getreadyforcertificate.html(datapass)
					if(listcmereadydata["listmode"]==="generate"){
						var items = jQuery(".certificatereadyitem");
						if(items.length>0){
							$certificatemessaging.empty();
							jQuery("<form>",{
								submit:function(){
									checkedcertificates=[];
									var createcertificates = function(certids,iscert){
										var data={};
										data["certitemids"]=certids;
										jQuery.ajax({
											url:"createcertificate.asp",
											type:"POST",
											cache: false,
											data: data,
											success: function(datapass){
												$getreadyforcertificate.html(datapass);
												$certificatemessaging.html('');
												getcertificates();
												jQuery.get("/cmebank.asp",{dummy: new Date().getTime()},function(data){
													jQuery("#portremaining").text(data.split("|")[0]);
													jQuery("#portavailable").val(data.split("|")[1])
												});
											}
										});
									};
									jQuery(":checked",$getreadyforcertificate).each(function(i){
										var $this = jQuery(this);
										checkedcertificates.push($this.val());
									})
									if (checkedcertificates > 0) {
										var idstopass = checkedcertificates.join(",");
										jQuery.ajax({
											url: "precreatecertificate.asp",
											type: "POST",
											cache: false,
											data: {
												certitemids: idstopass
											},
											success: function(datapass){
												var totalcost = parseInt(datapass, 10), portremaining = parseInt(jQuery("#portremaining").text(), 10);
												if($getreadyforcertificate.hasClass("certificate")){
													if(totalcost>portremaining){
														$certificatemessaging.html('<p>You are requesting ' + totalcost + ' minutes of cme, you have  ' + portremaining + ' minutes available, you do not have enough credits.<br /><a href="#" id="certno">Try Again</a> | <a href="/getcredits.asp">Get Credits</a></p>').addClass("noticealert");
													}else{
														$certificatemessaging.html('<p>You are requesting ' + totalcost + ' minutes of cme, you have  ' + portremaining + ' minutes available, would you like to proceed?<br /><a href="#" id="certyes">Yes</a> | <a href="#" id="certno">No</a></p>').addClass("noticealert");
													}
												}else{
													$certificatemessaging.html('<p>You are requesting ' + totalcost + ' minutes of cme, is this what you intended?<br /><a href="#" id="certyes">Yes</a> | <a href="#" id="certno">No</a></p>').addClass("noticealert");
												}
												jQuery("#certyes").click(function(){
													createcertificates(idstopass,$getreadyforcertificate.hasClass("certificate"));
													$certificatemessaging.removeClass();
												});
												jQuery("#certno").click(function(){
													listcmeready();
													$certificatemessaging.removeClass();
												});
											}
										});
									}
									return false;
								}
							}).append('<input name="submit" type="submit" value="generate"/>').appendTo($certificatemessaging);
						}
					}
				}
			});
		}
	};
	if(document.getElementById("getreadyforcertificate")){
		listcmeready();
	}
	jQuery("#certificatelinks").find("a").live("click",function(){
		var query = jQuery(this).attr("href").split("?")[1]
		MM_openBrWindow('/certificate.asp?'+query,'certwin','width=1040,height=600,scrollbars=1');
		return false;
	});
})
var getquerystring = function(url){
	var argsplit = (url.split("#")[0]).split("?");
	var urlbase = argsplit[0];
	var argvalues={};
	if(argsplit.length>1&&argsplit[1]!==''){
		var querystring = argsplit[1];
		var urlarray = querystring.split("&");
		jQuery.each(urlarray, function(i,n){
			var tempval = n.split("=");
			if(tempval.length>1){
				argvalues[tempval[0]]=tempval[1];
			}
		});
		return argvalues;
	}else{
		return false;
	}
};
