
function setInputHint() {
	//$('.formInput').focus(function() {
	//	$(this).addClass('highlight');
	//}).blur( function() {
	//	$(this).removeClass('highlight');
	//});
	$('input:text').hint();
}

function setHighlight() {
	$('.inputForm, textarea, select').css('border', '1px solid #999');
	$('.inputForm, textarea, select').focus(function(){
		$(this).css('border', '1px solid #EE9B00').css('background', '#fffff0');
	});
	$('.inputForm, textarea, select').blur(function(){
		$(this).css('border', '1px solid #999').css('background', '#fff');
	});
	//alert('op');
}

function doJson( json ) {
  // handle the json object here
}

function DoAction(gadget, target, task) {
	var strLocation = document.location + "";

	var url = 'index2.php?gadget=' + gadget + '&action=' + task;
	var imagepath = 'images/ajax-loader.gif';
	if ((strLocation.indexOf('/admin/') > 0) || (strLocation.indexOf('/reps/') > 0))
	{
		imagepath = "../" + imagepath;
	}

	$(target).html("<center><img src='"+imagepath+"'></center>").load(url);
}//function DoAction(gadget, target, task) {

function DoAction2(gadget, target, task) {
	var strLocation = document.location + "";

	var url = 'index2.php?gadget=' + gadget + '&action=' + task;
	$(target).load(url);

}

//load the script when the DOM is ready
$(document).ready(function() {

	$('a').click(function() {
		this.blur();
	});

	$('.topMenuLink').hover(function() {
		$(this).addClass('topMenu-pretty-hover');
	}, function() {
		$(this).removeClass('topMenu-pretty-hover');
	});

	setHighlight();
	$('input:text').hint();
});


jQuery.fn.hint = function() {
	return this.each(function(){
		var t = $(this); // get jQuery version of 'this'
		var title = t.attr('title'); // get it once since it won't change

		if (title) { // only apply logic if the element has the attribute

			// on focus, set value to blank if current value matches title attr
			t.focus(function(){
				if (t.val() == title) {
				  t.val('');
				  t.removeClass('blur');
				}
			})

			// on blur, set value to title attr if text is blank
			t.blur(function(){
				if (t.val() == '') {
				  t.val(title);
				  t.addClass('blur');
				}
			})

			// now change all inputs to title
			t.blur();
		}
	})
}






//Advanced Email Check credit-
//By JavaScript Kit (http://www.javascriptkit.com)
//Over 200+ free scripts here!

var testresults
function checkemail(This){
	var str=This.value; //document.validation.emailcheck.value
	var filter=/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i
	if (filter.test(str))
		testresults=true
	else{
		//alert("Veuillez entrer un email address valide!")
		testresults=false
	}
	return (testresults)
}

function checkValidEmail(This){
	if (document.layers||document.getElementById||document.all)
		return checkemail(This)
	else
		return true
}



