/*------------------------------------------------------------------ 
# [Javascript - Amadeus-fire.de] 
#  
# Project:    Amadeus FiRe 
# Version:    1.6 
# Last change:    19/05/2010 [ Thorsten Mertens ] 
# -------------------------------------------------------------------*/  


	var debugErrors =  new Array();

// onload and onunload elements
	// add commands to this arrays later
	var afOnloads = new Array(); // this commands will be started by <body onload>
	var afOnunloads = new Array(); // this commands will be started by <body onunload>
	
	
	function af_onload() {
		// start all commands in this array	
		if(afOnloads.length) {
			for(var i=0;i<afOnloads.length;i++) {
				switch(afOnloads[i]) {
					case 'googlemaps':	
						gm_init();
					break;
					case 'reset_gm_description_repository':
						reset_gm_description_repository();
					break;
				}
			}
		}
	}
	
	function af_unload() {
		// start all commands in this array	
		if(afOnunloads.length) {
			for(var i=0;i<afOnunloads.length;i++) {
				switch(afOnunloads[i]) {
					case 'googlemaps':	
						GUnload();
					break;
				}
			}
		}
	}	


function findT3Language() {
	// looking for used Language (Typo3 like)
	if( ( self.location.href.toLowerCase().indexOf('/en/') !== -1 ) || ( self.location.href.toLowerCase().substr( self.location.href.length - 3) == '/en' )) return 'en'; else return 'de';	
}

function findBaseURL() {
	var a_tmp = self.location.href.indexOf('/',8);
	if( a_tmp != -1 ) return self.location.href.substr( 0 , a_tmp ); else return self.location.href;
}

function findIntName( thisTown ) {
	if( Typo3Language == 'en' ) thisTown = in_english( thisTown );
	return thisTown;
}

var Typo3Language = findT3Language();						// get the used language
var baseURL = findBaseURL();								// baseURL of this website
var Link2Locations = 'amadeus-fire-ag/niederlassungen/';	// path to locations

if(baseURL == 'http://www.interim-projektmanagement.de') 	Link2Locations = 'kontakt/standorte/';	// path to locations


// Jobtool elements
	// mouse over - listed jobs
	actMouseOver = false;
	//idList = "12345,23467";
	//idArray = idList.split(",");
	mover_delay = 700;				// wait x-miliseconds to activate teasertext
	
	function chkID(id) {
		myPopUp = setTimeout('doShow(\''+id+'\')',mover_delay);
		actMouseOver = id;
	}
	
	function doShow(id) {
		if(actMouseOver == id ) {
			doHideAll();	
			document.getElementById(id).className = "doShow";
		}
	}
	
	function resetMouseOver() {
		actMouseOver = false;	
	}
	
	function doHideAll() {
		var tmp = document.getElementsByName('hiddenDescription');
		for(i=0;i<tmp.length; i++) tmp[i].className = "doHide";
	}
	
	// MultiBox
	
	MultiBox = new Array();
	
	function resetRadioBox(obj){
		var ischecked = obj.checked;
		var tmp = obj.form[obj.name];
		
		if(ischecked) {
			for(var i=0;i<tmp.length;i++) tmp[i].checked = false;
			obj.checked = true;
			document.getElementById('mb2').innerHTML = document.getElementById('mb2'+'-'+obj.value).innerHTML;
		} else {
			document.getElementById('mb2').innerHTML = '';
		}
	}
	
	function changeBasename(fullname, toBasename) {
		if(fullname.indexOf('/') != -1) {
			var tmp = fullname.split('/');
			tmp[tmp.length - 1] = toBasename;
			r = tmp.join('/');			
		} else r = toBasename;
		return r;
	}
	
	function changeIcon(obj) { 
		var changeThis = document.getElementById(obj.name.substr(1));
		if(changeThis.className == 'hide') {
			obj.src = changeBasename(obj.src, 'less.gif'); 
			changeThis.className = 'show';
		} else {
			obj.src = changeBasename(obj.src, 'more.gif');
			changeThis.className = 'hide';
		}
	}


	function opencloseMultiBox(mbox) {
		if(document.getElementById(mbox).className == 'hide') document.getElementById(mbox).className = 'show'; else document.getElementById(mbox).className = 'hide';
	}


