// stfc extranet site script
// Last updated 6 January 2009

    var g_siteroot = "";
    
	function popStoat(intCallingPage)
		{
			window.open (g_siteroot + "/stoat/stMain2.aspx?m=start&id=" + intCallingPage, "wdwStoat", "toolbar=no,menubar=no,status=yes,width=820,height=500,top=100,left=150,scrollbars=1,resizable=yes");
		}
		
	function popStoat2(intCallingPage, intUId)
		{
			window.open (g_siteroot + "/stoat/stMain3.aspx?m=start&id=" + intCallingPage + "&u=" + intUId, "wdwStoat", "toolbar=no,menubar=no,status=yes,width=950,height=612,top=50,left=50,scrollbars=1,resizable=yes");
		
		}		
		
	function popStoatyFactlet(strCallingPage)
		{
			window.open (g_siteroot + "/stoat/stFactletEditor.aspx?&id=" + strCallingPage, "wdwStoatyFactlet", "toolbar=no,menubar=no,status=yes,width=820,height=500,top=100,left=150,scrollbars=1,resizable=yes");
		}				
		
	function popDiary(strMode, intPageId, intWebId)
		{
			window.open (g_siteroot + "/diary/diary.aspx?m=" + strMode + "&id=" + intPageId + "&webId=" + intWebId, "wdwDiary", "toolbar=no,menubar=no,status=yes,width=820,height=500,top=100,left=150,scrollbars=1,resizable=yes");
		}	
		
	function openOurSite()
		{
			intSelectedItem = document.getElementById("drpSiteList2").selectedIndex;
			strURL = document.getElementById("drpSiteList2").options[intSelectedItem].value;
			if (strURL != "none")
				{window.open (strURL, "wdwSite", "toolbar=yes,menubar=yes,location=yes,status=yes,width=820,height=500,top=100,left=150,scrollbars=1,resizable=yes");}
		}			

		function setSearch()
			{
      			strSearch = location.search;
      			strSearch = strSearch.replace('?', '');
      			arrSearch = strSearch.split('&');
      			for (i=0;i<arrSearch.length;i++)
      				{
      					if (arrSearch[i].indexOf('q=') > -1)
      						{
      							strSearchPhrase = unescape(arrSearch[i].replace('q=', ''));
      							strSearchPhrase = strSearchPhrase.replace('+', ' ');
      							document.getElementById("qf").value = strSearchPhrase;	
      							//alert(strSearchPhrase);
      						}
        				if (arrSearch[i].indexOf('site') > -1)
      					{
      						//alert(unescape(arrSearch[i].substr(5)));
      						switch(unescape(arrSearch[i].substr(5)))
      							{
      							case 'X':
      								document.getElementById("site1").checked = true;   
      								break; 
      							case 'CCLRC|PPARC':
      								document.getElementById("site1").checked = true;   
      								break; 							
       							case 'C':
      								document.getElementById("site2").checked = true;  
      								break; 
        						case 'CCLRC':
      								document.getElementById("site2").checked = true;  
      								break;      								 								
       							case 'P':
      								document.getElementById("site3").checked = true; 
      								break; 
       							case 'PPARC':
      								document.getElementById("site3").checked = true; 
      								break;      								
      							   									
      							}
      					}    						
      				}
			}
			
		function showComments()
		    {		    
		    if (document.getElementById('uComments').className == 'hBlock')
				{document.getElementById('uComments').className = 'vBlock';}				
			else
				{document.getElementById('uComments').className = 'hBlock';}
		    }
		    
		function showLink()
		    {		    
		    if (document.getElementById('uLinks').className == 'hBlock')
				{document.getElementById('uLinks').className = 'vBlock';}				
			else
				{document.getElementById('uLinks').className = 'hBlock';}
		    }	
		    
		function showMoreNews()
		    {		    
		    if (document.getElementById('moreNews').className == 'hBlock')
				{document.getElementById('moreNews').className = 'vBlock';}				
			else
				{document.getElementById('moreNews').className = 'hBlock';}
		    }	
		    
		function setFormFocus(strField)
			{
				document.getElementById(strField).focus();	
			}
		
			    
		// for PPRP flowchart pages (by Carl)

		function hidepprpflowchart(x) 
			{
				document.getElementById(x).className = 'hBlock';
			}

		function showpprpflowchart(x) 
			{
				document.getElementById(x).className = 'vBlock';
			}

    	    