/** AutoClear for Search Form */
$(document).ready( function(){
	autoFill($("#name"), "Your name");
});

function autoFill(id, v){
	$(id).css({ }).attr({ value: v }).focus(function(){
		if($(this).val()==v){
			$(this).val("").css({ });
		}
	}).blur(function(){
		if($(this).val()==""){
			$(this).css({ }).val(v);
		}
	});
	
}

/** Remove elements from DOM */
$(document).ready( function(){
	$('.linklove').remove(); /* cforms link */
	$('.reqtxt').remove();
	$('.emailreqtxt').remove();
});

// jFav, JQuery plugin
// v 1.0 
// SAFARI & CHROME not Supported!
// Licensed under GPL licenses.
// Copyright (C) 2008 Nikos "DuMmWiaM" Kontis, info@dummwiam.com
// http://www.DuMmWiaM.com/EffectChain
// ----------------------------------------------------------------------------

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(7($){$.8.9=7(d){g e=$.v({},$.8.9.k,d);g f=e.l;2.w(7(){5(!$(2).3(\'4\')||$(2).3(\'4\')=="#"){$(2).3(\'4\',j.x.4)}5(!$(2).3(\'6\')){$(2).3(\'6\',y.6)}5($.h.z){$(2).3(\'m\',$(2).3(\'4\')).3(\'4\',\'\').3(\'4\',\'A:B(0)\').3(\'C\',\'$.8.9.n(2,"\'+$(2).3(\'6\')+\'","\'+$(2).3(\'m\')+\'")\')}i{$(2).o(p)}});7 p(a){g b=$(2).3(\'4\');g c=$(2).3(\'6\');b=b.E("q:///","F://q/");5($.h.G){j.H.I(b,c)}i 5($.h.J){j.r.K(c,b,\'\')}i 5(L.M.N().O(\'P\')>-1){s(f)}i 5($.h.Q){s(f)}a.R()};t 2};$.8.9.k={l:\'S "T + D" U "V + D" W X, u Y 2 Z u 10 11.\'};$.8.9.n=7(e,a,b){e.12="r";e.6=a;e.4="";e.4=b;e.o();t 13}})(14);',62,67,'||this|attr|href|if|title|function|fn|jFav|||||||var|browser|else|window|defaults|msg|link|OperaBookmark|click|addToFavorites|file|sidebar|alert|return|to|extend|each|location|document|opera|javascript|void|onClick||replace|http|msie|external|AddFavorite|mozilla|addPanel|navigator|userAgent|toLowerCase|indexOf|chrome|safari|preventDefault|Press|Ctrl|or|CMD|for|MAC|add|page|your|bookmarks|rel|false|jQuery'.split('|'),0,{}))


/** Sharing links ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/


$(document).ready(function() {
	$('#sharing-links').prepend('<ul><li id="bookmark"><a href='+ location.href +'>Bookmark this page</a></li><li id="email"><a href="#">Email this page</a></li><li id="print"><a href="#">Print this page</a></li></ul>');
});
$(document).ready(function() {
	$('#sharing-links ul li#print a').click(function() {
		window.print();
		return false;
	});
});
$(document).ready(function() {
	$('#sharing-links ul li#email a').click(function() {
		mail_str = "mailto:?subject=Fabricom GDF SUEZ - page recommendation";
		mail_str += "&body=I thought you might be interested in the following page on the Fabricom GDF SUEZ website : " + location.href;
		location.href = mail_str;
		return false;
	});
});
$(document).ready(function() {
	$('#sharing-links ul li#bookmark a').jFav();
		return false;
});


/** Add hover class to nav for IE7 to fix dropdown menu 

$(document).ready(function(){
	$('#navigation ul li').mouseover(function() {
			$(this).addClass('hovered');
		}).mouseout(function() {
			$(this).removeClass('hovered')
		});
});
$(document).ready(function(){
	anchor.onfocus = function() { tabOn(this.parentNode); }
	anchor.onblur = function() { tabOff(this.parentNode); }
	function tabOn(li) {
		if(li.nodeName == 'LI') {
			li.className = addClass(li);
			tabOn(li.parentNode.parentNode);
		}
	}
	
	function tabOff(li) {
		if(li.nodeName == 'LI') {
			li.className = removeClass(li);
			tabOff(li.parentNode.parentNode);
		}
	}
}); */

/** Index highlighting */
$(document).ready(function(){
	$('ul.index li a').mouseover(function() {
			$(this).parents('li:eq(0)').addClass('focus');
		}).mouseout(function() {
			$(this).parents('li:eq(0)').removeClass('focus')
		});
});

/** Contact map highlighting */
$(document).ready(function(){
	$('ul.rollovers li a').mouseover(function() {
		var region = $(this).parents('li:eq(0)').attr("class"); 
		$("ul.contact-cards li." + region).addClass("focus");
	}).mouseout(function() {
			$("ul.contact-cards li").removeClass('focus');
		});
	$('ul.contact-cards li').each(function() {
		if ($(this).attr("class") != '') {
			$(this).mouseover(function() {
				var region2 = $(this).attr("class"); 
				$(this).addClass("focus");
				$("ul.rollovers li." + region2 + " a").addClass("focus");
			}).mouseout(function() {
				$("ul.contact-cards li").removeClass('focus');
				$("ul.rollovers li a").removeClass("focus");
			});
		}
	});
});

/** Form highlighting */
$(document).ready(function(){
	$("form input").focus(function() {
		$(this).parents('li:eq(0)').addClass("focus");
	});
	$("form input").blur(function() {
		$(this).parents('li:eq(0)').removeClass("focus");
	});
	$("form textarea").focus(function() {
		$(this).parents('li:eq(0)').addClass("focus");
	});
	$("form textarea").blur(function() {
		$(this).parents('li:eq(0)').removeClass("focus");
	});
	$("form select").focus(function() {
		$(this).parents('li:eq(0)').addClass("focus");
	});
	$("form select").blur(function() {
		$(this).parents('li:eq(0)').removeClass("focus");
	});
});

/** Contact map highlighting */
$(document).ready(function(){
	$('#sendbutton').mouseover(function() {
		$(this).addClass("focus");
	}).mouseout(function() {
			$(this).removeClass("focus");
		});
});

/** Add classes to form elements */
$(document).ready(function(){
  $('input[type="text"]').parents('li:eq(0)').addClass("text");
  $('input[type="password"]').parents('li:eq(0)').addClass("password");
  $('input[type="checkbox"]').parents('li:eq(0)').addClass('checkbox');
  $('input[type="radio"]').parents('li:eq(0)').addClass('radio');
  $('input[type="submit"]').parents('li:eq(0)').addClass('submit');
  $('input[type="hidden"]').parents('li:eq(0)').addClass('hidden');
});

/** share buttons */
$(document).ready(function(){
	$(".sharelinks a").click(function() {
		window.open($(this).attr("href"),$(this).attr("rel"),'toolbar=0,status=0,width=626,height=436');
		return false;								  
	});
});