// *****************************************************	
	
function activate_mbox(thisbox){
	// nothing to do 
	show_selected_elements();
}

function show_selected_elements() {
	var allchecked = $("input[id^= 1__]:checked" ).length + $("input[id^= 2__]:checked" ).length + $("input[id^= 3__]:checked" ).length + $("input[id^= 4__]:checked" ).length;
	if( allchecked ) { 	
		if( allchecked == 1 ) document.getElementById('mb1').innerHTML = 'Ein Bereich ausgewählt'; else document.getElementById('mb1').innerHTML = allchecked + ' Bereiche ausgewählt'; 			
		
	} else document.getElementById('mb1').innerHTML = 'Bitte auswählen';
}

function resetMultiBox(obj) {
	var allsubs = $("input[id^= " + obj.id.substr(0,1) + "__]" );
	var subschecked = $("input[id^= " + obj.id.substr(0,1) + "__]:checked" );
	if( obj.id.length > 1 ) {
		// a workfield was clicked	
		if( obj.checked ) {
			if ( allsubs.length == subschecked.length )	$('#'+obj.id.substr(0,1)).attr('checked', true);
		} else {
			$('#'+obj.id.substr(0,1)).attr('checked', false);
		}
		
	} else {
		// a division was clicked	
		if ( obj.checked ) {
			allsubs.attr('checked', true);
		} else {
			allsubs.attr('checked', false);
		}
	}
	show_selected_elements();
}
	
// *****************************************************

	// /MultiBox
	
// jumpback to joblist
function jumpback2joblist() {
	if( history.length > 1 ) history.back(); else { 
		self.location.href = baseURL + "/de/jobs-und-karriere/stellenangebote/";	
	}
}
	
function jt_search_division( thisval ) {
	var obj = document.forms['jobtool2']['' + document.getElementById('hiddenworkingfield').name];
	obj.value = thisval;
	document.forms['jobtool2'].submit();
}

function render_jobchart( ALL, ACC, OFF, BAN, IT) {
	
	jchartmaxdimension = 250;
	jchart = new Array();
	
	// dynamic dataloading here
	jchart[1] = ACC;
	jchart[2] = OFF;
	jchart[3] = BAN;
	jchart[4] = IT;
	
	jchart[0] = ALL;
	jchartmax = 0;
	for( var i=1; i<5;i++ ) jchartmax = Math.max(jchartmax, jchart[i]);
	
	for( var i=1; i<5;i++ ) {
		document.getElementById('val_'+i).innerHTML = jchart[i];
		document.getElementById('chart_'+i).style.width = Math.ceil( jchartmaxdimension * ( jchart[i] / jchartmax ) ) + 'px' ;
	}
	document.getElementById('val_sum').innerHTML = jchart[0] + ' Jobs';
}


// jobtool *-specials

function submit_jtsearch(obj) {
		// check jobsearch
		xtmp = obj['tx_afjobsearch_pi1[q]']	;
		if(xtmp.value == '') xtmp.value = '*'; else {
			if(xtmp.value != '*') xtmp.value = xtmp.value.replace(/\*/g, "");
		}
}

function submit_me(obj) {
		// check quickjobsearch
		xtmp = obj['tx_afjobsearch_pi1[q]']	;
		if(xtmp.value == '' || xtmp.value == xtmp.defaultValue) xtmp.value = '*';
}

	
/************************  google maps settings and scripts  ************************************
** 
**
*/	

// Locations german and english 
function intLoc(nl_name, engl_name) {
	this.nl_name = nl_name;	
	this.engl_name = engl_name;
}

