function activatePlaceholders() {
	var detect = navigator.userAgent.toLowerCase(); 
	//if (detect.indexOf('safari') > 0) return false;
		//alert('kwa');
	var inputs = document.getElementsByTagName('input');
	//alert('sta');
	for (var i=0;i<inputs.length;i++) {
  		if (inputs[i].getAttribute('type') == 'text') {
   			if (inputs[i].getAttribute('placeholder') && inputs[i].getAttribute('placeholder').length > 0) {
    			inputs[i].value = inputs[i].getAttribute('placeholder');
    			inputs[i].onfocus = function() {
	    			$(this).css('color','#000000');
	     			if (this.value == this.getAttribute('placeholder')) {
		      			this.value = '';
		     		}
		     		return false;
	    		}
	    		inputs[i].onblur = function() {
		     		if (this.value.length < 1) {
		     			$(this).css('color','#999999');	
		      			this.value = this.getAttribute('placeholder');
		      			
		     		}
	    		}
   			}
  		}
	}  	
  	var texta = document.getElementsByTagName('textarea');
	//alert('sta');
	for (var i=0;i<texta.length;i++) {
		if (texta[i].getAttribute('placeholder') && texta[i].getAttribute('placeholder').length > 0) {
			texta[i].value = texta[i].getAttribute('placeholder');
			texta[i].onfocus = function() {
				$(this).css('color','#000000');
	 			if (this.value == this.getAttribute('placeholder')) {
	      			this.value = '';
	     		}
	     		return false;
			}
			texta[i].onblur = function() {
	     		if (this.value.length < 1) {
	     			$(this).css('color','#999999');	
	      			this.value = this.getAttribute('placeholder');
	      			
	     		}
			}
	  	}  	
	}
}
function toggleDisplayError(el_id,show,text){
	
	if (show == 1){
		
		
		if ($("#"+el_id).is(":hidden")){
			
			if (text != ''){
			
				$("#"+el_id).html(trans(text));
			
			}
			
			$("#"+el_id).fadeIn(500);
			
		} else {
			
			if (text != ''){
			
				$("#"+el_id).fadeOut(500, function (){
					
					$("#"+el_id).html(trans(text)).fadeIn(500);
					
				});
			
			} else {
				
				$("#"+el_id).fadeOut(500).fadeIn(500);
					
				
			}
			
			
		}
		
	} else {
		
		//if ($("#"+el_id).is(":hidden")){
			
		//} else {
			
			$("#"+el_id).fadeOut(500);
		
		//}
		
	}
}
function sendForm()
{
	if($("#yourname").val() == "" || $("#yourname").val() == $("#yourname").attr('placeholder')){
		//return_message = trans('please enter your name');
		toggleDisplayError('messages',1,trans('please enter your name'));
		return;
	} else {
		toggleDisplayError('messages',0,'');
	}
	
	if($("#youremail").val() == "" || $("#youremail").val() == $("#youremail").attr('placeholder')){
		toggleDisplayError('messages',1,trans('please enter your email'));
		return;
	} else {
		toggleDisplayError('messages',0,'');
	}
	
	message = checkEmailValidation($("#youremail").val());
	
	if(message != ""){
		toggleDisplayError('messages',1,trans('please enter a valid email'));
		return;
	} else {
		toggleDisplayError('messages',0,'');
	}
	
	if($("#yourmessage").val() == "" || $("#yourmessage").val() == $("#yourmessage").attr('placeholder')){
		toggleDisplayError('messages',1,trans('your message is empty'));
		return;
	} else {
		toggleDisplayError('messages',0,'');
	}
	
	$.post("/hardlab/web/contactus",$("#contactform").serialize(),function(data)
	{
		$("#contact_container").html(data);
		$(".thankyou").fadeIn(1000);
	});
}
