
var arrPage = new Array;

arrPage[0]="/ndp/BacgroundObjectives.htm";
arrPage[1]="/ndp/scopeofwork.htm";
arrPage[2]="/ndp/organisation_and_work_flow.htm";
//arrPage[3]="/ndp/currentprojectsandplans.htm";
arrPage[4]="/ndp/Events_And_Main_Achievements.htm";
//arrPage[5]="/ndp/experiences.htm";
arrPage[7]="/files/htm/3076.htm";

arrPage[20]="/ndp/projects.htm";
arrPage[30]="/ndp/contacts.htm";
arrPage[40]="/scripts/Events.asp";
arrPage[50]="/ndp/links.htm";
arrPage[60]="/ndp/help.htm";
arrPage[70]="/login/help.htm";


//Environmental
arrPage[110]="/environmental/projects.htm";
//arrPage[111]="/environmental/reportlist.htm";
arrPage[111]="/scriptsp/environmentalreportlist.asp";
//arrPage[112]="/login/reportlist_environmental.htm";
arrPage[112]="/scripts/environmentalreportlist.asp";
arrPage[113]="/scripts/forum_environmental_admpresentations_list.asp";
arrPage[114]="/scripts/forum_environmental_meetings_list.asp";
arrPage[115]="/scripts/forum_environmental_agreements_list.asp";


//Metocean
arrPage[220]="/metocean/activities.htm";
//arrPage[221]="/metocean/reportlist.htm";
arrPage[221]="/scripts/metoceanreportlist.asp";
arrPage[222]="/metocean/maps/MetoceanLocMap.htm";
arrPage[223]="/scriptsp/metoceanreportlist.asp";
arrPage[225]="/metocean/organisation.htm";
//arrPage[226]="/metocean/present/default.htm";
arrPage[226]="/scripts/metoceanpresentationlist.asp";
arrPage[227]="/metocean/publications/default.htm";
arrPage[228]="/scripts/forum_metocean_admpresentations_list.asp";
arrPage[229]="/scripts/forum_metocean_meetings_list.asp";
arrPage[230]="/scripts/forum_metocean_agreements_list.asp";


//Riser & Mooring
arrPage[311]="/riserandmooring/reportlist.htm";
//arrPage[312]="/riserandmooring/present/default.htm";
arrPage[312]="/scripts/riserandmooringpresentationlist.asp";
arrPage[313]="/riserandmooring/publications/default.htm";
//arrPage[314]="/login/reportlist_riserandmooring.htm";
arrPage[314]="/scripts/riserandmooringreportlist.asp";
//arrPage[314]="/scripts/riserandmooringreportlist.asp";
arrPage[315]="/scripts/forum_risermoor_admpresentations_list.asp";
arrPage[316]="/scripts/forum_risermoor_meetings_list.asp";
arrPage[317]="/scripts/forum_risermoor_agreements_list.asp";
arrPage[320]="/scripts/riserandmooringreportlist.asp";


//Subsea
arrPage[410]="/subsea/scope.htm";
arrPage[412]="/subsea/subsea_systems_activity.htm";
arrPage[413]="/subsea/flow_assurance_activity.htm";
//arrPage[420]="/login/reportlist_Subsea.htm";
arrPage[420]="/scripts/subseareportlist.asp";
//arrPage[421]="/subsea/reportlist.htm";
arrPage[421]="/scriptsp/subseareportlist.asp";
//arrPage[422]="/subsea/present/default.htm";
arrPage[422]="/scripts/subseapresentationlist.asp";
arrPage[423]="/scripts/forum_subsea_admpresentations_list.asp";
arrPage[424]="/scripts/forum_subsea_meetings_list.asp";
arrPage[425]="/scripts/forum_subsea_agreements_list.asp";


//Seabed
arrPage[510]=""
arrPage[519]="/scriptsp/seabedreportlist.idc";
arrPage[520]="/scripts/reportlist.idc";
//arrPage[521]="/seabed/present/default.htm";
arrPage[521]="/scripts/seabedpresentationlist.asp";
arrPage[522]="/seabed/maps/TOBI survey map.htm";
arrPage[523]="/seabed/publications/default.htm";
arrPage[524]="/seabed/organisation.htm";
arrPage[525]="/seabed/history.htm";
arrPage[526]="/seabed/whats-new.htm";
arrPage[527]="/seabed/projects.htm";
arrPage[528]="/seabed/database.htm";
arrPage[529]="/seabed/publications.htm";

arrPage[530]="/scripts/boundary_fieldph_ny.idc";
arrPage[531]="/scripts/boundary_fieldth_ny.idc";
arrPage[532]="/scripts/boundary_labtst_ny.idc";
arrPage[533]="/scripts/boundary_strat_ny.idc";
arrPage[534]="/scripts/boundary_rep_ny.idc";
arrPage[535]="/scripts/boundary_file_ny.idc";

