function loadAuthPrePage(fullFileName)
{

	//check to see if the user is a uk or irish user?

		theForm = document.forms['precisForm'];
		var cookiestring=""+document.cookie;
		var index1=cookiestring.indexOf('ProductCode');
		var index2=cookiestring.indexOf(';',index1);
		if (index2==-1) index2=cookiestring.length; 
		var myValue = ( unescape(cookiestring.substring(index1+'ProductCode'.length+1,index2)));
 
	 
	    if ((fullFileName == "/scripts/cis.dll?Welcome") && (myValue == "ICIS"))
	    {
	    	theForm.elements.item("Target").value= "../irishcis/welcome.asp";	
	    }
	    else
	    {
	    		//we need to authenticate a user in authlink before we can let them view an emap page.
				//so we pass in the url so that it can be redirected to the correct page
				
				
				theForm.elements.item("Target").value= fullFileName;
				
	    }
    
	    theForm.elements.item("AuthCode").value= "";
		theForm.elements.item("AccessionNo").value = "";
		theForm.action = "/cis/AuthLink.asp";	
		theForm.target = '_self';
		theForm.method = 'post';
		theForm.submit();
}

function loadIrishHomePage()
{
	theForm = document.forms['precisForm'];
	
	theForm.elements.item("AuthCode").value= "";
	theForm.elements.item("AccessionNo").value = "";
	theForm.action = "/cis/AuthLink.asp";	
	theForm.target = '_self';
	theForm.method = 'post';
	theForm.submit();
	
}

function loadPrePage(fullFileName)
{
	theForm = document.forms['precisForm'];
	
	theForm.elements.item("Target").value= "";
	theForm.elements.item("AuthCode").value= AuthCode;
	theForm.elements.item("AccessionNo").value = "";

	theForm.action = fullFileName;	
	theForm.target = '_self';
	theForm.method = 'post';
	theForm.submit();	
}

function loadCISDocument(AccessionNo)
{
	theForm = document.forms['precisForm'];
	
	theForm.elements.item("Target").value= "";
	theForm.elements.item("AuthCode").value= "";
	theForm.elements.item("AccessionNo").value= AccessionNo + 'PRE';

	theForm.method = 'get';
	theForm.action = '/cis/CISLogon.asp';
	theForm.target = '_blank';
	theForm.submit();
}


//function been added for emaps 28.10.2003

function htmlDec()
{

	var i = 0;
	var k =0;

   do
   {
   		var strTextToTransformID = 'tTT' + String(i);
   		if(document.all.item(strTextToTransformID)){
   			k=i;
   			var data='';
			data = document.all.item(strTextToTransformID).innerText;
			document.all.item(strTextToTransformID).innerHTML = data;
   		}
   
   		i++;
   }
   while (i-k <2);

}

//function added for Emap Links 31.10.2003
function loadEmaps(val)

{

	//this is the function we use to link to emaps. There are several steps to this
	//1. Determine if you are linking to news article or the home page to a website
	//2. Concaternate the url
	//3. Go through authlink.asp in cis to authenticate the user - you can only use the news if you are a cis user as precis is free service
	//4. Once authenticated you will be renavigated to to the url determined already
	//5. Now you are here you create the url to navigate to if necessary
	//6. You are then linked through EMAP_Main.asp which navigates the page to EMAP_Contents.asp
	
	if (val == 'aj')
	{
		//we have clicked to link to the aj website
		loadAuthPrePage('/cis/EMAP_Main.asp?Site=http://www.ajplus.co.uk/default.asp');
	}

	if (val == 'nce')
	{
		//we have clicked to link to the nce website
		loadAuthPrePage('/cis/EMAP_Main.asp?Site=http://www.nceplus.co.uk/default.asp');
	}

	if (val == 'cn')
	{
		//we have clicked to link to the cn webiste
		loadAuthPrePage('/cis/EMAP_Main.asp?Site=http://www.cnplus.co.uk/default.asp');

	}
	
	if((val!='aj') && (val!='nce') && (val!='cn'))
	{
		
		//here we will concaternate a page as we have a geninue news article
		
		loadAuthPrePage('/cis/EMAP_Main.asp?Site=' + val);
	}


}

