$.noConflict();
jQuery(document).ready(function($) {

	$.vdiMenu = function(id) {
		$(id).find('ul').find('li').hover(function() {
			$(id).find('ul').find('li').removeClass("trail");
			$(this).parent("ul").parent("li").addClass("trail");
			$(this).parent("ul").parent("li").parent("ul").parent("li").addClass("trail");
			$(this).parent("ul").children("li").children("ul").hide();
			clearTimeout($(this).data('vdiMenu'));
			$(this).find('ul:first').fadeIn('fast');
		}, function() {
			var mm = $(this);
			var timer = setTimeout(function() {
				mm.find('ul:first').fadeOut('fast');
			}, 500);
			$(this).data('vdiMenu', timer);
		});
	}

	$(document).ready(function() {
		$.vdiMenu("#hauptnavi");
	});
});

	var browser = navigator.appName;
	var version = navigator.appVersion.substring(0,1);
	var ie	= ((browser == "Microsoft Internet Explorer") && (version >= 4));
	var ns4	= ((browser=="Netscape") && (version = 4));
	var ns	= ((browser=="Netscape") && (version > 4));
	var op5	= ((browser=="Opera") && (version = 5));
	var op	= ((browser=="Opera") && (version > 5));

	function Startseite(Seite)
	{
		if (ie)
		{
			document.body.style.behavior = "url(#default#homepage)";
			document.body.sethomepage(Seite);
		}else{
			document.location.href = "http://www.vdi-nachrichten.com/allgemein/browser.asp";
		}
	}

	function Favoriten(Seite,Beschreibung)
	{
		if (ie)
		{
			window.external.addfavorite(Seite,Beschreibung);
		}else{
			if (ns4)
			{
//				alert("Bitte drücken Sie STRG + D um " + Beschreibung + " zu Ihren Favoriten hinzuzufügen");
				document.location.href = "http://www.vdi-nachrichten.com/allgemein/browser.asp#netscape4";
			}else{
				if (ns)
				{
//					alert("Bitte drücken Sie STRG + D um " + Beschreibung + " zu Ihren Favoriten hinzuzufügen");
					document.location.href = "http://www.vdi-nachrichten.com/allgemein/browser.asp#netscape";
				}else{
					if (op5)
					{
//						alert("Bitte drücken Sie STRG + T um " + Beschreibung + " zu Ihren Favoriten hinzuzufügen");
						document.location.href = "http://www.vdi-nachrichten.com/allgemein/browser.asp#opera5";
					}else{
						if (op)
						{
//							alert("Bitte drücken Sie STRG + T um " + Beschreibung + " zu Ihren Favoriten hinzuzufügen");
							document.location.href = "http://www.vdi-nachrichten.com/allgemein/browser.asp#opera";
						}else{
//							alert("Leider kann " + Beschreibung + " nicht automatisch zu Ihren Favoriten hinzugefügt werden. Bitte fügen Sie " + Beschreibung + " manuell zu Ihren Favoriten hinzu.");
							document.location.href = "http://www.vdi-nachrichten.com/allgemein/browser.asp#unknown";
						}
					}
				}
			}
		}
	}

function  ShowIngKaHelp(helpPath)
{
	var infoWin;
	// Display the Info page
	infoWin = window.open (helpPath + "Stm_Info.html","INFOWIN","resizable,scrollbars,width=640,height=480"); 
	//infoWin.document.title = "Information zum Online Stellenmarkt";
	//return false;
}

function popUpSTM(URL) {
	width = 0;
	height = 0;
		width = Math.ceil(screen.width / 2);
	height = Math.ceil(screen.height * 0.8);
	if ( width < 760 ) width = 760;
	if ( height < 480 ) height = 480;
	left = ( ( screen.availWidth - width ) / 2 ) - ( screen.width - screen.availWidth );
	oben = ( ( screen.availHeight - height ) / 2 ) - ( screen.height - screen.availHeight );
	uebersicht = window.open(URL,'Detailansicht','dependent=yes,titlebar=yes,toolbar=no,status=no,menubar=no,location=no,hotkeys,directories=no,resizable=yes,scrollbars=yes,height='+height+',width='+width+',left='+left+',top='+oben );
	uebersicht.focus();
}

