function var_dump(obj) {
	if(typeof obj == "object") {
		if(obj.name == 'TypeError'){
			return obj.message + "\nFile: " + obj.fileName + "\nLine: " + obj.lineNumber;		
		} else {
			return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + obj;
		}
	} else {
		return "Type: "+typeof(obj)+"\nValue: "+obj;
	}
}

function setAjaxUrl(link){
	var oldUrl = window.location.toString();
	var pos = oldUrl.search(/#/);
	if(pos != -1){
		var newUrl = oldUrl.substring(pos);
		link.href += newUrl;
	}
}

function submitToButton(submit){
	var submitLink = new Element('button', {
		className: submit.readAttribute('class'),
		id: submit.id
	}).update(submit.readAttribute('value'));
	Element.replace(submit, submitLink);
}

// function for popups in Daimler joboffers
function popup(ziel, breite, hoehe){
	if(ziel.search(/http.+/) == -1){
		ziel = "http://career.daimler.de" + ziel;
	}
	if((breite + hoehe) == 0){
		window.location = ziel;
	} else {
		window.open(ziel,'','width='+breite+',height='+hoehe+',scrollbars=yes,resizable=yes');
	}
}

//function for Facebox Popup
function openFacebox(kind, url, hideClose){	
	switch (kind){
		case 'ajax':	jQuery.facebox({ ajax: url});
						break;
		case 'div':		jQuery.facebox({ div: url});
						break;
		case 'image':	jQuery.facebox({ image: url});
	}
	if (hideClose) {
		jQuery(document).bind('reveal.facebox', function(){
			$$('#facebox div.footer').first().hide();
		});
	}
}

function increase_thickbox_height(rows){
	if(!$('TB_iframeContent').rev){
		$('TB_iframeContent').rev = $('TB_iframeContent').getHeight();
	}
	$('TB_iframeContent').setStyle({height: $('TB_iframeContent').rev + 24 + (rows * 16) + 'px'});
	
	// copy from thickbox.js line 285ff
	var isIE6 = typeof document.body.style.maxHeight === "undefined";
	jQuery("#TB_window").css({marginLeft: '-' + parseInt(($('TB_iframeContent').getWidth() / 2) + 1,10) + 'px', width: $('TB_iframeContent').getWidth() + 'px'});
	if ( ! isIE6 ) { // take away IE6
		jQuery("#TB_window").css({marginTop: '-' + parseInt(($('TB_iframeContent').getHeight() / 2),10) + 'px'});
	} 
}
