/**
 * @author	Markus Brunner, mail [at] markusbrunner-design [dot] de
 * @path		/fileadmin/templates/scripts/js/default.css
 * @content	Standard-Javascript-Functions
 */
 
/**********************************************************************
 *	Font-Size
 **/

function setFontsize(fs,act) {
	if(isNaN(fs) || fs==0 || fs===0) {
		if(document.cookie) {			
			fs = searchFS(document.cookie);
			
		}
		else { 
			fs = 62.5;
		}
	} else {
		document.cookie = 'fs='+fs;
	}
	if(isNaN(fs) || fs==0 || fs===0) {
		document.cookie = 'fs=62.5'; 
		fs = 62.5;
	}		
	document.body.style.fontSize = fs+'%';
	var parent = act.parentNode;
	var child = null;
	if(parent != null){
		for(var i=0;i<parent.childNodes.length;i++){
			child = parent.childNodes[i];
			if(child != act){
				child.className = child.className.replace(/active/gi,"");
			} else {
				if(child.className.match(/active/) == null){
					child.className = child.className + " active";
				}
			}
		}
	}
}
/*
function searchFS(data) {
	arr_data = data.split(';');
	for(i=0; i<arr_data.length; i++)
	{
		if(arr_data[i].search(/fs=/) > -1) {
			fs_data = arr_data[i].split('=');
			return fs_data[1];
		}
	}
}
*/

/**********************************************************************
 *	opener-box as link
 **/
function initOpenerBoxes() {
    var toggle = $j('.opener-box');
    $j(toggle).each(function(index,el){
       var url = $j(el).find('a:first').attr('href');
        $j(el).bind('click',function(){
            if(url != undefined && url != '') {
                window.location = url;
            }
        });
    });
}

$j(document).ready(function(){
    initOpenerBoxes();
});

/**********************************************************************
 *	Clearing for Inputs
 **/
function clearInput(obj, cpValue) {
	if(obj.value == cpValue) { obj.value = ''; }
}

/**********************************************************************
 *	Clearing for TextAreas
 **/
function clearTextArea(obj, cpValue) {
	if(obj.innerHTML == cpValue) { obj.innerHTML = ''; }
}
