$(document).ready(function() {

	$("a[href*='.pdf']").click(function(e){
		OmnitureDownload( "Download: " + $(this).attr("href"));
	});

	$(".hcp_on_ramp").click(function(e){
		if ( getCookie("hcp_verified") != "1" ) {
			e.preventDefault();
			var href = $(this).attr("href");
			doHcpVerify(href);
		}
	});

	if( document.referrer.indexOf(document.location.host) == -1 ) {
	if( document.location.href.indexOf("/hcp-") > -1 ) {
		setTimeout("doHcpVerify('');",1000);
	}}

});

function doHcpVerify(href) {
	if( getCookie("hcp_verified") != "1" ) {
		Shadowbox.options.modal = true;
		Shadowbox.options.displayNav = false;
		Shadowbox.options.enableKeys = false;
		Shadowbox.open({
			content: "/hcp-verification.asp?" + href
			,player: "iframe"
			,title: ""
			,width: 700
			,height: 300
			,overlayOpacity: 0.4
			,onClose: function(){
				Shadowbox.options.enableKeys = true;
			}
		});
		return false;
	}
}

function setCookie(c_name,value,expiredays) {
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}

function getCookie(c_name) {
	if (document.cookie.length>0) {
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1) {
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}