function popUpBV(tgtUrl) {
	  bvwin= window.open(tgtUrl, 'Expressbewerbung', 'width=600,height=600,resizable=yes,scrollbars=yes');
	  bvwin.focus();
}

function Go(x) {
		//document.location.href = x;
		Fenstername=window.open(x,"Name");
		Fenstername.focus();
		return false
}

function showVoting(sPageID,sPageURL,sPageQuery) {
	var filename ="/voting/vote.asp";
	var size 
	filename = filename + "?pageID=" + sPageID + "&pageURL=" + sPageURL + "&pageQuery=" + sPageQuery;
	w = 350;
	h = 250; 
	Fenstername=window.open(filename,'Name','toolbar=no,locationbar=no,scrollbars=no,resizable=no,status=no,screenX=400,screenY=400,top=400,left=400,width='+w+',height='+h);
	Fenstername.focus();
}

function printSTM() {
	if (document.all) {
		
	}
	parent.frames[0].focus();
	parent.frames[0].print();
}

function showHelpWin(sPageURL)
{
	// Create a new instance of the window
	helpWin = window.open(sPageURL,"Hilfe","screenX=0,screenY=0,left=0,top=0,width=500,height=500,left=100,top=50,status=1,scrollbars,resizable",true);
	helpWin.focus();
}

function openpopup(strPage,strName,strWidth,strHeight)
{
	window.open(strPage,strName,'height='+strHeight+',width='+strWidth+',status=no,toolbar=no,menubar=no,location=no,top=80,left=100,resizable=no,scrollbars=no',true);
}

function openpopupresize(strPage,strName,strWidth,strHeight)
{
	window.open(strPage,strName,'height='+strHeight+',width='+strWidth+',status=no,toolbar=no,menubar=no,location=no,top=80,left=100,resizable=yes,scrollbars=yes',true);
}

