/*
 * Javascript basic
 * Basic javascript for Shahrokhi - elephant seven bielefeld, christian wemhoff - 17.10.07
 * Last update: christian wemhoff - 25.04.08
 */

/* Browsererkennung */
if ($.browser.msie) { if($.browser.version == 6) {var isIe6 = true} else {isIe6 = false} }

$(document).ready(function() {
	
		// hide / show this class
		$(".jHide").hide()
		$(".jShow").hide()
		
		// init Mousover topnavi
		$('#topnavi a:not(.act)').hover(
			function() {
				navImg = $('img', this)
				navImgSrc = navImg.attr('src')
				navImgHiSrc = navImg.attr('longdesc')
				navImg.attr('src', navImgHiSrc)
				navImg.attr('longdesc', navImgSrc)
			},
			function() {
				navImg.attr('src', navImgSrc)
				navImg.attr('longdesc', navImgHiSrc)
			});

	// init Quickclicks
	$(".dropdownlist").change( function () {
		var thisOption = this.options[this.selectedIndex]
		var thisClass = $(thisOption).attr('class')
		if (thisOption.title != '' && (thisClass != '_blank')) {
			window.location.href = thisOption.title
		} else if (thisClass == '_blank') {
			window.open(thisOption.title)
		}
	});
	
	// init searchfield
	$("#suche").focus( function () { 
		if (this.value != "") {this.value = ""}
	});

	// init imageSwitch 
	$(".swImage").hide()
	$(".zoomImage").hide()
	$("#swImage1").show()
	$("#zoomImage1").show()
	
	$(".moduleImgSwitcher li:not(.zoom)").click(function () {
		 $(".moduleImgSwitcher li").removeClass('act')
    	 $(this).addClass('act')
		 var illuNumber = $(this).attr('accesskey')
		 $(".swImage").hide()
		 $("#swImage"+illuNumber).show()
		 return false
    });
	
	$(".imageSwitch.zoom li:not(.zoom)").click(function () {
		 $(".imageSwitch.zoom li").removeClass('act')
    	 $(this).addClass('act')
		 var illuNumber = $(this).attr('accesskey')
		 $(".zoomImage").hide()
		 $("#zoomImage"+illuNumber).show()
		 return false
    });
	
	$('ul.moduleTabs a').click(function () {
		return false
	})

	if (checkFlash() == true || flash == true) {
		$('.hideIfFlash').hide()
	}
})

// function checkFlash
function checkFlash() {
	if (!$.browser.msie) {
		flash = false
		if ((navigator.mimeTypes) && (navigator.mimeTypes.length > 0))
		for (a = 0; a < navigator.mimeTypes.length; a++)
		if (navigator.mimeTypes[a].type.indexOf("application/x-shockwave-flash")>= 0) flash = true
		return true
	} else {
		return false
	}
}

// function setFlash
function setFlash(swfSrc, swfWidth, swfHeight, swfVersion) {
	if (!swfWidth) { 
		if (isIe6) { swfWidth = '710' }
		else { swfWidth = '710' }
		
		
	}
	if (!swfHeight) swfHeight = '253'
	if (!swfVersion) swfVersion = '8'
	
	/* IE6 Bugfix */
	if (isIe6 && swfWidth >= '794') {
		swfWidth = '794'
	}
	
	if (checkFlash() == true || flash == true) {
		$('body.home #teasertext').hide()
		$('body.home #teasertext').hide()
		document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"')
		document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+swfVersion+',0,0,0" ')
		document.write(' WIDTH="'+swfWidth+'" HEIGHT="'+swfHeight+'">')
		document.write(' <PARAM NAME=movie VALUE="'+swfSrc+'"><PARAM NAME="quality" VALUE="high"> <PARAM NAME="menu" VALUE=False> <PARAM NAME="wmode" VALUE="transparent">')
		document.write(' <EMBED src="'+swfSrc+'" quality="high" ')
		document.write(' swLiveConnect=false WIDTH="'+swfWidth+'" HEIGHT="'+swfHeight+'" menu=false wmode="transparent"')
		document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">')
		document.write(' </EMBED>')
		document.write(' </OBJECT>')
	}
}

// function mailme
function mailme( host, name, subject ){
	if( subject ) {
	    self.location = "mail" + "to:" + name + "@" + host + "?subject=" + subject
	} else {
	    self.location = "mail" + "to:" + name + "@" + host
	}
    return false;
}