arrPage[540]="/scripts/forum_seabed_admpresentations_list.asp";
arrPage[541]="/scripts/forum_seabed_meetings_list.asp";
arrPage[542]="/scripts/forum_seabed_agreements_list.asp";

arrPage[550]="/scripts/seabedreportlist.asp";


//Steering
arrPage[620]="/scripts/forum_steering_presentations_list.asp";
arrPage[621]="/scripts/forum_steering_meetings_list.asp";
arrPage[622]="/scripts/forum_steering_agreements_list.asp";
arrPage[623]="/scripts/SteeringCommitteePresentationList.asp";




function OpenMenu(menu){
	//finn id til meny som er valgt

	var submnu = menu.substring(3,menu.length);

	//skjul andre menyer hvis ny velges
	CloseOldMenu(submnu);
	

	if (submnu.length == 2)
		top.frames[1].document.getElementById('sub'+submnu.substring(0,1)).style.display='block';
	
	
	top.frames[1].document.getElementById('sub'+submnu).style.display='block';

	ClearSearchBox();	
}

function CloseOldMenu(submnu){
	
	top.frames[1].document.getElementById('sub21').style.display='none';
	top.frames[1].document.getElementById('sub22').style.display='none';
	top.frames[1].document.getElementById('sub23').style.display='none';
	top.frames[1].document.getElementById('sub24').style.display='none';
	top.frames[1].document.getElementById('sub25').style.display='none';
	top.frames[1].document.getElementById('sub2').style.display='none';

	top.frames[1].document.getElementById('sub1').style.display='none';

}

function OpenPage(id){	

	top.frames[2].location=arrPage[id];

	ClearSearchBox();

}

function LoadMainPage(){
	top.frames[0].location="/ndp/header.htm"
	top.frames[1].location="/scriptsp/newsframe.idc"
	top.frames[2].location="/ndp/main.htm"
}

function LoadEnvironmentalMainPage(){
	top.frames[2].location="/environmental/main.htm"
}

function LoadMetoceanMainPage(){
	top.frames[2].location="/metocean/main.htm"
}

function LoadRiserMooringMainPage(){
	top.frames[2].location="/riserandmooring/main.htm"
}

function LoadSubseaMainPage(){
	top.frames[2].location="/subsea/main.htm"
}

function LoadSeabedMainPage(){
	top.frames[2].location="/seabed/main.htm"
}

function ClearSearchBox(){

	top.frames[0].document.search.CiRestriction.value="";
}

function Logintemp(){
	
	alert("After you close this message box you will see a Security Alert regarding an expired security certificate and non secure items. Just click the Yes button to proceed. If the menus dont display properly, just click Log out and then click Login again. Webmaster.");
	top.location="https://www.ndwp.org/login/midlertidig.htm";
}	

function Logintest(){
	
	top.location="https://www.ndwp.org/scripts/login.asp";
}

function Login(){

	top.location="https://www.ndwp.org/scripts/login.asp";		
	//top.location="https://www.ndwp.org/login/default.htm";
	//top.frames[2].location="http://www.ndwp.org/loginproblem.htm";

	//top.frames[0].location="https://www.ndwp.org/login/header.htm";
	//top.frames[1].location="https://www.ndwp.org/scripts/newsframe.idc";
	//top.frames[2].location="https://www.ndwp.org/login/main.htm";

}

function LogOut(){
	top.location="/default.htm";

	//top.frames[0].location="http://www.ndwp.org/ndp/header.htm";
	//top.frames[1].location="http://www.ndwp.org/scriptsp/newsframe.idc";
	//top.frames[2].location="http://www.ndwp.org/ndp/main.htm";	
}

function Query(CiRestriction){	
	q = CiRestriction.value;

	top.frames[2].location="/scriptsp/query.idq?CiRestriction="+q;

}

function Query2(CiRestriction){	
	q = CiRestriction.value;

	//top.frames[0].location="https://www.ndwp.org/login/header.htm"
	top.frames[2].location="https://www.ndwp.org/scripts/query.idq?CiRestriction="+q;	
	
}

