<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// JQUERY --------------


	$(function() {
		$("#accordion").accordion({
		event: "mouseover"
		});
	});
		
	$(document).ready(function() {
							   
	// --- SG-SEARCH ---------
	var objHTML;	
	var objLength = 0;
	var paramA = "";
	var BKeyHTML = "";
	var selBKeys =","
	var bhtml = "";
	var formstgs = "";

	
	if(document.cookie) {
			
		var a = document.cookie,startPos,endPos,cstring,arrSelItems,objLinks,selBKeysCookies;
		
		var startPos = a.search(/ts=/);
		a = a.slice(startPos);
		var endPos = a.search(/;/);
		endPos != -1 ? cstring = (a.slice(0,endPos)) : cstring = a;
		cstring = cstring.substr(3);
		
		if(startPos != "-1") {
			$(".stg_box ul").show("slow");			
		}

		if(cstring != '') {
			arrSelItems = cstring.split(",");
			// --- Mark A-Keywords ---
			for(l=0;l<arrSelItems.length;l++) {	
				$("div.stg_box ul li a.sel").removeClass("sel");
				$("sg_search a.on").removeClass("on");	
				objLinks = $(".akeywords a, #sgf_form a, #sgf_type a");
				for(m=0;m<objLinks.length;m++) {
					if(objLinks[m].id == arrSelItems[l]) {
						$("#sg_search a#"+arrSelItems[l]).addClass("on");
					}
				}
			}
			
			formstgs = "";
			paramA = setAB();
			showBKey(paramA);

		}
		
	}
	
	// --- SGS-STARTPAGE, onSelect -> view STGs ---
	$(".akeywords a, #sgf_form a, #sgf_type a, #txt_check a").click(function() {
			$(".stg_box ul").show("slow");
	});
	
	// --- A-Keywords ---
	$("#a_keywords.sgf_box ul li a, .akeywords a").click(function() {
			var currID= $(this).attr("name");
			currID = currID.substr(1);
			// --- show/hide checkbox ---
			if($(this).hasClass("on") == true) {
				$(this).removeClass("on");
				//var BKeys = $("#txt_check ul li a[name*='_"+$(this).attr("id")+"']")
				var BKeys = $("#txt_check ul li a[name*='_"+currID+"']")

				for(i=0;i<BKeys.length;i++) {
					//alert(BKeys[i].id);
					var regExpr = new RegExp(BKeys[i].id+",");
					selBKeys = selBKeys.replace(regExpr,"");					
				}
			}
			else {
				$(this).addClass("on");
			}
			
			paramA = setAB();
			showBKey(paramA);
			showSTGs();
	});
	
	$("#sgf_form.sgf_box ul li a,#sgf_type.sgf_box ul li a").click(function() {
		$(this).hasClass("on") == true	?  $(this).removeClass("on") : $(this).addClass("on");
		showSTGs();
	});
	
	function setAB() {
			formstgs = "";
			// --- Get and show B-Keywords ---
			var selKeyA = $("#a_keywords.sgf_box ul li a.on");
			keyAlength = selKeyA.length;
			//alert(keyAlength);
			var paramA = "akey=";
			for(i=0;i<keyAlength;i++) {
				paramA = paramA + "'"+selKeyA[i].id+"'_";			
			}
			paramA = paramA + "&lang="+$("#sgslang").attr("title");
			// --- If no A-Keywords are selected ---
			if(keyAlength == '0') {
				selBKeys = "";
				paramA = "";
				$("#sgslang").attr("title") == 'de' ? $("#txt_check").html("Bitte zuerst Themen ausw&auml;hlen!") : $("#txt_check").html("Please select a topic");
			}
			return paramA;
	}
	
	// --- B-Keywords ---
	function showBKey(param) {
		formstgs = "";
	//alert(param);
	$.ajax({
   		type: "GET",
   		url: "/ts_bkey",
   		data: param,
   		success: function(data){
			//alert(data);
			var arrBKeys = data.split(",");
			//alert(arrBKeys.length);
			if(arrBKeys.length > 4) {
				//alert("B2" + "/" +selBKeys);
				$("#txt_check").html("");
				var prevCategory,arrCurrItem;
				prevCategory = "";
				for(i=1;i<=arrBKeys.length-3;i++) {
					//alert("["+arrBKeys[i]+"]/n");
					if(i==1) { BKeyHTML = "<ul>"; }
					arrCurrItem = arrBKeys[i].split("_");
					// --- Insert headline ---
					if(prevCategory != arrCurrItem[3]) {
						BKeyHTML = BKeyHTML + '<li class="head" id="cat_'+arrCurrItem[3]+'">'+arrCurrItem[3]+'</li>';					
					}
					BKeyHTML = BKeyHTML + '<li><a href="javascript:void(0);" id="B'+arrCurrItem[0]+'_'+arrCurrItem[2]+'" name="B'+arrCurrItem[0]+'_'+arrCurrItem[2]+'">'+arrCurrItem[1]+'</a></li>';
					if(i==arrBKeys.length-3) { BKeyHTML = BKeyHTML + '</ul>'; }
					prevCategory = arrCurrItem[3];
				}
				$("#txt_check").html(BKeyHTML);
				objHTML = $("#txt_check ul li a");

				// --- Click-Event für dynamische Links erstellen ---
				for(i=0;i<objHTML.length;i++) {
					$("#txt_check ul li a#"+objHTML[i].id).click(function(){
						if($(this).hasClass("on") == false) {
							$(this).addClass("on");
							selBKeys = selBKeys + $(this).attr("id") + ",";
							if($("#sg_search.start")) { $(".stg_box ul").show("slow"); }
						}
						else {
							$(this).removeClass("on");
							var regExpr = new RegExp($(this).attr("id")+",");
							selBKeys = selBKeys.replace(regExpr,"");
						}
						showSTGs();
					});
					if(document.cookie) {
						var regExpr = new RegExp(","+objHTML[i].id+",");
						selBKeysCookies = document.cookie.search(regExpr);
					}
					var compare = $("#txt_check ul li a#"+objHTML[i].id).attr("id")+",";
					if(selBKeys.search(compare) != -1 || selBKeysCookies != -1) {
						$("#txt_check ul li a#"+objHTML[i].id).addClass("on");
					}
				}
			}
			else {
				selBKeys = "";
			}
		},
		complete: function () {
			showSTGs();
		}

	});
	}
	
	function showSTGs() {
		formstgs = "";
		//alert("->"+bhtml);
		var t = $("#txt_check ul li a");
		//alert(t.length);
		$("div.stg_box ul li a.sel").removeClass("sel");
		var marks;
		var param = "";
		var arrMarks = new Array;
		var arrPname = new Array;		
		arrMarks[0] = "#a_keywords.sgf_box a.on";
		arrMarks[1] = "#txt_check a.on";
		arrMarks[2] = "#sgf_form a.on";
		arrMarks[3] = "#sgf_type a.on";
		arrPname[0] = "&akey=";
		arrPname[1] = "&bkey=";
		arrPname[2] = "&form=";
		arrPname[3] = "&type=";
		
		
		
		// --- Cookies ---
		var expires = new Date();
		var date = expires.getTime() + (5 * 24 * 60 * 60 * 120 * 1000);
		expires.setTime(date);
		var ts_temp = "";
		var ts_bkey = "";
		
		for(i=0;i<4;i++) {
			var marks = $(arrMarks[i]);
			var objLength = marks.length;

			objLength > 0 ? param = param + arrPname[i] : '';
			for(j=0;j<objLength;j++) {
				ts_temp = ts_temp + marks[j].id+',';
				if(i==0) {
					param = param + marks[j].name.substr(1)+',';
				}

				if(i==1) {
					param = param + marks[j].id.substr(1)+",";
					ts_bkey = ts_bkey + marks[j].id+","
				}
				if(i>1) {
					param = param + marks[j].id+",";
				}
			}
			param = '?'+param.substr(1);
			//alert(param);
		}

		//alert(param);
		document.cookie = "ts="+ts_temp+"; expires=" + expires.toGMTString()+"; path=/";
		//document.cookie = "ts_bkey="+ts_bkey+"; expires=" + expires.toGMTString();	

		$.get("/ts_filter"+param,function(data){
			//alert(data);
			var arrSTGS = data.split(",");
			var arrLength = arrSTGS.length;
			var string = "";
			formstgs = "&tocheck="
			for(k=1;k<arrLength-2;k++) {
				//string = string + "["+arrSTGS[k]+"]";
				formstgs = formstgs + arrSTGS[k] +";";
				$("div.stg_box ul li a#"+arrSTGS[k].toLowerCase()).addClass("sel");
				//$("div.stg_box ul li a#"+arrSTGS[k].toLowerCase()).css("font-weight","bold");
			}
			//alert(string);
		});
	}
	
	$("#infomaterial, p.infolink a").click(function(){
		var lang = $(this).attr("hreflang");
		var infourl = "https://actions.fh-joanneum.at/intrs/subscribe.do?locale="+lang+formstgs;
		window.open(infourl);
	});
	
							   							   
	// --- SG-SEARCH FUNCTION ---------
	/*$("#testlink").click(function() {
		//alert("geklickt");
		//$.get("http://www.fh-joanneum.at/custom/test.php"
		$.get("/themensuche?"+param,
  			function(data){
    			alert("Data: " + data);
  			});							 
	});*/
	
							   
	if(document.cookie) {
		var a = document.cookie;
		var zgID = a.substr(a.search('zg')+3,1);
		if(zgID!='') {
			$("#zg").attr("value") == zgID ? $("#checkzg").attr("checked","checked") : '';
		}
	}
							   
	// --- Set cookies for zg-pulldown ---------
	$("#checkzg").click(function() {
		if($("#checkzg").attr("checked")) {
			var expires = new Date();
			var date = expires.getTime() + (7 * 24 * 60 * 60 * 1000);
			expires.setTime(date);
			document.cookie = "zg="+$("#zg").attr("value")+"; expires=" + expires.toGMTString();
		}
		else {
			document.cookie = "zg="+$("#zg").attr("value")+"; expires=Thu, 01-Jan-70 00:00:01 GMT";			
		}
	});
							   
	// --- Delete Line for Nav-Item after selected Nav-Item ---------
	$("ul#nav li.selected").next().css("background-image","none");
	$("ul#nav li.firstOn").next().css("background-image","none");
							   				   
	// --- Signs ---------
	var curr_path;	
	$("#signs > a > img:not([src*='_ov'])").hover(function() {
		var src = $(this).attr("src");
		curr_path = src.substr(0, src.length-4);
		curr_path.length == 24 ? $(this).attr("src",curr_path+"_ov.jpg") : '';
	},function() {
		$(this).attr("src",curr_path+".jpg");
	});
	
	// --- Startpage - Monitor ---------
	$("ul#monitorList li a").click(function() {
		$("ul#monitorList li a.on").removeClass("on");
		if($(this).hasClass("on") != true) {
			$(this).addClass("on");
			var currID = $(this).attr("id").substr(4);
			$(".part").hide();
			$("#part"+currID).css("display","block");
		}
	});
							   
	// --- Hide Elements ---------
	//$("#pulldown").hide();
	//$("div.contTab").hide();
	//$(".showHide > ul").hide();
	//$("div#part2").hide();
	//$("div#part3").hide();
	//alert(document.location);

	// --- LIST-CONTAINER ---------
	if($("div.list_container").length > 1) {
		//alert($("div.list_container").length);
		$("ul.list_items").css("display","none");	
	}
	
	$("div.list_container h2 a").click(function() {
		id = $(this).attr("id");
		if($("ul#list_"+id).is(":visible")) {
			//alert("ul#list_"+id);
			$("ul#list_"+id).hide("slow");
		}
		else {
			$("ul#list_"+id).show("slow");
			//alert("zeigen: ul#list_"+id);
		}
	 });

	// --- Get AnchorID for Download-List ---------
	var pfad = window.location.href;
	if(pfad.indexOf("anchorID=") > "-1") {
		var param = pfad.slice(pfad.indexOf("anchorID="));
		param = param.split("&");
		anchorID = param[0].replace("anchorID=","");
		anchorID = anchorID.split("#");
		$("ul#list_"+anchorID[0]).show("slow");	
	}
	
	
	// --- Degree Programms --------- ----------
	/*$(".showHide h3 a").click(function() {
		var id = $(this).attr("href");		
		if($(id).is(":visible")) {
			$(id).hide("slow");
		}
		else {
			$(id).show("slow");
		}
	});*/
	
	$("#sg_search.start .stg_box h3 a, #sg_search.prog .stg_box h3 a").click(function() {
		var id = $(this).attr("id").split("_");
		if($("#list_"+id[1]).is(":visible")) {
			$("#list_"+id[1]).hide("slow");
		}
		else {
			$("#list_"+id[1]).show("slow");
		}
	});
	
	$(".showSearch").click(function() {
		if($("#sform").is(":visible")) {
			$("#sform").hide();
			$(this).attr("id") == "showSearchDE" ? $(this).html("Suche einblenden") : $(this).html("Show search");
		}
		else {
			$("#sform").show();
			$(this).attr("id") == "showSearchDE" ? $(this).html("Suche ausblenden") : $(this).html("Hide search");
		}
	});
	
	$(".showAll").click(function() {
		$(".showHide > ul").is(":visible") ? $(".showHide > ul").hide("slow") : $(".showHide > ul").show("slow");
	});
   
	// --- Tabs ----------
	var curr_tab = '';
	$("ul.tabs > li > a").mouseover(function() {
		var href = $(this).attr("href");
		id = href.substr(5, href.length);
		var parent = $("div.cont[id*='"+id+"']").attr("id");

		$(this).css({'background-image' : 'url(/custom/images/cbox_tabs_line.gif)','background-color' : 'white', 'background-position' : 'bottom'});
		$("#"+parent+".cont > ul.tabs > li > a[href!='"+href+"']").css({'background-image' : 'url(/custom/images/cbox_tabs_shadow.gif)', 'background-position' : 'left top', 'background-color' : 'transparent'});
		$("#"+parent+".cont > div:visible").hide();
		$("#"+id).show();
		$("#"+id+" > div:hidden").show();
		if($(this).attr("href") == '#tab_map') {
			offset = $("#tabMaps").offset();
			$("#gmap").css({'left' : offset.left, 'top' : offset.top+$("#tabMaps").height()});
			//$("#gmap").css("top",offset.top+$("#tabMaps").height());
		}
		else {
			$("#gmap").css("left","-10000px");
		}
		});
	
	// --- GMAP ---------
	var geocode = new Array();
	geocode[0] = new Object();
	geocode[0]["grz"] = "http://www.google.at/maps?f=q&source=s_q&hl=de&geocode=&q=fh-joanneum+graz&sll=47.069464,15.431016&sspn=0.037648,0.072699&ie=UTF8&ll=47.070005,15.409269&spn=0.008769,0.016394&z=14";
	
	geocode[0]["kbg"] = "http://www.google.at/maps?f=q&source=s_q&hl=de&geocode=&q=fh-joanneum+kapfenberg&sll=47.069873,15.411973&sspn=0.009777,0.018175&ie=UTF8&ll=47.453224,15.329447&spn=0.008706,0.016394&z=14";
		
	geocode[0]["bgb"] = "http://www.google.at/maps?f=q&source=s_q&hl=de&geocode=&q=fh-joanneum&sll=46.873981,15.907967&sspn=0.009813,0.018175&ie=UTF8&ll=46.873688,15.906143&spn=0.004401,0.008197&z=15";
	
	$("#tabMaps li a").click(function() {
		var id = $(this).attr("id");
		id = id.substr(4, id.length);
		$("#tabMaps li a[class='gmapTabActive']").removeClass("gmapTabActive");
		$(this).addClass("gmapTabActive");
		$("#gmap").attr("src",geocode[0][id]+"&output=embed");
		$("#gmapLargeview").attr("href",geocode[0][id]);
	 });
	
 
	// --- Navigation ---------
    $("#nav li").hover(function() {
      if($(this).hasClass("flag").toString() == 'false') {
        if($(this).next().hasClass("flag").toString() == 'false') {
          $(this).next().css("background-image","none");
        }
      }
      },function() {
        if($(this).hasClass("flag").toString() == 'false' && $(this).hasClass("selected").toString() != 'true') {
          if($(this).hasClass("selected").toString() == 'false' || $(this).hasClass("firstOn").toString() == 'false') {
			if($(this).next().hasClass("flag").toString() != 'true' && $(this).hasClass("firstOn").toString() != 'true') {
            	$(this).next().css("background-image","url(/custom/images/nav_btn_line2.jpg)");
			}
          }
        }
      });
	
// --- ZG-Pulldown ---
	var pd = new Array();
	pd[0] = '#pdselect';
	pd[1] = '#pulldown';
	
	// --- Set Pulldown-Position ---
	function getPDPosition(id) {
		p = $(id);
		return offset = p.offset();
	}
	
	for(i = 0; i<pd.length; i++) {
		if($(pd[i]).hover() != null) {
			$(pd[i]).hover(function() {
				var offset = getPDPosition("#pdcontent");
				$("#pulldown").css("display","block");
				$("#pulldown").css("left",offset.left)
				$("#pulldown").css("top",(offset.top)-1)
				$("#pdhead.bg1001").css("background-image","url(/custom/images/fbox_h2_1001_ov.jpg)");
				},function() {
				$("#pulldown").css("display","none");
				$("#pdhead.bg1001").css("background-image","url(/custom/images/fbox_h2_1001.jpg)");
			});
		}
	}
	
	$("#search").hover(function() {	
		$("#addOptions").css("display","block");
		},function() {
		$("#addOptions").css("display","none");
	});
	
	// --- Set Mainnav-Pulldown-Position ---
	function setNavPDPos() {
		var nav_elem= $("#nav li")
		if(nav_elem[0].id == "nav_home") {
			for(i=0;i<nav_elem.length-1;i++) {
				if(nav_elem[i].id != "nav_home") {
					var c = i-1;
					var offset = getPDPosition($("#nav_"+c));
					$("#pdn_"+c).css("left",offset.left-1);
					$("#pdn_"+c).css("top",offset.top+24);
				}
			}
		}
		else {
			for(i=0;i<nav_elem.length-1;i++) {
				var offset = getPDPosition($("#nav_"+i));
				$("#pdn_"+i).css("left",offset.left-1);
				$("#pdn_"+i).css("top",offset.top+24);
			}			
		}
	}
	
	if($("#pulldown_nav").is(":visible")) {
		setNavPDPos();
		$(window).resize(function(){
			setNavPDPos();							  
		});
		
		$("#nav li").hover(function() {
			curr_id = $(this).attr("id").substr(4);
			var offset = getPDPosition(this);
			$("#pdn_"+curr_id).fadeIn(200);					   
		},function() {
			curr_id = $(this).attr("id").substr(4);
			$("#pdn_"+curr_id).hide();															
		});

		$("#pulldown_nav ul").hover(function() {
			curr_id = $(this).attr("id").substr(4);
			setNavBG(curr_id,1);
			$(this).show();
		},function() {
			curr_id = $(this).attr("id").substr(4);
			setNavBG(curr_id,0);
			$(this).hide();															
		});
		
		function setNavBG(id,show) {
			var obj_li = $("#nav li#nav_"+id);
			var obj_a = $("#nav li#nav_"+id+" a");
			if(obj_li.hasClass("selected").toString() == "false") {
				if(show == 1) {
					obj_a.addClass("sel");
					if(obj_li.next().hasClass("flag").toString() == 'false') {
						obj_li.next().css("background-image","none");					
					}
				}
				else {
					obj_a.removeClass("sel");
					if(obj_li.next().hasClass("flag").toString() == 'false') {
						obj_li.next().css("background-image","url(/custom/images/nav_btn_line2.jpg)");					
					}
				}
			}
		}
		
	}
	
});
	

-->