

$(document).ready(function() {
	windowLinks();
	SimpleSwapSetup();
	if($("#businesstype").val() == "Public sector/business support")
	{	
		$("#sectortr").hide();
		$("#othersectortr").hide();
		$("#turnovertr").hide();
		$("#no_of_employeestr").hide();
	}
	$("#businesstype").change(function()
							{
							
								if($("#businesstype").val() == "Public sector/business support")
								{	
									$("#sectortr").hide();
									$("#othersectortr").hide();
									$("#turnovertr").hide();
									$("#no_of_employeestr").hide();
								}
								else
								{
									$("#sectortr").show();
									$("#othersectortr").show();
									$("#turnovertr").show();
									$("#no_of_employeestr").show();
								}
							});
							
	//contyactc form
	$("#advicetr").hide();
	//$("#requireadvice").click( function() { $("#advicetr").show();)
	 $("#requireadvice").toggle( function() { 
	 										$("#advicetr").show(); 
											$("#requireadvicetr").hide();
											document.getElementById("requireadvice").checked = true;
											}, 
	 							 function() { 
								 			$("#advicetr").hide(); 
											document.getElementById("requireadvice").checked = false;
											} 
								)
});


// This is the implementation of SimpleSwap
// by Jehiah Czebotar
// Version 1.1 - June 10, 2005
// Distributed under Creative Commons
//
// Include this script on your page
// then make image rollovers simple like:
// <img src="/images/ss_img.gif" oversrc="/images/ss_img_over.gif">
//
// http://jehiah.com/archive/simple-swap
// 


function SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}



function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
  var x = document.getElementsByTagName("input");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}

/* This is our old popup code - parts of the site still use it, so I need to keep it */
function acpopup(strURL,strType,strHeight,strWidth) {
var strOptions="";
if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth+",scrollbars=yes";
window.open(strURL, '', strOptions);
}


/* new accessible, unobtrusive popup code */

function windowLinks() {
    if(!document.getElementsByTagName) {
         return;
    }
	
    var anchors = document.getElementsByTagName("a");
    for (var i = 0; i < anchors.length; i++) {
         var anchor = anchors[i];
         var relIndex = anchor.rel;
		 if (relIndex){
		 var relSplit = relIndex.split("|");
/* XHTML compliant target attribute */
		 if (relSplit[0] == "external") {
            anchor.target = "_blank";
			//anchor.className = "external";
			anchor.title = "Load in new window: "+ anchor.href;
/* XHTML compliant popup attribute */
   			} else if (relSplit[0] == "popup") {
			//anchor.className = "popup";
			anchor.title = "Link loads in Popup Window";
			anchor.popupWidth = relSplit[1];
			anchor.popupHeight = relSplit[2];
	        anchor.onclick = function() {acpopup(this.href,'console',this.popupWidth,this.popupHeight);return false;};
			}
		}
	   }
} 