function closepopup()
{
	window.opener.focus;
	window.close();
}

	function getCookieVal (offset)
	{
		var endstr = document.cookie.indexOf (";", offset); 
		if (endstr == -1) 
		endstr = document.cookie.length; 
		return unescape(document.cookie.substring(offset, endstr));
	}

	function GetCookie(name)
	{
		var arg = name + "="; 
		var alen = arg.length; 
		var clen = document.cookie.length; 
		var i = 0; 
		while (i < clen)
		{ 
			var j = i + alen; 
			if (document.cookie.substring(i, j) == arg) 
			return getCookieVal (j); 
			i = document.cookie.indexOf(" ", i) + 1; 
			if (i == 0) break; 
		} 
		return null;
	}

	function SetCookie(name, value)
	{
		var argv	= SetCookie.arguments; 
		var argc	= SetCookie.arguments.length; 
		var expires	= (argc > 2) ? argv[2] : null; 
		var path	= (argc > 3) ? argv[3] : null; 
		var domain	= (argc > 4) ? argv[4] : null; 
		var secure	= (argc > 5) ? argv[5] : false; 
		path		= "/";
		document.cookie	= name + "=" + escape (value) + 
			((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
			((path == null) ? "" : ("; path=" + path)) + 
			((domain == null) ? "" : ("; domain=" + domain)) + 
			((secure == true) ? "; secure" : "");
	}

	function DeleteCookie(name)
	{
		var exp		= new Date(); 
		exp.setTime(exp.getTime() - 1);
		var cval	= GetCookie(name);
		document.cookie	= name + "=" + cval + "; expires=" + exp.toGMTString();
	}

	// lese Zoom Cookie und lade passendes Stylesheet			  @04.05.06 - FD, EoA
	function CheckZoomCookie()
	{
		var Zoom	= GetCookie('zoom')
		if ((Zoom != null) && (Zoom == '1'))
		{
			document.getElementById("csszoom").href			= "/_framework/css/zoom.css";
		}
	}
		

/*
  author: Andreas Deschka
  email: andreas.deschka@sol.at
*/

// Global variables
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page
infoElement= null; // node of the Div-Layer that shows the information
xFromMouse=0;
yFromMouse=0;
yUpFromMouse=47;
standardStyle='position:absolute;left:0px;top:0px;visibility:hidden;text-align:center;z-index:999;';
vars=new Object();
vars.tags=[ 'a', 'input' ]; // array of tag-names that should provide information
vars.infoAttributeName= 'info'; // in the tags the attribute that contains the text to show	
vars.infoElementCentered= true; // centered relative to mouse-pointer
vars.infoElementId=null; // use this div-Tag for the id to show information, null->create new one
vars.infoElementStyleClass=null; // use this CSS-class if no Id is defined, do not forget padding	
vars.infoElementFontSize= '12px'; // use if no Id and no CSS-class is defined
vars.infoElementTextColor='#000000';
vars.infoElementBGColor= '#FFFFE1';// // use if no Id and no CSS-class is definded
function setVariables(){
	var settings= window.infoSettings;
	// infoSettings is optional object that contains user variables
	// insert infoSettings before adding link to this js-file
	if( settings==null ){
		// default values are used		
	} else {
		for( var varName in settings ){
			if( settings[varName]!=null )
				vars[varName]= settings[varName];	
		}
	}	
};
setVariables();	
begin();
function begin(){	
	attachInfoElement();
	installTagListeners();
	oldOnmousemove= document.onmousemove;
	if (document.all) { // Internet Explorer
		yFromMouse=17;
		xFromMouse=2;
		document.onmousemove = captureMousePosition;	
	} else if (document.getElementById) { // Netcsape 6 + Mozilla
		yFromMouse=21;
		xFromMouse=2;
		document.onmousemove = captureMousePosition;		
	}
}
function captureMousePosition(e) {
	if ( document.documentElement&& window.event&& document.documentElement.clientWidth>0 ){
	// IE6 (sometimes)
	xMousePos = window.event.x+ document.documentElement.scrollLeft; 
		yMousePos = window.event.y+document.documentElement.scrollTop;
		xMousePosMax = document.documentElement.clientWidth+document.documentElement.scrollLeft;
		yMousePosMax = document.documentElement.clientHeight+document.documentElement.scrollTop-12;        	
   } else if (document.all) {
		// When the page scrolls in IE, the event's mouse position
		// reflects the position from the top/left of the screen the
		// user is looking at. scrollLeft/Top is the amount the user
		// has scrolled into the page. clientWidth/Height is the height/
		// width of the current page the user is looking at. So, to be
		// consistent with Netscape (above), add the scroll offsets to
		// both so we end up with an absolute value on the page, no
		// matter if the user has scrolled or not.        
	xMousePos = window.event.x+document.body.scrollLeft;
		yMousePos = window.event.y+document.body.scrollTop;
		xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
		yMousePosMax = document.body.clientHeight+document.body.scrollTop;
	} else if (document.getElementById) {
		// Netscape 6 behaves the same as Netscape 4 in this regard
		xMousePos = e.pageX;
		yMousePos = e.pageY;
		xMousePosMax = window.innerWidth+window.pageXOffset;
		yMousePosMax = window.innerHeight+window.pageYOffset;
	}
	moveElements();	
	if( oldOnmousemove!=null ){		
		oldOnmousemove(e);
	}
}
function out( string ){
	var outDiv=document.getElementById('out')
	if(outDiv!=null) outDiv.firstChild.nodeValue+=string+" ";
}
function moveElements(){
	moveInfoElement();
}
function attachInfoElement( ){
	var str='<div style="'+standardStyle+'" id="';
	if(vars.infoElementId!=null &&vars.infoElementId.length>0){
		str+= vars.infoElementId+'" ';		
	} else {
		vars.infoElementId='infoElement';
		str+= vars.infoElementId+'"';	
		if(vars.infoElementStyleClass!=null && vars.infoElementStyleClass.length>0){
			str+= ' class="'+vars.infoElementStyleClass+'" ';			
		} else {
			str+=' class="'+vars.infoElementId+'" ';
			var sty='<style type="text/css"><!--';
			sty+=('#'+vars.infoElementId+' {');
			sty+=('background-color: '+vars.infoElementBGColor+';');	
			sty+='color:'+vars.infoElementTextColor+';';
			sty+=('border: 1px solid #999999;');
			sty+=('font-size: '+vars.infoElementFontSize+';');
			sty+=('font-family: Arial, Helvetica, sans-serif;');
			sty+='padding:2px;';
			sty+=('}	--></style>');			
			document.writeln( sty );
		}
	}	
	str+=' > </div>'	
	out(str);
	document.writeln( str );	
}
function installTagListeners( delayTime ){
	infoElement=document.getElementById( vars.infoElementId );
	if( infoElement==null ){} else {		
		for( var k=0; k<vars.tags.length; k++){		
			var links=document.getElementsByTagName(  vars.tags[k].toUpperCase() );
			for(var i=0;links!=null&&i<links.length;i++){				
				var node= links[i];
				var infoText=node.getAttribute( vars.infoAttributeName ); 
				if( infoText!=null && infoText.length > 0&& node.infoText_==null ){
						node.infoText_= infoText;
						// the _ is used to avoid name conflicts with the attributes of the user
						node.style.cursor='pointer';
						if( node.onmouseover==null ){
							node.onmouseover= showInfo;					
						} else {
							node.oldOnmouseover= node.onmouseover;
							node.newOnmouseover= showInfo;
							node.onmouseover= function(){
								this.newOnmouseover();
								this.oldOnmouseover();
							}
						}
						if( node.onmouseout==null ){
							node.onmouseout= hideInfo;					
						} else {
							node.oldOnmouseout= node.onmouseout;
							node.newOnmouseout= hideInfo;
							node.onmouseout= function(){
								this.newOnmouseout();
								this.oldOnmouseout();
							}
					   }
				}
			}
		}
	}	
	if( delayTime==null)
		delayTime=0;
	if( delayTime < 2 ){
		delayTime+=0.2;
	}	
	setTimeout('installTagListeners('+delayTime+')',delayTime*1000); 
}
function moveInfoElement(){	
	if( infoElement ==null ){
		//out('infoElement=null ');
		//alert('infoElement=null');
		//infoElement=1;
	} else if( infoElement.style.visibility != 'hidden'){		
		var x=xFromMouse+xMousePos;
		if(vars.infoElementCentered==true){
			x-=0.5*infoElement.offsetWidth;			
		}
		//out(' width: '+infoElement.offsetWidth+' x: '+x+' fx: '+(x+infoElement.offsetWidth)+' |||');
		if( xMousePosMax>0 && x+ infoElement.offsetWidth> xMousePosMax-20 ){
			x= xMousePosMax-20- infoElement.offsetWidth;			
		}
		if( x<5 ){
			x=5;
		}		
		var y=yFromMouse+yMousePos;
		if( yMousePosMax>0 && y+ infoElement.offsetHeight> yMousePosMax ){
			y-= yFromMouse+yUpFromMouse;
		}		
		infoElement.style.left=x+'px'; 
		infoElement.style.top=y+'px';		
	} 
}
function setInfoText( text ){			
	var subtext='';
	for(var i=0;i<text.length;++i){		
		if(text.substr(i,4)=='<br />'){			
			infoElement.appendChild(document.createTextNode(subtext));
			infoElement.appendChild(document.createElement('br'));
			subtext='';
			i+=3;
		} else {
			subtext=subtext+text.charAt(i)
		}
	}	
	infoElement.appendChild( document.createTextNode(subtext));		
}
function unsetInfoText(){
	while(infoElement.hasChildNodes()){
		infoElement.removeChild(infoElement.lastChild);
	}	
}
function showInfo(){		
	unsetInfoText();
	infoElement.left='0px';
	infoElement.top='0px';
	setInfoText( this.infoText_ );		
	infoElement.style.visibility='visible';
	moveInfoElement();			
}

function hideInfo(){		
	infoElement.style.visibility='hidden';
	unsetInfoText();	
}

function openAdvtVideo(advt_id)
{
	var jobtvVideoHeight = 245;
	var jobtvVideoWidth = 300;
	var strHeight = jobtvVideoHeight + 30;
	var strWidth = jobtvVideoWidth + 30;
	strHeight = 560;
	strWidth = 540;
	var jobtv24url = '/stellenmarkt/StellenanzeigeVideo.aspx?advt_id='+ advt_id;
	var jobtv24win = window.open(jobtv24url, "AdvtVideo", 'height='+strHeight+',width='+strWidth+',status=no,toolbar=no,menubar=no,location=no,top=80,left=100,resizable=no,scrollbars=yes', true);
	jobtv24win.focus();
	return false;
}

// schreibe Zoom Cookie und lade passendes Stylesheet
function writeCookie(wert)
{
	var expDays	= 365;
	var exp		= new Date(); 
	exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
	SetCookie('zoom', wert, exp);
	if (wert=='1')
	{
		document.getElementById("csszoom").href			= "/_framework/css/zoom.css";
		document.getElementById("font_gross").style.display = "block";
		document.getElementById("font_klein").style.display = "none";
	}
	else // if (wert=='0')
	{
		document.getElementById("csszoom").href			= "";
		document.getElementById("font_gross").style.display = "none";
		document.getElementById("font_klein").style.display = "block";
	}
}

// sanftes Einblenden der Inhaltselemente einer Contentbox
function showcontentBox(block) {
	if (block > contentBoxBlocks) {
		block = 1;
	}
	var start = (block * contentBoxOneBlock) - contentBoxOneBlock;
	var end = ((block + 1) * contentBoxOneBlock) - contentBoxOneBlock;
	if (end > contentBoxCount) {
		end = contentBoxCount;
	}
	for (i = start; i < end; i++) {
		$(contentBox[i]).fadeIn(contentBoxFadeInTime);
	}
	window.setTimeout("hidecontentBox(" + block + ")", contentBoxHoldOnTime);
}

// sanftes Ausblenden der Inhaltselemente einer Contentbox
function hidecontentBox(block) {
	var start = (block * contentBoxOneBlock) - contentBoxOneBlock;
	var end = ((block + 1) * contentBoxOneBlock) - contentBoxOneBlock;
	if (end > contentBoxCount) {
		end = contentBoxCount;
	}
	for (i = start; i < end; i++) {
		$(contentBox[i]).fadeOut(contentBoxFadeOutTime);
	}
	window.setTimeout("showcontentBox(" + (block + 1) + ")", contentBoxFadeOutTime);
}

// google analytics - ingenieurkarriere.de
var gaKey = 'UA-27095315-2';

var _gaq = _gaq || [];
_gaq.push(['_setAccount', gaKey]);
_gaq.push(['_gat._anonymizeIp']);
_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);
})();