function Query3(CiRestriction){	

	var arrP = new Array();
	var arrStr = new Array();

	q=CiRestriction.value;

	for (i=0; i < q.length; i++){
		if (q.substr(i,1) == " ")
			q = q.substr(i+1);
		else
			i=q.length;
	}

	//finn alle AND
	j=1;
	arrP[0]=0;
	for (i=0; i < q.length; i++){
		if (q.substr(i,5) == " AND "){
			arrP[j]=i;
			j=j+1;
			arrP[j]=i+5;
			j=j+1;
		}
	}
	arrP[j] = q.length-1;	

	j=0;
	for (i=1; i < arrP.length; i=i+2){
		arrStr[j]=q.substr(arrP[i-1],arrP[i]-arrP[i-1]);
		j=j+1;
	}


	s = "SELECT filename, f.type, contents, file_size, category, ft.description "
	s = s + "FROM files f, category c, filetype ft "
	s = s + "WHERE f.categoryid = c.categoryid AND f.type = ft.type "
	s = s + "AND filename IN (SELECT filename FROM files WHERE LOWER(contents) LIKE LOWER('£";

	s2 = "AND filename IN (SELECT filename FROM files WHERE LOWER(contents) LIKE LOWER('£";

	for (i=0; i < arrStr.length; i++){
		if (i == 0)
			s = s + arrStr[i] + "£')) ";
		else
			s = s + s2 + arrStr[i] + "£')) ";
	
	}
	
	s = s + "ORDER BY category";
		
	//top.frames[0].location="https://www.ndwp.org/login/header.htm"	
	top.frames[2].location="https://www.ndwp.org/scripts/queryfilesall.asp?qry="+s;	
	
	
}

function Query3org(CiRestriction){	


	q=CiRestriction.value;

	for (i=0; i < q.length; i++){
		if (q.substr(i,1) == " ")
			q = q.substr(i+1);
		else
			i=q.length;
	}

/*	for (i=q.length-1; i > 0 ; i--){
		if (q.substr(i) == " "){
			q = q.substr(1,i-1);
			alert(1);
		}
		else{
			i=0;
			alert(0);
		}
	}*/


	q=Encode(q);
	
	top.frames[0].location="https://www.ndwp.org/login/header.htm"
	top.frames[2].location="https://www.ndwp.org/scripts/queryfilesall.idc?contents="+q;	
	
	
}
function Encode(value){
	var result = ""
	for (i=0; i < value.length; i++){			
		if (value.substr(i,1) == " "){
			result = result + "+"
		}
		else{
			result = result + value.substr(i,1)
		}
	}
	
	return result
}


function AddNews(){		
	//top.frames[2].location="/scripts/add_news_pre.idc";
	//top.frames[2].location="/login/add_news.htm";
	top.frames[2].location="/login/add_news_upload.htm";
}


function ReadMore(nid){		
	top.frames[2].location="/scriptsp/readnews.idc?id=" + nid;
}

function ReadMore2(nid){		
	top.frames[2].location="/scripts/readnews.idc?id=" + nid;
}

function MoreNews(){
	top.frames[2].location="/scriptsp/allnews.idc";
}

function MoreNews2(){
	top.frames[2].location="/scripts/allnews.idc";
}

function UpdateNewsFrame(){
	top.frames[1].location="/scripts/newsframe.idc";
}

function OpenSite(site){
	if (site == "conoco")
		window.open("http://www.conocophillips.com");

	if (site == "exxon")
		window.open("http://www.exxonmobil.com");

	if (site == "bp")
		window.open("http://www.bp.no");	

	if (site == "hydro")
		window.open("http://www.hydro.com");

	if (site == "shell")
		window.open("http://www.shell.no");	

	if (site == "statoil")
		window.open("http://www.statoil.com");

	if (site == "total")
		window.open("http://www.total.com");

	if (site == "rwe")
		window.open("http://www.rwe-dea.no");

	if (site == "eni")
		window.open("http://www.eninorge.no");

	if (site == "chevron")
		window.open("http://www.chevron.com");

	if (site == "statoilhydro")
		window.open("http://www.statoilhydro.com");

	if (site == "gdf")
		window.open("http://www.gdfsuezep.no");

	if (site == "suncor")
		window.open("http://www.suncor.com");

	if (site == "rocksource")
		window.open("http://www.rocksource.com");
} 

function eRoom(){
	//window.open("https://project.sintef.no/eRoom/civil/NDP");
	
	top.frames[2].location="/scripts/ndp_forum.asp";
}

function RemoveMetocean(id, p){	
	top.frames[2].location="https://www.ndwp.org/scripts/remove_from_forum_metocean.asp?id="+id + "&p="+p;
}

function RemoveMetoceanReport(id, p){
	top.frames[2].location="/scripts/remove_metocean_report.asp?id="+id + "&p="+p;
	//top.frames[2].location="https://www.ndwp.org/scripts/remove_metocean_report.asp?id="+id + "&p="+p;
}

function RemoveEnvironmental(id, p){
	top.frames[2].location="https://www.ndwp.org/scripts/remove_from_forum_environmental.asp?id="+id + "&p="+p;
}

function RemoveEnvironmentalReport(id, p){
	top.frames[2].location="https://www.ndwp.org/scripts/remove_environmental_report.asp?id="+id + "&p="+p;
}

