(function($){
			
$(document).ready(function() {
	 
	 Cufon.replace('#hmenu ul li a');
	 Cufon.replace('#hmenu ul li a.sel');
	 
	 Cufon.replace('h2:not(.sitemap)');
	 
	 Cufon.replace('#hp2 #cp span');
	 Cufon.replace('#hp2 #cp h1');
	 
	 Cufon.replace('#testimonials div span');
	 Cufon.replace('#testimonials div blockquote');
	 
	 $('#menu li:has(ul)').hover(
		function(){
			$(this).css('background-color', '#177AC0');
		},
		function(){
			$(this).css('background-color', '');
		}
	);
	
	$('#menu li ul li:not(.blue)').hover(
		function(){
			$(this).css('background-color', '#8e9fbd');
		},
		function(){
			$(this).css('background-color', '#e2e7f5');	
		}
	);
	
	 $('#menu li:has(ul)').hover(
		function(){
			tempH=($('ul li',this).size()-1)*30+2;
			$('ul li.blue',this).css('height',tempH-40+'px');
			//$('ul',this).stop().animate({height:tempH+'px'},400);
			$('ul',this).css('height',tempH+'px');
		},
		function(){
			//$('ul',this).stop().animate({height:'0px'},400);
			$('ul',this).css('height','0px');
		}
	);
	 
	 /* INPUT RESET */
	 $('input:text').each(function(){
	  tempform='';
	  $(this).focus(function()
	  {
	  		if($(this).val()==$(this).attr('title')){tempform = $(this).val();$(this).val('');}
	  		if ($(this).hasClass('contact')) $(this).css('background','#e2e7f5');
	  		if ($(this).hasClass('search')) $(this).css('color','#999999');
	  }
	  				);
	  $(this).blur(function()
	  	{
	  		if($(this).val()==''){$(this).val(tempform);}
	  		if ($(this).hasClass('contact')) $(this).css('background','#ffffff');
	  	}
	  				);
	 });
	$('textarea.contact').each(function(){
	  tempform='';
	  $(this).focus(function()
	  {
	  		$(this).css('background','#e2e7f5');
	  }
	  				);
	  $(this).blur(function()
	  	{
	  		$(this).css('background','#ffffff');
	  	}
	  				);
	 });
	 
	 /* fancybox */
	 $("a.inline").fancybox({ 
	 	'frameWidth' :720,
	 	'frameHeight' :410,
	 	'zoomSpeedIn': 300, 
	 	'zoomSpeedOut': 300,
	 	'overlayOpacity': 0.7,
	 	'overlayColor': '#000000',
	 	'overlayShow': true,
	 	'hideOnContentClick': true,
	 	'centerOnScroll': false
	 }); 
	 
	 $("a.big-deal").fancybox({ 
	 	'frameWidth' :565,
	 	'frameHeight' :400,
	 	'zoomSpeedIn': 300, 
	 	'zoomSpeedOut': 300, 
	 	'padding': 0,
	 	'overlayShow': true,
	 	'overlayOpacity': 0.7,
	 	'overlayColor': '#000000',
	 	'hideOnContentClick': true,
	 	'centerOnScroll': false
	 }); 
	 
	 
	 $("a").filter(function() {
        return this.hostname && this.hostname !== location.hostname;
    }).attr('target', '_blank');

	
});

})(jQuery);

var letters = /([a-zA-Z]+)$/;
var numbers = /([0-9+]+)$/;
var email = /^[^@]+@[^@.]+\.[^@]*\w\w$/;
var email2 = /^[A-Za-z][\w.-]+@\w[\w.-]+\.[\w.-]*[A-Za-z][A-Za-z]$/;

function validateEmail( tfld )
{

    if ((!email.test(tfld)) || (!email2.test(tfld)))
        return false;
    return true;
}

function search_ro(f)
{
	if ((f.qs.value=='')||(f.qs.value=='Cauta pe site')||(f.qs.value=='Introduceti termenul cautat!'))
	{
		f.qs.style.color="#F78484";
		f.qs.value="Introduceti termenul cautat!";
		f.qs.title="Introduceti termenul cautat!";
		return false;
	}
	return true;
}

function search_en(f)
{
	if ((f.qs.value=='')||(f.qs.value=='Search the website')||(f.qs.value=='Please insert a search term!'))
	{
		f.qs.style.color="#F78484";
		f.qs.value="Please insert a search term!";
		f.qs.title="Please insert a search term!";
		return false;
	}
	return true;
}

