function removeSpecialChars(input){
	input =  input.replace(/[^a-zA-Z 0-9]+/g,'');
	return input;
}

function cleanTextArea(){
	var x = document.getElementsByTagName('textarea');
	var tareacount=0;
	while(tareacount!=x.length){
		if(x[tareacount].value == 'Enter free text here'){
			x[tareacount].value='';
		}
		tareacount++;
	}
}


function isNumber(elem){
	var str = elem.value;
	if (isNaN(str)){
		return true;
	} else {
		return false;
	}
}


function replaceAt(item, before, after){
item.href = 'mailto:'+ before + 'ATOBJECT' + after;
item.href = item.href.replace(/ATOBJECT/,'@');
}



function setSlides(){
var myTransition = new Fx.Transition(Fx.Transitions.Quad.easeOut, 3);
$ES('img.hide_group').each(function(el){
	var div = el.getParent().getParent().getParent().getParent().getParent().getParent();
	var holder = div.getElement('div[class=surveyHolder]'); 
	var acccerSlide = new Fx.Slide(holder.id, {duration: 500, transition: myTransition, wait: false});
	el.addEvent('click', function(e){
		acccerSlide.toggle();
		new Event(e).stop().preventDefault();
	});
	holder.getParent().setStyle('overflow-x','auto');
	
});

$ES('img.hide_filter').each(function(el){
var acccerSlide2 = new Fx.Slide('hide_fieldset', {duration: 500, transition: myTransition, wait: false});
el.addEvent('click', function(e){
acccerSlide2.toggle();
new Event(e).stop().preventDefault();
});
});

/**
	 * The tooltips.
	 * Usage: Add class 'show-tooltip' to the tooltip and add title 'title::content' and it should work!
	 */
	var myTips = new Tips($$('.show-tooltip'), {
		timeOut: 200,
		maxTitleChars: 100,
		maxOpacity: .9,
	    initialize: function(){
	        this.fx = new Fx.Style(this.toolTip, 'opacity', {wait: false, transition: myTransition}).set(0); // Create the effect.
	    },
	    onHide: function(){
	        this.fx.start(0); // Go to 0 using the transition.
	    },
	    onShow: function(){
	        this.fx.start(1); // Go to 1 using the transition.
	    }
	});

}


function setTooltips(){
var myTransition = new Fx.Transition(Fx.Transitions.Quad.easeOut, 3);

/**
	 * The tooltips.
	 * Usage: Add class 'show-tooltip' to the tooltip and add title 'title::content' and it should work!
	 */
	var myTips = new Tips($$('.show-tooltip'), {
		timeOut: 200,
		maxTitleChars: 100,
		maxOpacity: .9,
	    initialize: function(){
	        this.fx = new Fx.Style(this.toolTip, 'opacity', {wait: false, transition: myTransition}).set(0); // Create the effect.
	    },
	    onHide: function(){
	        this.fx.start(0); // Go to 0 using the transition.
	    },
	    onShow: function(){
	        this.fx.start(1); // Go to 1 using the transition.
	    }
	});

}