var internationalLocations = new Array();
	internationalLocations.push( new intLoc( 'Frankfurt' , 'Frankfurt' ));
	internationalLocations.push( new intLoc( 'Düsseldorf' , 'Düsseldorf' ));
	internationalLocations.push( new intLoc( 'Hamburg' , 'Hamburg' ));
	internationalLocations.push( new intLoc( 'Berlin' , 'Berlin' ));
	internationalLocations.push( new intLoc( 'Köln' , 'Cologne' ));
	internationalLocations.push( new intLoc( 'Stuttgart' , 'Stuttgart' ));
	internationalLocations.push( new intLoc( 'Stuttgart Friedrichstraße' , 'Stuttgart Friedrichstraße' ));
	internationalLocations.push( new intLoc( 'Essen' , 'Essen' ));
	internationalLocations.push( new intLoc( 'Mannheim' , 'Mannheim' ));
	internationalLocations.push( new intLoc( 'Hannover' , 'Hanover' ));
	internationalLocations.push( new intLoc( 'Mainz' , 'Mayence' ));
	internationalLocations.push( new intLoc( 'Bonn' , 'Bonn' ));
	internationalLocations.push( new intLoc( 'Darmstadt' , 'Darmstadt' ));
	internationalLocations.push( new intLoc( 'Mönchengladbach' , 'Munchengladbach' ));
	internationalLocations.push( new intLoc( 'Bielefeld' , 'Bielefeld' ));
	internationalLocations.push( new intLoc( 'Karlsruhe' , 'Karlsruhe' ));
	internationalLocations.push( new intLoc( 'Aachen' , 'Aachen' ));
	internationalLocations.push( new intLoc( 'Freiburg' , 'Freiburg' ));
	//internationalLocations.push( new intLoc( 'Leipzig' , 'Leipzig' ));
	internationalLocations.push( new intLoc( 'Münster' , 'Münster' ));
	internationalLocations.push( new intLoc( 'München' , 'Munich' ));

function in_english( the_town ) {
	var r = the_town;
	for(var i=0; i<internationalLocations.length;i++) if( internationalLocations[i].nl_name == the_town )	r = internationalLocations[i].engl_name;
	return r;
}


var path2icons = baseURL + '/fileadmin/Amadeus_FiRe/googlemaps/';
var af_markers = new Array();
var af_icons = new Array();
// Niederlassungen
var nls = new Array();
	// Format : NL-Name, Längenkoordinate, Breitenkoordinate, Adresse (Straße, PLZ ), page_id in Typo3 AF , IPM
	nls.push( new af_nl_object( 'Frankfurt', 50.09440303417228, 8.689960241317749, 'Darmstädter Landstr. 116, 60598 ',113,280));
	nls.push( new af_nl_object( 'Düsseldorf', 51.2232008516311, 6.774187088012695, 'Carlsplatz 14-15, 40213 ',115,281 ));
	nls.push( new af_nl_object( 'Hamburg', 53.54905393079073, 10.001077651977539, 'Burchardstraße 17, 20095 ',117,283));
	nls.push( new af_nl_object( 'Berlin', 52.50880341712083, 13.323755264282226, 'Goethestraße 85, 10623 ',116,282 ));
	nls.push( new af_nl_object( 'Köln', 50.94858614505608, 6.908318996429443, 'Lichtstraße 43c, 50825 ',118,284));
	nls.push( new af_nl_object( 'München', 48.157526307655075, 11.544013023376464, 'Leonrodstraße 54,80636 ',106,279 ));
	nls.push( new af_nl_object( 'Stuttgart', 48.783214, 9.176737, 'Kronenstraße 25, 70174 ',363,364 ));
	nls.push( new af_nl_object( 'Stuttgart Friedrichstraße', 48.78347518820929, 9.178497791290283, 'Friedrichstraße 5, 70174 ',119,285 )); 
	nls.push( new af_nl_object( 'Essen', 51.436487, 7.046678, 'Ruhrallee 175, 45136 ',120,286));
	nls.push( new af_nl_object( 'Mannheim', 49.47492861742011, 8.49517822265625, 'Gottlieb-Daimler-Straße 12, 68165 ',121,287 ));
	nls.push( new af_nl_object( 'Hannover', 52.37393550452476, 9.741268157958984, 'Rathenaustraße 12, 30159 ',122,288));
	nls.push( new af_nl_object( 'Mainz', 49.994635, 8.276503, 'Holzhofstraße 7, 55116 ',123,289 ));
	nls.push( new af_nl_object( 'Bonn', 50.75086434640032, 7.090408802032471, 'Graurheindorfer Straße 149a, 53117 ',124,290 ));
	nls.push( new af_nl_object( 'Darmstadt', 49.870825438292606, 8.647785186767578, 'Adelungstraße 23, 64283 ',125,291 ));
	nls.push( new af_nl_object( 'Mönchengladbach', 51.20378457539682, 6.441003084182739, 'Hohenzollernstraße 179, 41063 ',126,292 ));
	nls.push( new af_nl_object( 'Bielefeld', 52.01408924864552, 8.533737659454345, 'Detmolder Straße 18, 33604 ',127,293 ));
	nls.push( new af_nl_object( 'Karlsruhe', 49.007754842294595, 8.395400047302246, 'Bürgerstraße 16, 76133 ',128,294 ));
	nls.push( new af_nl_object( 'Aachen', 50.767455512262536, 6.086640357971191, 'Friedlandstraße 18, 52064 ',129,295 ));
	nls.push( new af_nl_object( 'Freiburg', 47.995012316323454, 7.8487443923950195, 'Universitätsstraße 10, 79098 ',130,296 ));
	//nls.push( new af_nl_object( 'Leipzig', 51.34285087140019, 12.380679845809936, 'Richard-Wagner-Straße 1, 04109 ',131,297 ));
	nls.push( new af_nl_object( 'Münster', 51.98370397846277, 7.63623833656311, 'Albrecht-Thaer-Straße 2, 48147 ',132,298 ));
	