function recordOutboundLink(link, category, action) {
	try {
		var myTracker = _gat._getTrackerByName();
		_gaq.push(['myTracker._trackEvent', ' + category + ', ' + action + ']);
	} catch (err) { }
}

function clickHandler(e) {
	if (window.event) e = window.event;
	var srcEl = e.srcElement ? e.srcElement : e.target;
	var targetUrl = srcEl.getAttribute('href');
	if (targetUrl && targetUrl.length > 0) {
		var re = new RegExp('^(?:f|ht)tp(?:s)?\://([^/]+)', 'im');
		var tarDomain = (targetUrl.match(re) ? targetUrl.match(re)[1].toString() :
		 (targetUrl.indexOf(':') < 0 ? intDomain : null));
		if (tarDomain != null) {
			var a = document.createElement('a');
			a.href = targetUrl;
			var filePath = a.pathname;
			var fileName = filePath.split('/').pop();
			var fileExt = fileName.substring(fileName.indexOf('.') + 1);
			if (intDomain == tarDomain) {
				for (i = 0; i < downloadExtension.length; i++) {
					if (fileExt == downloadExtension[i]) {
						if (trackDownloadsAsEvent) _gaq.push(['_trackEvent', downloadCat, filePath]);
						else _gaq.push(['_trackPageview', filePath]);
					}
				}
			}
			else {
				if (trackExtlinksAsEvent) _gaq.push(['_trackEvent', extLinksCat, tarDomain]);
				else _gaq.push(['_trackPageview', '/' + extLinksCat + '/' + tarDomain]);
			}
		}
	}
}

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"));

//var pageTracker = _gat._getTracker('UA-27095315-2');
//pageTracker._trackPageview();

var downloadExtension = new Array('doc', 'docx', 'pdf', 'xls', 'ppt', 'zip', 'gz', 'bz2', 'rar', 'txt', 'vsd', 'vxd', 'js', 'css', 'exe', 'wma', 'mov', 'avi', 'wmv', 'mp3', 'mp4');
var trackDownloadsAsEvent = false;
var trackExtlinksAsEvent = true;
var downloadCat = 'Downloads';
var extLinksCat = 'Externe Links';
var intDomain = window.location.hostname;

if (window.addEventListener) {
	document.addEventListener('click', clickHandler, false);
}
else {
	document.attachEvent('onclick', clickHandler);
}
