


strURL = location.href
//to match a planning ref
regularexpression = /[aA][pP][pP]\/\d{4,4}\/\d{4,4}/

//if (strURL.indexOf("http://www.ukplanning.com/aberdeenshire/findCaseFile.do?appNumber=") > -1) {
//window.location = "http://www.aberdeenshire.gov.uk/planning/apps/detail.asp?ref_no=" + strURL.substring(66,79)
//} 
//else 
//check for the uk planning url AND a valid application reference number
if ( strURL.indexOf("http://www.ukplanning.com/aberdeenshire/") > -1 && strURL.search(regularexpression)>0 ) {
	//alert("an app ref has been found");
	//alert(strURL.substring(strURL.search(regularexpression)));
	//redirect to the new url
	window.location = "http://www.aberdeenshire.gov.uk/planning/apps/detail.asp?ref_no=" + strURL.substring(strURL.search(regularexpression));
}

else if (strURL.indexOf("http://www.ukplanning.com/aberdeenshire/") > -1) {
window.location = "http://www.aberdeenshire.gov.uk/planning/apps/index.asp"
}


function toggle(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}



// jr oct 2011 for top tabs
function firston(id) {
  $('#header #toptabs ul.tabs li a#' + id).css("background-image", "url(/images/template/bg-hometabs-on2-first.png)");
  
  //   #header #toptabs .tabcontent .super .super2 ul li a:hover
  //html > body #section11 > div #header > div #toptabs > ul .tabs > li #tabsFirst .tabsitem > div #reportit .tabcontent > span .super > span .super2 > span .tabcontentcol > ul > li > a
  //override global change
  $('#header #toptabs .tabcontent .super .super2 ul li a').css("background-image", "none");
  
  /*
    
   #header #toptabs ul.tabs li#tabsFirst a { background: url(/images/template/bg-hometabs-first.png) no-repeat top left; }
#header #toptabs ul.tabs li#tabsFirst.tabsOn a { background: url(/images/template/bg-hometabs-on2-first.png) no-repeat top left; }
#header #toptabs ul.tabs li#tabsFirst a:hover { background: url(/images/template/bg-hometabs-first.png) no-repeat top left; }
#header #toptabs ul.tabs li#tabsFirst a:hover { background: url(/images/template/bg-hometabs-on2-first.png) no-repeat top left; }

  $('#header #toptabs ul.tabs li#tabsFirst a').css("background-image", "none");
  $('#header #toptabs ul.tabs li#tabsFirst.tabsOn a').css("background-image", "none");
  $('#header #toptabs ul.tabs li#tabsFirst a:hover').css("background-image", "none");
  $('#header #toptabs ul.tabs li#tabsFirst a:hover').css("background-image", "none");
*/



  
}

function firstoff(id) {
  $('#header #toptabs ul.tabs li a#' + id).css("background-image", "url(/images/template/bg-hometabs-first.png)");
}

function standardon(id) {
  $('#header #toptabs ul.tabs li a#' + id).css("background-image", "url(/images/template/bg-hometabs-on2.png)");
  $('#header #toptabs ul.tabs li a#' + id).css("background-repeat", "no-repeat");
}

function standardoff(id) {
  $('#header #toptabs ul.tabs li a#' + id).css("background-image", "url(/images/template/bg-hometabs.png)");
  $('#header #toptabs ul.tabs li a#' + id).css("background-repeat", "no-repeat");
}

function laston(id) {
  $('#header #toptabs ul.tabs li#tabsLastTab a#' + id).css("background-image", "url(/images/template/bg-hometabs-on1-last.png)");
  
  $('#header #toptabs ul.tabs li a#' + id).css("background-image", "url(/images/template/bg-hometabs-on2.png)");
  $('#header #toptabs ul.tabs li a#' + id).css("background-repeat", "no-repeat");
  $('#header #toptabs ul.tabs li a#' + id).css("background-position", "left top");
}

function lastoff(id) {
  $('#header #toptabs ul.tabs li#tabsLastTab a#' + id).css("background-image", "url(/images/template/bg-hometabs.png)");

  $('#header #toptabs ul.tabs li a#' + id).css("background-image", "url(/images/template/bg-hometabs.png)");
  $('#header #toptabs ul.tabs li a#' + id).css("background-repeat", "no-repeat");
  $('#header #toptabs ul.tabs li a#' + id).css("background-position", "left bottom");
}
// end top tabs