function af_nl_object(nl_name,l_coord,w_coord,address,af_id,ipm_id) {
	var nl_name_int 	= findIntName( nl_name );
	this.nl_name 		= nl_name_int;
	this.l_coord 		= l_coord;
	this.w_coord 		= w_coord;
	this.address 		= address + nl_name_int ;
	this.af_id 			= af_id;
	this.ipm_id			= ipm_id;
	// site_link
	site_link = baseURL + '/' + Typo3Language + '/' + Link2Locations + ueaeoe_encode( nl_name ).toLowerCase(); 
	var tmp = this.address.split(',');
	this.html_address 	= '<strong><a href=\"'+ site_link +'\">Amadeus FiRe ' + html_encode( nl_name_int ) + '</a></strong><br>' + html_encode(tmp[0]) + '<br>' + html_encode(tmp[1]) ;
	this.site_link 		= site_link;
	this.point_array	= new Array( l_coord, w_coord );
}

function ueaeoe_encode( thestring ) {
var r = thestring;
	r = r.replace(/ä/g, 'ae');
	r = r.replace(/Ä/g, 'Ae');
	r = r.replace(/ö/g, 'oe');
	r = r.replace(/Ö/g, 'Oe');	
	r = r.replace(/ü/g, 'ue');
	r = r.replace(/Ü/g, 'Ue');
	r = r.replace(/ß/g, 'ss');
	return r;	
	
}
	
function html_encode(thestring){
	var r = thestring;
	r = r.replace(/ä/g, '&auml;');
	r = r.replace(/Ä/g, '&Auml;');
	r = r.replace(/ö/g, '&ouml;');
	r = r.replace(/ü/g, '&uuml;');
	r = r.replace(/Ü/g, '&Uuml;');
	r = r.replace(/ß/g, '&szlig;');
	return r;
}

function fetch_city(city) {
	var r = false;
	for(var i =0;i<nls.length;i++)	if(nls[i].nl_name == city) r = nls[i];
	return r;
}

function set_af_marker( city, icon_style) {
	var tmp = fetch_city(city);
	if(tmp !== false) {
		af_markers[city] =  new GMarker( tmp.point, { icon:icon_style });
		GEvent.addListener(af_markers[city], "click", function() {af_markers[city].openInfoWindowHtml(tmp.html_address);});
		map.addOverlay(af_markers[city]);
	}
}

function getFlag(flagstyle){
	// set google maps flags 
	
	var tmp_icon = new GIcon();
	switch(flagstyle) {
		case 'flag':
			tmp_icon.image = path2icons + "AF_marker.png";
			tmp_icon.shadow = path2icons + "AF_marker_schatten.png";
			tmp_icon.iconSize = new GSize(67, 53);
			tmp_icon.shadowSize = new GSize(67, 53);	
			tmp_icon.iconAnchor = new GPoint(11, 51);
			tmp_icon.infoWindowAnchor = new GPoint(25, 11);	
		
		break;
			case 'needle':
			tmp_icon.image = path2icons + "af_nadel.png";
			tmp_icon.shadow = path2icons + "af_nadel_shatten.png";
			tmp_icon.iconSize = new GSize(37, 40);
			tmp_icon.shadowSize = new GSize(37, 40);	
			tmp_icon.iconAnchor = new GPoint(0, 40);
			tmp_icon.infoWindowAnchor = new GPoint(25, 11);		
		break;
	}
	return tmp_icon;
}

