var dirPath = "";
if (window.parent.document.location.href.toUpperCase().indexOf("/NUT/") != -1) 
{
    dirPath = "../";
}
document.write("<script type=\"text/javascript\" src=\"" + dirPath + "includes/infomessage.js\"></scr" + "ipt>");

// * opens a new window based on the arguments provided
// * 
// * context - the location of the page being opened, exii, webx, tps
// * page - the page that is to be opened
// * title - the title to give the window being opened
// * windowArgs - the features argument to pass through to the window.open call

function openWindow(context, page, title, windowArgs) {
	
	//use location.hostname to identify which domain is being used
	hostName = location.hostname;	
	
    if(context.toString().toUpperCase() == 'EXII')
    {
        if (hostName == "www.test-teachers.co.uk" 
            || hostName == "www.dev-teachers.co.uk"
            || hostName == "testteachers.datacenta.net"
            || hostName == "devteachers.datacenta.net"
            || hostName == "teachers.datacenta.net")
        {
            //when in the dev website the exii context is actually e0
            context = 'e0';
        }
        else if (hostName == "proteachers.datacenta.net"
            || hostName == "www.teachersassurance.co.uk")
        {
            //when in the live website the exii context is correct
            context = 'exii';
        }		        
	}	
	
	if(context.toString().substr(0,3).toUpperCase() == 'TPS')
	{	
	    hostName = "http://" + hostName;
	    context = '';
	}
	else
	{
        hostName = "https://" + hostName;
        context = context + '/';
	}
		
	var actualPageName =   hostName + '/' + context + page;
		
	var wH = window.open(actualPageName,title,windowArgs);	
		
	return false;
}

//*
// * navigates to the link based on the arguments provided
// * 
// * context - the location of the page being opened, exii, webx, tps
// * page - the page that is to be navigated to
//*
function openLink(context, page){

    //use location.hostname to identify which domain is being used
	hostName = location.hostname;	
	
		
	if(context.toString().toUpperCase() == 'EXII')
    {
        if (hostName == "www.test-teachers.co.uk" 
            || hostName == "www.dev-teachers.co.uk"
            || hostName == "testteachers.datacenta.net"
            || hostName == "devteachers.datacenta.net"
            || hostName == "teachers.datacenta.net")
        {
            //when in the dev website the exii context is actually e0
            context = 'e0';
        }
        else if (hostName == "proteachers.datacenta.net"
            || hostName == "www.teachersassurance.co.uk")
        {
            //when in the live website the exii context is correct
            context = 'exii';
        }		        
	}	
	
	if(context.toString().substr(0,3).toUpperCase() == 'TPS')
	{	
	    hostName = "http://" + hostName;
	    context = '';
	}
	else
	{
        hostName = "https://" + hostName;
        context = context + '/';
	}
	
	var actualPageName =  hostName + '/' + context + page;
	
	document.location.href = actualPageName;
	
	return false;
}
