/******************/
/*
 * Main JavaScript File
 * Copyright 2011 
 * 
 */

function showTeam(team) {
	var t = team;
	var imagepath = "./images/team/";

	t = t.toLowerCase();
	if (t && document.getElementById) {
		if (t == "tom") {
			this.document.getElementById("ipath").src = imagepath + "tom_s.jpg";
		} else {
			this.document.getElementById("ipath").src = imagepath + t + ".jpg";
		}
		document.getElementById("teamlabel").innerHTML = "Dies ist " + team;
	}
}

function getToggleMap(target) {
	if( target === "TEAM" ) {
		document.getElementById("map").style.display = "none";
	} else if( target === "MAP" ) {
		document.getElementById("map").style.display = "block";
	}
}

function getMenuTarget(target) {
	if( target === "HOME" ) {
		document.getElementById("home").style.display     = "block";
		document.getElementById("about-us").style.display = "none";
		document.getElementById("news").style.display     = "none";
		document.getElementById("map").style.display      = "none";
	} else if( target === "ABOUTUS" ) {
		document.getElementById("home").style.display     = "none";
		document.getElementById("about-us").style.display = "block";
		document.getElementById("news").style.display     = "none";
		document.getElementById("map").style.display      = "none";
	} else if( target === "NEWS" ) {
		document.getElementById("home").style.display     = "none";
		document.getElementById("about-us").style.display = "none";
		document.getElementById("news").style.display     = "block";
		document.getElementById("map").style.display      = "none";
	}
 }
 
 
function getInnerWidth () {
	if (window.innerWidth) {
		return window.innerWidth;
	} else if (document.body && document.body.offsetWidth) {
		return document.body.offsetWidth;
	} else {
		return 0;
	}
}

function getInnerHeight () {
	if (window.innerHeight) {
		return window.innerHeight;
	} else if (document.body && document.body.offsetHeight) {
		return document.body.offsetHeight;
	} else {
		return 0;
	}
}

function newResizing () {
	if (Weite != getInnerWidth() || Hoehe != getInnerHeight()) {
		location.href = location.href;
	}
}

function setInnerHeight( id, paramHeight, correction ) {
	paramHeight    = paramHeight.substring(0, paramHeight.indexOf("px"));
	var pageHeight = window.innerHeight - paramHeight - correction;

	document.getElementById(id).style.height = pageHeight + "px";
}

function setInnerWidth( id, paramWidth, correction ) {
	paramWidth    = paramWidth.substring(0, paramWidth.indexOf("px"));
	var pageWidth = window.innerWidth - paramWidth - correction;

	document.getElementById(id).style.width = pageWidth + "px";
}

$(function(){

	// Accordion
	$("#accordion").accordion({ header: "h3" });

	// Tabs
	$('#tabs').tabs();
	$('#tabsa').tabs();
	$('#tabsn').tabs();


	// Dialog			
	$('#dialog').dialog({
		autoOpen: false,
		width: 600,
		buttons: {
			"Ok": function() { 
				$(this).dialog("close"); 
			}, 
			"Cancel": function() { 
				$(this).dialog("close"); 
			} 
		}
	});
	
	// Dialog Link
	$('#dialog_link').click(function(){
		$('#dialog').dialog('open');
		return false;
	});

	// Datepicker
	$('#datepicker').datepicker({
		inline: true
	});
	
	// Slider
	$('#slider').slider({
		range: true,
		values: [17, 67]
	});
	
	// Progressbar
	$("#progressbar").progressbar({
		value: 20 
	});
	
	//hover states on the static widgets
	$('#dialog_link, ul#icons li').hover(
		function() { $(this).addClass('ui-state-hover'); }, 
		function() { $(this).removeClass('ui-state-hover'); }
	);
	
});

	
		