function RemoveRiserandmooring(id, p){
	top.frames[2].location="https://www.ndwp.org/scripts/remove_from_forum_riserandmooring.asp?id="+id + "&p="+p;
}

function RemoveRiserandmooringReport(id, p){
	top.frames[2].location="https://www.ndwp.org/scripts/remove_riserandmooring_report.asp?id="+id + "&p="+p;
}

function RemoveRiserandmooringPresentation(id, p){
	top.frames[2].location="https://www.ndwp.org/scripts/remove_riserandmooring_presentation.asp?id="+id + "&p="+p;
}

function RemoveSubsea(id, p){
	top.frames[2].location="https://www.ndwp.org/scripts/remove_from_forum_subsea.asp?id="+id + "&p="+p;
}

function RemoveSubseaReport(id, p){
	top.frames[2].location="https://www.ndwp.org/scripts/remove_subsea_report.asp?id="+id + "&p="+p;
}

function RemoveSubseaPresentation(id, p){
	top.frames[2].location="https://www.ndwp.org/scripts/remove_subsea_presentation.asp?id="+id + "&p="+p;
}

function RemoveSteering(id, p){
	top.frames[2].location="https://www.ndwp.org/scripts/remove_from_forum_steering.asp?id="+id + "&p="+p;
}

function RemoveSteeringReport(id, p){
	top.frames[2].location="https://www.ndwp.org/scripts/remove_steering_report.asp?id="+id + "&p="+p;
}

function RemoveSeabed(id, p){
	top.frames[2].location="https://www.ndwp.org/scripts/remove_from_forum_seabed.asp?id="+id + "&p="+p;
}

function RemoveSeabedReport(id, p){
	top.frames[2].location="https://www.ndwp.org/scripts/remove_seabed_report.asp?id="+id + "&p="+p;
}

function RemoveSeabedPresentation(id, p){
	top.frames[2].location="https://www.ndwp.org/scripts/remove_seabed_presentation.asp?id="+id + "&p="+p;
}

function ManageEnvironmentalReportAccess(id){
	top.frames[2].location="https://www.ndwp.org/scripts/manage_environmental_report_access.asp?id="+id;
}

function RemoveEnvironmentalReportAccess(id, grpid){	
	top.frames[2].location="https://www.ndwp.org/scripts/remove_environmental_report_access.asp?id="+id + "&grpid="+grpid;
}

function AddEnvironmentalReportAccess(id, grpid){
	top.frames[2].location="https://www.ndwp.org/scripts/add_environmental_report_access.asp?id="+id + "&grpid="+grpid;
}

function ManageRiserandmooringReportAccess(id){
	top.frames[2].location="https://www.ndwp.org/scripts/manage_riserandmooring_report_access.asp?id="+id;
}

function RemoveRiserandmooringReportAccess(id, grpid){	
	top.frames[2].location="https://www.ndwp.org/scripts/remove_riserandmooring_report_access.asp?id="+id + "&grpid="+grpid;
}

function AddRiserandmooringReportAccess(id, grpid){
	top.frames[2].location="https://www.ndwp.org/scripts/add_riserandmooring_report_access.asp?id="+id + "&grpid="+grpid;
}

function ManageMetoceanReportAccess(id){
	top.frames[2].location="https://www.ndwp.org/scripts/manage_metocean_report_access.asp?id="+id;
}

function RemoveMetoceanReportAccess(id, grpid){	
	top.frames[2].location="https://www.ndwp.org/scripts/remove_metocean_report_access.asp?id="+id + "&grpid="+grpid;
}

function AddMetoceanReportAccess(id, grpid){
	top.frames[2].location="https://www.ndwp.org/scripts/add_metocean_report_access.asp?id="+id + "&grpid="+grpid;
}

function ManageSubseaReportAccess(id){
	top.frames[2].location="https://www.ndwp.org/scripts/manage_subsea_report_access.asp?id="+id;
}

function RemoveSubseaReportAccess(id, grpid){	
	top.frames[2].location="https://www.ndwp.org/scripts/remove_subsea_report_access.asp?id="+id + "&grpid="+grpid;
}

function AddSubseaReportAccess(id, grpid){
	top.frames[2].location="https://www.ndwp.org/scripts/add_subsea_report_access.asp?id="+id + "&grpid="+grpid;
}

function ManageSeabedReportAccess(id){
	top.frames[2].location="https://www.ndwp.org/scripts/manage_seabed_report_access.asp?id="+id;
}

function RemoveSeabedReportAccess(id, grpid){	
	top.frames[2].location="https://www.ndwp.org/scripts/remove_seabed_report_access.asp?id="+id + "&grpid="+grpid;
}

function AddSeabedReportAccess(id, grpid){
	top.frames[2].location="https://www.ndwp.org/scripts/add_seabed_report_access.asp?id="+id + "&grpid="+grpid;
}
