/*<![CDATA[*/
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])
    if ((version >= 5.5) && (document.body.filters)) {
        for (var i = 0; i < document.images.length; i++) {
            var img = document.images[i]
            var imgName = img.src.toUpperCase()
            if (imgName.substring(imgName.length - 3, imgName.length) == "PNG") {
                var imgID = (img.id) ? "id='" + img.id + "' " : ""
                var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                var imgStyle = "display:inline-block;" + img.style.cssText
                if (img.align == "left") imgStyle = "float:left;" + imgStyle
                if (img.align == "right") imgStyle = "float:right;" + imgStyle
                if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
                var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
                img.outerHTML = strNewHTML
                i = i - 1
            }
        }
    }
}


function showSelectedOption(selectedOption)
            {
            var rwAgeArea = document.getElementById("search_rwAgeArea")                                  
            var rwAtoZ = document.getElementById("search_rwAtoZ")                                  
            var rwSearchTextBox = document.getElementById("search_rwSearchTextBox")                                  
            var rwSearchButton = document.getElementById("search_rwSearchButton")
            
            if (selectedOption == "Provider")
               {
                rwAgeArea.style.display = "none"
                rwSearchTextBox.style.display = "none"
                rwSearchButton.style.display = "none"
                rwAtoZ.style.display = "block"
                }
            else
                {
                rwAgeArea.style.display = "block"                
                rwSearchTextBox.style.display = "block"                
                rwSearchButton.style.display = "block"                
                rwAtoZ.style.display = "none"                
                }
                
            }
            
            
            function MM_openBrWindow(theURL,winName,features) { //v2.0
              window.open(theURL,winName,features);
            }

           
         function showMoreInfo(NameOfDiv){
				if(document.getElementById(NameOfDiv).style.display == "none")
				{
				document.getElementById(NameOfDiv).style.display = "block";	
				document.getElementById(NameOfDiv + "Title").innerText = "Less Info..."
				}
					else
					{
				document.getElementById(NameOfDiv).style.display = "none";	
				document.getElementById(NameOfDiv + "Title").innerText = "More Info..."
				}
				
				//Signposting specific iframe fix
				if (document.domain == 'www.signposting.org.uk') 
				    {
	                var the_height=top.document.getElementById('sdframe').contentWindow.document.body.scrollHeight
	                var the_width=top.document.getElementById('sdframe').contentWindow.document.body.scrollWidth
	                top.document.getElementById('sdframe').height=the_height+10
	                top.document.getElementById('sdframe').width=the_width+10
                    }	
                    
                //Demo Iframe  fix
				if (document.domain == 'demo.signposting.org.uk') 
				    {
	                var the_height=top.document.getElementById('sdframe').contentWindow.document.body.scrollHeight
	                var the_width=top.document.getElementById('sdframe').contentWindow.document.body.scrollWidth
	                top.document.getElementById('sdframe').height=the_height+10
	                top.document.getElementById('sdframe').width=the_width+10
                    }			
			}
		

         function showAdvancedSearch(NameOfDiv, HrefName){
				if(document.getElementById(NameOfDiv).style.display == "none")
				{
				document.getElementById(NameOfDiv).style.display = "block";	
				document.getElementById(HrefName).innerHTML = "Hide search tools..."
				}
					else
					{
				document.getElementById(NameOfDiv).style.display = "none";	
				document.getElementById(HrefName).innerHTML = "Refine your search..."
				}
							
			}

		

		
		
		
		 function showPage(ShowNameOfDiv, MaxDivCount)
		 {
				for (i = 0; i <= MaxDivCount; i++)
                {
                  document.getElementById("divResultsPage" + i).style.display = "none";	
                  document.getElementById("pageno" + i).style.color = "blue";
                }
                document.getElementById("divResultsPage" + ShowNameOfDiv).style.display = "block";
                document.getElementById("pageno" + ShowNameOfDiv).style.color = "red";
    	 }

function showServiceType(ShowDiv, HideDiv) {

    var postCode = document.getElementById("ctl05_MonopSearch2_1_txtPostCode").value;

    if (postCode != "Enter a Postcode") {
        for (i = 0; i < document.links.length; i++) {

            document.links[i].href = document.links[i].href.replace(/postcode=.+miles/, "postcode=" + postCode + "&miles");

        }
    }
                document.getElementById(ShowDiv).style.display = "block";	
				document.getElementById(HideDiv).style.display = "none";	
    }

    function getPostcode() {

        var postCode = document.getElementById("ctl05_MonopSearch2_1_txtPostCode").value;
        if (postCode != "Enter a Postcode") {
            for (i = 0; i < document.links.length; i++) {

                document.links[i].href = document.links[i].href.replace(/postcode=.+miles/, "postcode=" + postCode + "&miles");

            }
        }
    }
    
    
    
    function getSearchCriteria(txtID)
    {
                var returnStr = ""
                var clickCount = document.getElementById("txtClicks").value
                if (clickCount == 0)
                {
                returnStr = encodeURIComponent(document.getElementById(txtID).value);
                document.getElementById("txtClicks").value = 1
   				}
   				return returnStr
   				
    }
    
    
    
    function clearText(theInput)
{
	var v = trim(theInput.value);
	if(v == "Postcode")
		theInput.value = "";
}
function setDefaultText(theInput)
{
	var v = trim(theInput.value);
	if(v == "")
		theInput.value = "Postcode";
}
function trim(s)
{
	while(s.indexOf(" ") == 0)
		s = s.substr(1, s.length - 1);
	while(s.length > 0 && s.lastIndexOf(" ") == s.length - 1)
		s = s.substr(0, s.length - 1);
	return s;
}
    
    
    
/*]]>*/