function contact_ro(f)
{
	error=0;
	
	if (f.surname.value=='')
	{
		f.surname.style.backgroundColor="#F78484";
		document.getElementById("surname").innerHTML="Introduceti prenumele!";
		error=1;
	}
	else if (!letters.test(f.surname.value))
	{
		f.surname.style.backgroundColor="#F78484";
		document.getElementById("surname").innerHTML="Introduceti numai litere!";
		error=1;
	}
	else
	{
		f.surname.style.backgroundColor="#f6f6ec";
		document.getElementById("surname").innerHTML="";
	}
	
	if (f.name.value=='')
	{
		f.name.style.backgroundColor="#F78484";
		document.getElementById("name").innerHTML="Introduceti numele!";
		error=1;
	}
	else if (!letters.test(f.name.value))
	{
		f.name.style.backgroundColor="#F78484";
		document.getElementById("name").innerHTML="Introduceti numai litere!";
		error=1;
	}
	else
	{
		f.name.style.backgroundColor="#f6f6ec";
		document.getElementById("name").innerHTML="";
	}
	
	if (f.email.value=='')
	{
		f.email.style.backgroundColor="#F78484";
		document.getElementById("email").innerHTML="Introduceti adresa de e-mail!";
		error=1;
	}
	else if (validateEmail(f.email.value)==false){
		f.email.style.backgroundColor="#F78484";
		document.getElementById("email").innerHTML="Introduceti o adresa e-mail valida!";
		error=1;
	}
	else
	{
		f.email.style.backgroundColor="#f6f6ec";
		document.getElementById("email").innerHTML="";
	}
	
	if (f.phone.value=='')
	{
		f.phone.style.backgroundColor="#F78484";
		document.getElementById("phone").innerHTML="Introduceti numarul de telefon!";
		error=1;
	}
	else if (!numbers.test(f.phone.value))
	{
		f.phone.style.backgroundColor="#F78484";
		document.getElementById("phone").innerHTML="Introduceti numai cifre!";
		error=1;
	}
	else
	{
		f.phone.style.backgroundColor="#f6f6ec";
		document.getElementById("phone").innerHTML="";
	}
	
	if (f.location.value=='')
	{
		f.location.style.backgroundColor="#F78484";
		document.getElementById("location").innerHTML="Introduceti localitatea!";
		error=1;
	}
	else
	{
		f.location.style.backgroundColor="#f6f6ec";
		document.getElementById("location").innerHTML="";
	}
	
	if (f.message.value=='')
	{
		f.message.style.backgroundColor="#F78484";
		document.getElementById("message").innerHTML="Introduceti mesajul!";
		error=1;
	}
	else
	{
		f.message.style.backgroundColor="#f6f6ec";
		document.getElementById("message").innerHTML="";
	}
	
	if (error==1)
		return false;
	return true;
}

function contact_en(f)
{
	error=0;
	
	if (f.surname.value=='')
	{
		f.surname.style.backgroundColor="#F78484";
		document.getElementById("surname").innerHTML="Insert surname!";
		error=1;
	}
	else if (!letters.test(f.surname.value))
	{
		f.surname.style.backgroundColor="#F78484";
		document.getElementById("surname").innerHTML="Insert only letters!";
		error=1;
	}
	else
	{
		f.surname.style.backgroundColor="#f6f6ec";
		document.getElementById("surname").innerHTML="";
	}
	
	if (f.name.value=='')
	{
		f.name.style.backgroundColor="#F78484";
		document.getElementById("name").innerHTML="Insert name!";
		error=1;
	}
	else if (!letters.test(f.name.value))
	{
		f.name.style.backgroundColor="#F78484";
		document.getElementById("name").innerHTML="Insert only letters!";
		error=1;
	}
	else
	{
		f.name.style.backgroundColor="#f6f6ec";
		document.getElementById("name").innerHTML="";
	}
	
	if (f.email.value=='')
	{
		f.email.style.backgroundColor="#F78484";
		document.getElementById("email").innerHTML="Insert e-mail address!";
		error=1;
	}
	else if (validateEmail(f.email.value)==false){
		f.email.style.backgroundColor="#F78484";
		document.getElementById("email").innerHTML="Insert a valid e-mail address!";
		error=1;
	}
	else
	{
		f.email.style.backgroundColor="#f6f6ec";
		document.getElementById("email").innerHTML="";
	}
	
	if (f.phone.value=='')
	{
		f.phone.style.backgroundColor="#F78484";
		document.getElementById("phone").innerHTML="Insert phone number!";
		error=1;
	}
	else if (!numbers.test(f.phone.value))
	{
		f.phone.style.backgroundColor="#F78484";
		document.getElementById("phone").innerHTML="Insert only digits!";
		error=1;
	}
	else
	{
		f.phone.style.backgroundColor="#f6f6ec";
		document.getElementById("phone").innerHTML="";
	}
	
	if (f.location.value=='')
	{
		f.location.style.backgroundColor="#F78484";
		document.getElementById("location").innerHTML="Insert location!";
		error=1;
	}
	else
	{
		f.location.style.backgroundColor="#f6f6ec";
		document.getElementById("location").innerHTML="";
	}
	
	if (f.message.value=='')
	{
		f.message.style.backgroundColor="#F78484";
		document.getElementById("message").innerHTML="Insert your message!";
		error=1;
	}
	else
	{
		f.message.style.backgroundColor="#f6f6ec";
		document.getElementById("message").innerHTML="";
	}
	
	if (error==1)
		return false;
	return true;
}

function new_url(typ,val,y)
{
	loc = window.location.toString();
	loc = loc.split("/");
	
	cor = new Array();
	cor["expertise"] = 4;
	cor["industry"] = 5;
	cor["year"] = 6;
	loc[7] = "";
	
	loc[cor[typ]] = val;
	//if ((cor[typ] == 5)||(cor[typ] == 6)) if (!loc[4]) loc[4]="all";
	//if (cor[typ] ==6) if (!loc[5]) loc[5]="all";
	if (!loc[4]) loc[4]="all";
	if (!loc[5]) loc[5]="all";
	if ((!loc[6])&&(y)) loc[6]=y;
	
	loc = loc.join("/");
	
	loc = loc.replace("&","and");
	
	window.location=loc;
}
