function getSslPort()
		{
			var p = 0;
			var protocol = this.document.location.protocol;
			var port = this.document.location.port;
			if (protocol == "https:")
				p = port;
			else
				p = ++port;			
				
			return p;				
		}

		function getPort()
		{
			var p = 0;
			var protocol = this.document.location.protocol;
			var port = this.document.location.port;

			if (protocol == "http:")
				p = port;
			else
				p = --port;			
				
			return p;				
		}

		
	function hideProtocol(url,val)
		{		 
		   var nonNovartisMessage='You are leaving Novartis. As a resource to our visitors, Novartis may provide links to other Web sites. We try to carefully choose websites that we believe are useful and meet our high standards. However, Novartis does not control, endorse, promote, or have any affiliation with any other website unless it is expressly stated. Novartis is not responsible for the content, accuracy, or any other aspect of the information contained on such linked sites.';
		   var NovartisMessage='You are leaving the NovartisClinicalTrials.com website. Thank you for visiting NovartisClinicalTrials.com. You are now going to another Novartis website outside of this application.';
			if(val)
			{
				var ask=confirm(NovartisMessage);
			}
			else{
				var ask=confirm(nonNovartisMessage);
			}
	        
	   if(ask){
	            var loc = "h"+"ttp://"+url;
			    this.document.location=loc;
			    return false;
		   }
		 
		return false;
		  
			
		}	
		
		function retainProtocol(url,val)
		{
		  
		   var nonNovartisMessage='You are leaving Novartis. As a resource to our visitors, Novartis may provide links to other Web sites. We try to carefully choose websites that we believe are useful and meet our high standards. However, Novartis does not control, endorse, promote, or have any affiliation with any other website unless it is expressly stated. Novartis is not responsible for the content, accuracy, or any other aspect of the information contained on such linked sites.';
		   var NovartisMessage='You are leaving the NovartisClinicalTrials.com website. Thank you for visiting NovartisClinicalTrials.com. You are now going to another Novartis website outside of this application.';
			if(val)
			{
				var ask=confirm(NovartisMessage);
			}
			else{
				var ask=confirm(nonNovartisMessage);
			}
	           
  	   if(ask){

			this.document.location=url;
			return false;
			
	     }
		 
		return false;
		  			
		}	

		function submitSearchForm(searchForm)
		{			
			var initialAction = searchForm.action;				
			var hostName = this.document.location.hostname;				
			var neededAction = "h" + "ttp://" + hostName +
				":" + getPort() + "/" + initialAction;
			searchForm.action = neededAction;			
			return true;
		}
		
		function redirectMenu(link)
		{					  
			var finalPort = link.port;			
			var linkHostname = link.hostname;			 
			var linkPathname = link.pathname;
			
			var isCurrentSSL = false;
			var protocolNotSSL = "h"+"ttp:";
			var protocolSSL = "h"+"ttps:";
			
		   
			var portal = linkPathname.substring(linkPathname.lastIndexOf('/'));
			
			if (this.document.location.protocol == protocolSSL)
				isCurrentSSL = true;

            if(linkHostname=="novintegweb01d.na.novartis.net")
			{            	
				var finalPortPlus1 = getSslPort();
				var finalPortMinus1 = getPort();			
			}
			else
			{
			   
				var finalPortPlus1 = "443";
				var finalPortMinus1 = "80";	
				 
			}
				var finalProtocol = protocolSSL;

			if (portal == "/MailingList" || linkPathname == "webapp/etrials/optInLogIn.do" || linkPathname == "webapp/etrials/registration.do" || linkPathname == "webapp/etrials/contactStudyCenter.do" || linkPathname == "webapp/portal/contactStudyCenter.do")
			{				
				finalProtocol = protocolSSL;
				finalPort = finalPortPlus1;
				
			}
			else
			{
				finalPort = finalPortMinus1;
				finalProtocol = protocolNotSSL;
			}

			var loc;
			if (navigator.appName.indexOf('Microsoft') != -1) { 
				loc = finalProtocol + "//" + linkHostname + ":" +
				finalPort + "/" +linkPathname;
			}
			else{
				loc = finalProtocol + "//" + linkHostname + ":" +
				finalPort + linkPathname;
			}
			
			this.document.location = loc;

			return false;  
		}	

function redirectMenu1(link,param)
		{			
		   
			var finalPort = link.port;			
			var linkHostname = link.hostname;
			
			var linkPathname = link.pathname;
			
			var isCurrentSSL = false;
			var protocolNotSSL = "h"+"ttp:";
			var protocolSSL = "h"+"ttps:";
			
		   
			var portal = linkPathname.substring(linkPathname.lastIndexOf('/'));
			
			if (this.document.location.protocol == protocolSSL)
				isCurrentSSL = true;


			  if(linkHostname =="novintegweb01d.na.novartis.net")
			{
		
				var finalPortPlus1 = getSslPort();
				var finalPortMinus1 = getPort();			
			}
			else
			{
			
				var finalPortPlus1 = 443;
				var finalPortMinus1 = 80;		
			}		

			var finalProtocol = protocolSSL;

			if (portal == "/MailingList" || linkPathname == "webapp/portal/registration.do" || linkPathname == "webapp/etrials/optInLogIn.do" || linkPathname == "webapp/etrials/registration.do" || linkPathname == "webapp/etrials/contactStudyCenter.do" || linkPathname == "webapp/portal/contactStudyCenter.do")
			{				
				finalProtocol = protocolSSL;
				finalPort = finalPortPlus1;
			}
			else
			{
				finalPort = finalPortMinus1;
				finalProtocol = protocolNotSSL;
			}

			var loc = finalProtocol + "//" + linkHostname + ":" +
				finalPort + "/" + linkPathname+param;			
			this.document.location = loc;

			return false; 
		}
		