function setDirections(fromAddress, toAddress, locale) {
  gdir.load("from: " + fromAddress + " to: " + toAddress,
			{ "locale": locale });
}

function handleErrors(){
   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	 alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	 alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
   
   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	 alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);
	 
   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	 alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	 alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	
   else alert("An unknown error occurred.");
   
}

function onGDirectionsLoad(){ 
  // Use this function to access information about the latest load()
  // results.

  // e.g.
  // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
  // and yada yada yada...
}


// af-scripts

function reset_gm_description_repository() {
	// reset gm_description_repository
	document.getElementById('gm_description_repository').className = 'hide';
}

function whatsSelected(sub_obj){
	var r= false;
	for(var i=0;i<sub_obj.length;i++) if(sub_obj[i].selected === true)	r = sub_obj[i].value;
	return r;
}

function ck_and_go_google(obj){
	if(obj.gm_fromcity.value) { 
		document.getElementById('gm_description').innerHTML = '';
		setDirections(obj.gm_fromcity.value, toAddress, locale);
	}
}

function ck_and_show(obj){
	selected_elements = whatsSelected(obj);
	if(selected_elements) document.getElementById('gm_description').innerHTML = document.getElementById(selected_elements).innerHTML;	
}


function loadLocation(thisLocation) {
	self.location.href = baseURL + '/' + Typo3Language + '/' + Link2Locations + thisLocation;
}

/************************ google Analytics ***************
*
*******/


// Google Analytics Keys
switch ( baseURL ) {
	case 'http://www.amadeus-fire.de': 
		googleKey = 'UA-4522031-1'; 
		googleMapsKey = 'ABQIAAAAu_7VMUVtL5qHrTWYHORzpBSVZX4wTTwfqa8Scpr7-6Vgb_PnZBSxugDlqYROO9Ffg4VnChRe96NgfQ';
		break;
	case 'http://www.interim-projektmanagement.de': 
		googleMapsKey = 'ABQIAAAAGlp07yuf9D2PPehlic_VCBRxP7zQTn9601XgmN5DzNOVD929UxQ3Nkw_r3nXGtwIYYRH8i8KlMKbjQ';
		googleKey = 'UA-4522031-2'; 
		break;
	case 'http://ipm.projects.wiredobjects.eu': 
		googleMapsKey = 'ABQIAAAAGlp07yuf9D2PPehlic_VCBRQCTozwkaGP84ZQ9T2FDME8LtrqRRg7LpajyTlZRRpCGNXng2Ask6bxg';
		googleKey = false;
		break;
	case 'http://af.projects.wiredobjects.eu':
		googleMapsKey = 'ABQIAAAAzYnAaZUvy7LhmvIZ10IIwRSYe3cjAvHmuXkZGkxGUiL3KyzxvhTbPJvW5dxse5R5aVL7xKLgsz1azg';
		googleKey = false;
		break;
	default: googleKey = false; googleMapsKey = false; break; 
}

function render_googleAnalytics() {
	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
}

function init_googleAnalytics() {
	debugErrors.push('starting function init_googleAnalytics()');
	if( googleKey ) {
		try {
		var pageTracker = _gat._getTracker( googleKey );
		pageTracker._trackPageview();
		} catch(err) { debugErrors.push('loading pageTracker failed!'); }
	} else debugErrors.push('No google Key found');
}

function load_googleAnalytics() {
	
		var _gaq = _gaq || [];
		_gaq.push(['_setAccount', googleKey ]);
		_gaq.push(['_trackPageview']);
		
		(function() {
		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
		})();
	
	
	//render_googleAnalytics(); 	// renders the <script .. tag  to load google Analytics
	//init_googleAnalytics();		// initialize google Analytics using the correct google key

}
		 loadAndRenderGmaps()
function loadAndRenderGmaps() {
	if(googleMapsKey) {
		document.write(unescape("%3Cscript src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=" + googleMapsKey + "' type='text/javascript'%3E%3C/script%3E"));
	} else debugErrors.push('No googleMaps Key found');
}

