/* START DROPDOWN SCRIPT.JS */
var menu=function(){
	var t=15,z=50,s=6,a;
	function dd(n){this.n=n; this.h=[]; this.c=[]}
	dd.prototype.init=function(p,c){
		a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;
		for(i;i<l;i++){
			var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i];
			h.onmouseover=new Function(this.n+'.st('+i+',true)');
			h.onmouseout=new Function(this.n+'.st('+i+')');
		}
	}
	dd.prototype.st=function(x,f){
		var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0];
		clearInterval(c.t); c.style.overflow='hidden';
		if(f){
			p.className+=' '+a;
			if(!c.mh){c.style.display='block'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0}
			if(c.mh==c.offsetHeight){c.style.overflow='visible'}
			else{c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1)},t)}
		}else{p.className=p.className.replace(a,''); c.t=setInterval(function(){sl(c,-1)},t)}
	}
	function sl(c,f){
		var h=c.offsetHeight;
		if((h<=0&&f!=1)||(h>=c.mh&&f==1)){
			if(f==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'}
			clearInterval(c.t); return
		}
		var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh;
		c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')';
		c.style.height=h+(d*f)+'px'
	}
	return{dd:dd}
}();
/* END DROPDOWN SCRIPT.JS */

/* START MENU HIGHLIGHT.JS */

/**************************************************************************
 *                                                                        *
 *  JAVASCRIPT MENU HIGHLIGHTER v.1.5 (080929)                            *
 * --------------------------------------------                           *
 * ©2005 Media Division (www.MediaDivision.com)                           *
 *                                                                        *
 * Written by Marius Smarandoiu & Armand Niculescu                        *
 *                                                                        *
 * You are free to use, modify and distribute this file, but please keep  *
 * this header and credits                                                *
 *                                                                        *
 * Usage:                                                                 *
 * - the script will apply the .current class to the <a> and its parent   *
 *   <li> that is contained in the element with id="primarynav" and points*
 *   to the current URL                                                   *
 * - works in IE6, Firefox and Opera                                      *
 **************************************************************************/
function extractPageName(hrefString)
{
	var arr = hrefString.split('/');
	return  (arr.length<2) ? hrefString : arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase();               
}

function setActiveMenu(arr, crtPage)
{
	for (var i=0; i<arr.length; i++)
	{
		if(extractPageName(arr[i].href) == crtPage)
		{
			if (arr[i].parentNode.tagName != "DIV")
			{
				arr[i].className = "current";
				arr[i].parentNode.className = "current";
			}
		}
	}
}

function setPage()
{
	hrefString = document.location.href ? document.location.href : document.location;
	
	if (document.getElementById("menu_left_highlight")!=null)
		setActiveMenu(document.getElementById("menu_left_highlight").getElementsByTagName("a"), extractPageName(hrefString));
}

// FOLLOWING CODE IS USED FOR HIGHLIGHTING THE TOP LEVEL HORIZONTAL MENU - WRITTEN BY J. SALISBURY

function topmenu_on() {

if (document.images) {
  hrefString = document.location.href ? document.location.href : document.location;
  longnamearray = hrefString.split('/');
  pagename = (longnamearray.length<2) ? hrefString :  longnamearray[longnamearray.length-1].toLowerCase(); 
  left_2 = pagename.slice(0,2);
  
  switch(left_2) {
	case "in":
		// do nothing if index page
		break;
	case "fs":
		tmp = document["menu_fs"].src;
		tmp2 = tmp.slice(0,tmp.length-4);
		newimgname = tmp2 + "_on.gif";
		document["menu_fs"].src = newimgname;
		break;
	case "hs":
		tmp = document["menu_hs"].src;
		tmp2 = tmp.slice(0,tmp.length-4);
		newimgname = tmp2 + "_on.gif";
		document["menu_hs"].src = newimgname;
		break;
	case "ip":
		tmp = document["menu_ip"].src;
		tmp2 = tmp.slice(0,tmp.length-4);
		newimgname = tmp2 + "_on.gif";
		document["menu_ip"].src = newimgname;
		break;
	case "rr":
		tmp = document["menu_rr"].src;
		tmp2 = tmp.slice(0,tmp.length-4);
		newimgname = tmp2 + "_on.gif";
		document["menu_rr"].src = newimgname;
		break;	
	case "pr":
		tmp = document["menu_pr"].src;
		tmp2 = tmp.slice(0,tmp.length-4);
		newimgname = tmp2 + "_on.gif";
		document["menu_pr"].src = newimgname;
		break;		
	case "cr":
		tmp = document["menu_cr"].src;
		tmp2 = tmp.slice(0,tmp.length-4);
		newimgname = tmp2 + "_on.gif";
		document["menu_cr"].src = newimgname;
		break;	
	case "lo":
		tmp = document["menu_lo"].src;
		tmp2 = tmp.slice(0,tmp.length-4);
		newimgname = tmp2 + "_on.gif";
		document["menu_lo"].src = newimgname;
		break;		
	case "au":
		tmp = document["menu_au"].src;
		tmp2 = tmp.slice(0,tmp.length-4);
		newimgname = tmp2 + "_on.gif";
		document["menu_au"].src = newimgname;
		break;		
		
	default:
	
}
}
}

/* END MENU HIGHLIGHT.JS */

/* FUNCTION FOR LOCATIONS ACCORDION MENU */
$(document).ready(function(){
		$("dd").hide();
		$("dt img").click(function(){
			$(this).parent().next().slideToggle("slow");
			return false;
		});
	});
/*END LOCATIONS ACCORDION MENU*/

/* GOOGLE ADWORDS CONVERSION TRACKING */
/* http://blog.vkistudios.com/index.cfm/2008/12/16/JavaScript-onClick-Google-AdWords-Conversion-Tracking */

var adwords_conversion = function(){
var google_conversion_id = "988004585";
var google_conversion_label = "9704CMf1uAIQ6YGP1wM";
	
var image = new Image(1,1);
/*image.src = "http://www.googleadservices.com/pagead/conversion/1234567890/?value=1&label=Purchase&script=0";*/
image.src ="http://www.googleadservices.com/pagead/conversion/" + google_conversion_id + 
	"/?label=" +  google_conversion_label + "&amp;guid=ON&amp;script=0";

return;
}

/* END GOOGLE ADWORDS CONVERSION TRACKING */
