$(document).ready(function() {
	$(".programma").hover(
		function(){	$(".subnav").show() },
		function(){	$(".subnav").hide() }
	);
})

function initSIFR() {
	if(typeof sIFR == "function"){
		// header yellow
		sIFR.replaceElement(named( {
			sSelector:"h1",
			sFlashSrc:"flash/helvetica.swf",
			sColor:"#0000000",
			sWmode:"transparent",
			nPaddingTop:0,
			nPaddingBottom:0,
			sFlashVars:"textalign=left&offsetTop=0"
			}
		));
		sIFR.replaceElement(named( {
			sSelector:"h2",
			sFlashSrc:"flash/helvetica.swf",
			sColor:"#FFFFFF",
			sWmode:"transparent",
			nPaddingTop:0,
			nPaddingBottom:0,
			sFlashVars:"textalign=left&offsetTop=0",
			forceSingleLine: true,
			tuneHeight: -15
			}
		));

	};
}

var IE = document.all?true:false
var UserOK

//All fields with id filled in are required fields.
function cOn(td, color) {
    if(document.getElementById||(document.all && !(document.getElementById))) {
	  td.style.backgroundColor= color;
	  td.style.cursor = 'pointer';
	}
}
function cOut(td,color) {
    if(document.getElementById||(document.all && !(document.getElementById))) {
	  td.style.backgroundColor= color;
	}
}

//Smooth Resize
var timeoutLength = 10;
var pixelsPerTick = 20;
var originalHeight = 90;

function resize(stritem,list) {
	//status = document.getElementById('content1').offsetHeight;
	var style = document.getElementById(stritem).style;
	if (style.display != 'none') {
		if (document.getElementById(stritem).innerHTML.length>0){ 
		  smoothResize1(stritem);
		}
	} else {	  		
		document.getElementById(stritem).style.display = 'block';
		var arr = document.getElementById(list).value.split(',')
		for(var cnt=0;cnt<arr.length;cnt++){		
      if (arr[cnt] != '' &&(arr[cnt] != stritem)){
        if (document.getElementById(arr[cnt]).style.display == 'block'){
		      smoothResize1(arr[cnt]); //Dichtklappen
		    }
		  }
		}
		if (document.getElementById(stritem).innerHTML.length>0){	
		  smoothResize2(stritem,originalHeight);	//Openklappen
		}
	}
	//status = document.getElementById('content1').offsetHeight;
}
function smoothResize1(stritem) //Dichtklappen
{
	if ( (parseInt(document.getElementById(stritem).offsetHeight)-pixelsPerTick) <= 0 )
	{		
		document.getElementById(stritem).style.display = 'none';			
	}
	else
	{
		document.getElementById(stritem).style.height = parseInt(document.getElementById(stritem).offsetHeight-pixelsPerTick) + 'px' ;
		setTimeout("smoothResize1('"+stritem+"')",timeoutLength);			
	}
}
function smoothResize2(stritem,max) //Openklappen
{ 
	if ( (document.getElementById(stritem).offsetHeight+pixelsPerTick) >= max )
	{ 
		document.getElementById(stritem).style.height = max+'px';				
	}
	else
	{	  
	  document.getElementById(stritem).style.height = document.getElementById(stritem).offsetHeight+pixelsPerTick+'px';		
	  setTimeout("smoothResize2('"+stritem+"',"+max+")",timeoutLength);
	}
}
//End smooth Resize

function getCheckboxValue(id) {
	var allInputTags = document.getElementById(id+'_group').getElementsByTagName('INPUT');
	for (var c=0; c<allInputTags.length; c++) {
		if (allInputTags[c].checked) {
			return allInputTags[c].value;
			break;
		}
	}
	return ""
}

function openOverlay(title,url,width,height) {
	GB_showCenter(title, url, /* optional */ height, width)
}

function selEcard(id) {
	var allEcards = document.getElementById('ecards').value.split(',')
	for(i=0;i<allEcards.length;i++){
		document.getElementById(allEcards[i]).style.border = '3px solid #000000'
	}
	document.getElementById('ecard'+id).style.border = '3px solid #FFF200'
	document.getElementById('ecard').value = id
}

function printme() {
	var objOut = document.getElementById("output");
	var out = objOut.innerHTML;
		
	var wh = window.open("","wh","width=640px,height=480px,scrollbars=yes");
	wh.document.open();
	var output = '<link href="css/print.css" rel="stylesheet" type="text/css">';
	output = '<html><head>'+output+'</head><body>'+out.replace('<object','<!--object').replace('/object>','/object-->')+'</body></html>';
	output += '<'+'script type="text/javascript">';
	output += 'setTimeout("window.print()",2000);';	
	output += '</'+'script>';
	wh.document.writeln(output);
	wh.document.close();
}

function countChars(id,qty) {
	var obj = document.getElementById(id)
	obj.onclick=function(){document.getElementById('cntChars').innerHTML = qty - obj.value.length}
	obj.onkeyup=function(){
		document.getElementById('cntChars').innerHTML = qty - obj.value.length; 
		if (obj.value.length >= qty){
			document.getElementById(id).value=document.getElementById(id).value.substring(0,qty)
		}
	}
	document.getElementById('cntChars').innerHTML = qty - obj.value.length
	
}

function display(id) {
	for(i=0;i<40;i++){
		if(id == i) {
			if(document.getElementById('line'+ i)) document.getElementById('line'+ i).style.display='block'
		}else{
			if(document.getElementById('line'+ i)) document.getElementById('line'+ i).style.display='none'
		}
	}
}

function subOver(obj) {
	document.getElementById(obj.id).src = eval(obj.id+'_o').src
}

function subOut(obj) {
	document.getElementById(obj.id).src = eval(obj.id).src
}


function mOn(obj) {
	var ext = obj.src.slice(-3)
	if(obj.src.indexOf('-on.'+ ext)==-1){
		obj.src=obj.src.replace('.'+ ext,'_o.'+ ext)
	}
}

function mOut(obj) {
	var ext = obj.src.slice(-3)
	obj.src=obj.src.replace('_o.'+ext,'.'+ext)
}