function reloadCaptcha() {
	obj = document.getElementById('myCaptcha');
	tmpImage = new Image();
	tmpImage.src = ''+obj.src + '?donothing='+ Math.random() * 100;
	obj.src = tmpImage.src;
}

// javascript/css resources ******************************************************************************************************
// die Dateianfragen können verschachtelt werden, z.B.: läd 'fancybox' alle in der zugehörigen Liste angegebenen Unterobjekte 
// es wird automatisch nach Dateiendungen .js und .css unterschieden, andere werden ignoriert
loadfromResources = {
	'happypack':           ['validate','swobject','fancybox','quickfinder'],
	'validate':            'typo3conf/ext/template_af/res/templates/scripts/jquery.validate.min.js',
	'popupBannerElements': 'typo3conf/ext/template_af/res/templates/scripts/popupBannerElement.js',
	'swobject':            'typo3conf/ext/template_af/res/templates/scripts/jquery.swfobject.1-0-9.min.js',
	'fancybox':            ['fancybox_js','fancybox_css', 'fancybox_easing', 'fancybox_mouse'], // has subobjects
		'fancybox_css':    'typo3conf/ext/template_af/res/templates/scripts/fancybox/jquery.fancybox-1.3.1.css',
		'fancybox_js':     'typo3conf/ext/template_af/res/templates/scripts/fancybox/jquery.fancybox-1.3.1.pack.js',
		'fancybox_easing': 'typo3conf/ext/template_af/res/templates/scripts/fancybox/jquery.easing-1.3.pack.js',
		'fancybox_mouse':  'typo3conf/ext/template_af/res/templates/scripts/fancybox/jquery.mousewheel-3.0.2.pack.js',
	'quickfinder':         'typo3conf/ext/template_af/res/templates/scripts/af_quickfinder.js',
	'autocomplete':        ['autocomplete_js', 'autocomplete_css'],
		'autocomplete_js': 'typo3conf/ext/template_af/res/templates/scripts/jquery.autocomplete.js',
		'autocomplete_css':'typo3conf/ext/template_af/res/templates/css/jquery.autocomplete.css',
	'easyslides' : [ 'easyslides_js', 'easyslides_css' ],
		'easyslides_js' : 	'typo3conf/ext/template_af/res/templates/scripts/jquery.easyslides.source.v1.1.js',
		'easyslides_css' : 	'typo3conf/ext/template_af/res/templates/css/easySlides.default.min.css',
	'ui': [ 'core', 'widgets', 'accordion' ],
		'core':				'typo3conf/ext/template_af/res/templates/scripts/jquery-ui-1.8.7.custom/development-bundle/ui/jquery.ui.core.js',
		'widgets':			'typo3conf/ext/template_af/res/templates/scripts/jquery-ui-1.8.7.custom/development-bundle/ui/jquery.ui.widget.js',
		'accordion':		'typo3conf/ext/template_af/res/templates/scripts/jquery-ui-1.8.7.custom/development-bundle/ui/jquery.ui.accordion.js',
		'uicss':			'typo3conf/ext/template_af/res/templates/scripts/jquery-ui-1.8.7.custom/development-bundle/themes/base/jquery.ui.theme.css'
}


function docWrite( thisText ) {
	document.write( thisText );	
}

function loadJS_CSS( file2load ) {
	// easyload css and js elements 
	var requestedObj = loadfromResources[ file2load ];
	if ( $.isArray( requestedObj ) ) {
		for(var i=0; i<requestedObj.length;i++) loadJS_CSS( requestedObj[i] );
	} else {
		var eles = requestedObj.split('.');
		if (eles.length)  {
			var suffix = eles[ eles.length -1 ];
			switch( suffix ) {
				case 'js': 	
						//$('head').append('<script type="text/javascript" src="' +  requestedObj  + '"><\/script>');
						docWrite('<script type="text/javascript" src="' +  requestedObj  + '"><\/script>\n');
				break;
				case 'css':
						$('head').append('<link rel="stylesheet" href="' +  requestedObj  + '" type="text/css" media="screen" />\n');
				break;
			}
		}
	}
}

function focusOn( thisID ) {
	$('input[name=event_id]').find('[value=' + thisID + ']').attr('checked','1');
}
