function show(divID,ontext,offtext){
	state = document.getElementById(divID).className;
	linkID = 'link_'+divID;
	
	if(state=='show'){
		document.getElementById(divID).className='hidden';
		document.getElementById(linkID).innerHTML = ontext;
	}
	else if(state=='hidden'){
		document.getElementById(divID).className='show';	
		document.getElementById(linkID).innerHTML = offtext;
	}
}

function popup(file,height,width,name){
	params = 'width='+width+',height='+height+',scrollbars=1';
	window.open(file,name,params);
}

/* ZOOM */
function get_cookie ( cookie_name ){
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
  if (results)
    return(unescape(results[2]));
  else
    return null;
}

function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure ){
  var cookie_string = name + "=" + escape ( value );
  if(exp_y){
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }
  if(path)
        cookie_string += "; path=" + escape (path);
  if(domain)
        cookie_string += "; domain=" + escape (domain);
  if(secure)
        cookie_string += "; secure";
  document.cookie = cookie_string;
}

function zoom(level){
	var current_date = new Date;
	var cookie_year = current_date.getFullYear ( ) + 1;
	var cookie_month = current_date.getMonth ( );
	var cookie_day = current_date.getDate ( );
	set_cookie("zoomlevel",level,cookie_year,cookie_month,cookie_day);
	
	if(level=='1'){
		size = '90%';
	}
	else if(level=='2'){
		size = '110%';
	}
	else if(level=='3'){
		size='125%';
	}
	else{
		size='75%';
	}
	document.getElementById('main-container').style.fontSize=size;
}

function zoominit(){
	if(get_cookie ("zoomlevel")){
		var zoomlevel = get_cookie("zoomlevel"); 
	  	if(zoomlevel=='1'){
			size = '90%';
		}
		else if(zoomlevel=='2'){
			size = '110%';
		}
		else if(zoomlevel=='3'){
			size='125%';
		}
		else{
			size='75%';
		}
		document.getElementById('main-container').style.fontSize=size;
	}	
}

function openCB(id,url,width,height){
	$(id).colorbox({iframe:true,width:width,height:height,href:url});
}

function openCBextended(id,url,width,height,type){	
	// types:
	// - img - ajax - iframe - inline
	
	if(type=='img'){
		//pfad = $('#img'+id).attr('src');
		//alert(pfad);
		$(id).colorbox({href:url});
	}
	else if(type=='iframe'){
		$(id).colorbox({iframe:true,width:width,height:height,href:url});
	}
	
}
function openCBextended2(id,url,width,height,type,rel,slideshow){	
	// types:
	// - img - ajax - iframe - inline
		
	if(type=='img'){
		//pfad = $('#img'+id).attr('src');
		//alert(pfad);
		if(rel=='' || rel=='undefined')
			$("a#bildid").colorbox();
		else
			if(slideshow==1){
				$("a[rel='"+rel+"']").colorbox({
					slideshow:true,
					transition:"fade"	
				});
			}
			else{
				$("a[rel='"+rel+"']").colorbox();	
			}
	}
	else if(type=='iframe'){
		$(id).colorbox({iframe:true,width:width,height:height,href:url});
	}
	
}