function addDOMLoadEvent(f){if(!window.__ADLE){var n=function(){if(arguments.callee.d)return;arguments.callee.d=true;if(window.__ADLET){clearInterval(window.__ADLET);window.__ADLET=null}for(var i=0;i<window.__ADLE.length;i++){window.__ADLE[i]()}window.__ADLE=null};if(document.addEventListener)document.addEventListener("DOMContentLoaded",n,false);/*@cc_on @*//*@if (@_win32)document.write("<scr"+"ipt id=__ie_onload defer src=//0><\/scr"+"ipt>");var s=document.getElementById("__ie_onload");s.onreadystatechange=function(){if(this.readyState=="complete")n()};/*@end @*/if(/WebKit/i.test(navigator.userAgent)){window.__ADLET=setInterval(function(){if(/loaded|complete/.test(document.readyState)){n()}},10)}window.onload=n;window.__ADLE=[]}window.__ADLE.push(f)}

try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}


function sifr_init () {
if(typeof sIFR == "function"){

// This is the preferred "named argument" syntax
	//sIFR.replaceElement(named({sSelector:"body h1", sFlashSrc:"vandenkeere.swf", sColor:"#000000", sLinkColor:"#000000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:20, nPaddingBottom:20, sFlashVars:"textalign=center&offsetTop=6"}));

// This is the older, ordered syntax
	//sIFR.replaceElement("h5#pullquote", "vandenkeere.swf", "#000000", "#000000", "#FFFFFF", "#FFFFFF", 0, 0, 0, 0);
	//sIFR.replaceElement("h2", "tradegothic.swf", "#000000", null, null, null, 0, 0, 0, 0);
	//sIFR.replaceElement("h4.subhead", "tradegothic.swf", "#660000", null, null, null, 0, 0, 0, 0);
	//sIFR.replaceElement("h3.sidebox","tradegothic.swf","#000000", "#000000", "#DCDCDC", "#DCDCDC", 0, 0, 0, 0, null);
	
	sIFR.replaceElement(named({sSelector:"#sidebar h2", sFlashSrc:"flash/myriad.swf", sColor:"#8a8774", sWmode:"transparent"}));
	sIFR.replaceElement(named({sSelector:"#intro h2", sFlashSrc:"flash/myriad.swf", sColor:"#e06c05", sWmode:"transparent"}));
	sIFR.replaceElement(named({sSelector:"#page-info h2", sFlashSrc:"flash/myriad.swf", sColor:"#414141", sWmode:"transparent"}));
	sIFR.replaceElement(named({sSelector:"h2 span", sFlashSrc:"flash/myriad.swf", sColor:"#2c2424", sWmode:"transparent",nPaddingBottom:5,sFlashVars:"offsetLeft=10&offsetTop=-5"}));
	sIFR.replaceElement(named({sSelector:"#inner-page h3 span", sFlashSrc:"flash/myriad.swf", sColor:"#414141", sWmode:"transparent"}));
	
}

}

function contact_radio () {
	var contact_mode= document.getElementById('contact-mode');
	if(!contact_mode) {return false;}
	var contact_radio_input = contact_mode.getElementsByTagName('input');
	var contact_radio_label = contact_mode.getElementsByTagName('label');
	for(i=0; i<contact_radio_input.length; i++) {
		if(contact_radio_input[i].parentNode.getAttribute('id')=='checked') {
			contact_radio_input[i].checked = true;
		}
		else {
			contact_radio_input[i].checked = '';	
		}
	}
	for(i=0; i<contact_radio_label.length; i++) {
		contact_radio_label[i].onclick = function () {
			var checked = document.getElementById('checked');
			if(checked) {checked.removeAttribute('id')}
			for(x=0; x<contact_radio_input.length; x++) {
				if(contact_radio_input[x].checked) {
				contact_radio_input[x].checked = '';
				}
			}
			this.setAttribute('id','checked');
			this.getElementsByTagName('input')[0].checked = true;
			
		}
	}
}

function contact_options () {
	var select_subject = document.getElementById('select-subject');
	if(!select_subject) {return false;}
	var select_form = select_subject.getElementsByTagName('select')[0];
	var select_form_options = select_form.getElementsByTagName('option');
	var select_ul = document.createElement('div');
	select_ul.setAttribute('id','select-ul');
	var select_ul_div = document.createElement('div');
	var select_ul_ul = document.createElement('ul');
	select_ul_ul.className = 'reset';
	var select_ul_option = [];
	select_ul_option[0] = document.createElement('li');
	select_ul_option[0].innerHTML = select_form_options[0].innerHTML;
	select_ul_ul.appendChild(select_ul_option[0]);
	select_ul_option[0].setAttribute('id','first');
	for(i=1; i<=select_form_options.length; i++) {
		select_ul_option[i] = document.createElement('li');
		select_ul_option[i].innerHTML = select_form_options[i-1].innerHTML;
		select_ul_option[i].storage = select_form_options[i-1].value;
		select_ul_ul.appendChild(select_ul_option[i]);
	}
	
	select_ul_div.appendChild(select_ul_ul);
	select_ul.appendChild(select_ul_div);
	select_subject.appendChild(select_ul);
	var t ;
	function select_off () {
		select_ul.className = '';
	}
	
	for(i=1; i<select_ul_option.length; i++) {
		select_ul_option[i].onclick = function () {
		  select_form.value = 	this.storage;
		  select_ul_option[0].innerHTML = this.innerHTML;
		  window.setTimeout(select_off,200);
		}
		select_ul_option[i].onmouseover = function () {
			this.style.fontWeight = 'bold';
			window.clearTimeout(t);
		}
		select_ul_option[i].onmouseout = function () {
			this.style.fontWeight = 'normal';
		}
	}
	
	select_ul.onclick = function () {
		this.className = 'on';
	}
	select_ul.onmouseout = function () {
		t = window.setTimeout(select_off,300);
	}
	select_ul.onmouseover = function () {
		window.clearTimeout(t);
	}
	
}

function gallery () {
	var photo = document.getElementById('photo');
	if(!photo) {return false}
	var thumbs = document.getElementById('thumbs');
	thumbs = thumbs.getElementsByTagName('a');
	for(i=0; i<thumbs.length; i++) {
		thumbs[i].onclick = function () {
			photo.setAttribute('src',this.getAttribute('href'));
			return false;
		}
	}
}

addDOMLoadEvent(sifr_init);
addDOMLoadEvent(contact_radio);
addDOMLoadEvent(contact_options);
addDOMLoadEvent(gallery);