/********************************************************************************
	Landing Page Banner
	-----------------------------------------------------------------------------
	The following script will insert a banner of your choice into the landing 
	page of the site (the main login page). To allow clients to change this 
	banner it is recommended that the banner should be stored within the site 
	itself. 
********************************************************************************/

$E.onDOMReady(function(){
	// Check if the user currently veiwing the login page. This is confirmed by:
	//  - The user is not viewing a group
	//  - The user is not logged in
	//  - The Profile control is not present
	
	var myRegExp = "passwordreset";
	var string1 = window.location.href;
	var matchPos1 = string1.search(myRegExp);
	var matchPos2 = string1.search("events");
	var urlResult = 0;
	var url = window.location.href.replace(/^http:\/\//gi,'');	
	// Check if the user is currently looking at the password reset screen or the events screen
	if(matchPos1 == -1 && matchPos2 == -1)
		urlResult = 0;	// User is not viewing the password change screen or events screen
	else
		urlResult = 1;	// User is currently veiwing the password change screen or events screen

	if ((SessionInfo.Group.ID == 0) && (SessionInfo.User.ID == 0) && (!($("rm-viewProfileHead"))) && (urlResult == 0) && (!($("rm-peopleSearch"))) && (!($("rm-contentSearch"))) && (!($("rm-groupSearch"))) && url == "physicianspracticetoolbox.com/")
	{
		var existing_div;
		
		// Create a new DIV element and give it some content
		loginBannerDiv = document.createElement("div");
		loginBannerDiv.style.background = "transparent url(http://static.sixent.com/content/1/0/85720001/1/ppt_login.png) no-repeat 0% 0%";
		loginBannerDiv.style.minWidth = "770px";
		loginBannerDiv.style.height = "124px";
		loginBannerDiv.style.position = "relative";
		loginBannerDiv.style.top = "-10px";
		loginBannerDiv.innerHTML = "<div id=\"ppt_login_text\" style=\"position: relative; top: 200px; left: 630px; width: 491px; margin-right: 100px;\">" 
		
										+ "<div id=\"ppt_login_step_1\" style=\"position: relative; margin:10px;\">" 
											
											+ "<a class=\"ppt_welcome_steps\" href=\"http://communityinformation.physicianspracticetoolbox.com/about-registering1\">" 
											
												+ "<img src=\"http://static.sixent.com/content/1/0/85720001/3/ppt_login_step_1.png\" alt=\"Welcome Step 1\" />" 
											
											+ "</a>" 
											
										+ "</div>" 
										
										+ "<div id=\"ppt_login_step_2\" style=\"position: relative; margin:10px;\">" 
										
											+ "<a class=\"ppt_welcome_steps\" href=\"http://communityinformation.physicianspracticetoolbox.com/take-a-tour\">" 
											
												+ "<img src=\"http://static.sixent.com/content/1/0/85720001/4/ppt_login_step_2.png\" alt=\"Welcome Step 2\" />" 
												
											+ "</a>" 
											
										+ "</div>" 
										
										+ "<div id=\"ppt_login_step_3\" style=\"position: relative; margin:10px;\">" 
										
											+ "<a class=\"ppt_welcome_steps\" href=\"http://communityinformation.physicianspracticetoolbox.com/healthcare-networking\">" 
																					
												+ "<img src=\"http://static.sixent.com/content/1/0/85720001/2/ppt_login_step_3.png\" alt=\"Welcome Step 3\" />" 
												
											+ "</a>" 
											
										+ "</div>" 
								
									+ "</div>";
								
		// Check if content wrapper exists, if it does, then inject the newly create node
		if ($("rm-contentWrapper"))
		{
			// Add the newly created element and it's content into the DOM
			existing_div = $("rm-contentWrapper");
			parent_element = existing_div.parentNode;
			parent_element.insertBefore(loginBannerDiv, existing_div);
		}
		
		// Check if the footer exists, if it does then change some styles and inject new nodes
		if ($("rm-footer"))
		{
			// Remove margin from the footer
			$("rm-footer").style.margin = "0";

			sponsorLogoContainer = document.createElement("div");
			sponsorLogoContainer.style.textAlign = "center";
			sponsorLogoContainer.innerHTML = 	"<a id=\"ppt-login-sponsor-link-1\" style = \"background-color: #FFFFFF; \" href = \"https://www.cobizbank.com/\"><img style = \"margin: 0 15px 40px 15px;\" src=\"http://static.sixent.com/content/1/0/85720001/5/ppt_sponsor_1.png\" alt=\"Sponsor 1\" /></a>" +

												"<a id=\"ppt-login-sponsor-link-2\" style = \"background-color: #FFFFFF; \" href = \"http://www.kkb-cpa.com/\"><img style = \"margin: 0 15px 40px 15px;\" src=\"http://static.sixent.com/content/1/0/85720001/8/ppt_sponsor_2.png\" alt=\"Sponsor 2\" /></a>" +

												"<a id=\"ppt-login-sponsor-link-3\" style = \"background-color: #FFFFFF; \" href = \"http://www.denvermedsociety.org/\"><img style = \"margin: 0 15px 40px 15px;\" src=\"http://static.sixent.com/content/1/0/85720001/6/ppt_sponsor_3.png\" alt=\"Sponsor 3\" /></a>" +

												"<a id=\"ppt-login-sponsor-link-4\" style = \"background-color: #FFFFFF; \" href = \"http://www.meddirectrecruiting.com/\"><img style = \"margin: 0 15px 40px 15px;\" src=\"http://static.sixent.com/content/1/0/85720001/38/med-direct.png\" alt=\"Sponsor 4\" /></a>" +
			
												"<a id=\"ppt-login-sponsor-link-5\" style = \"background-color: #FFFFFF; \" href = \"http://healthcaremanagementpartners.physicianspracticetoolbox.com/\"><img style = \"margin: 0 15px 40px 15px;\" src=\"/assets/images/hmp_logo.png\" alt=\"Sponsor 4\" /></a>";
			
			
			
			
			// Check if the footer and feedback elements exist, if they do then inject the newly created element before the 'rm-feedback' within the footer
			if ($("rm-footerNav"))
			{
				// Add the newly created element and it's content into the DOM
				existing_div = $("rm-footerNav");
				parent_element = existing_div.parentNode;
				parent_element.insertBefore(sponsorLogoContainer, existing_div);
			}			
		}
		
		// The following will find the heading on the login page and change its size and color. 
		var loginElements = document.getElementById("rm-contentWrapper");
		for (var i = 0; i < loginElements.childNodes.length; i++)
		{
			if (loginElements.childNodes[i].nodeName == "H1")
			{
				// The heading of interest has now been found
				loginElements.childNodes[i].style.fontSize = "32px";
				loginElements.childNodes[i].style.color = "#A20F0F";
				loginElements.childNodes[i].style.fontWeight = "bold";
			}
		}
	}
});
	







