 $(document).ready(function(){
 
  // Add Scroller Object
  $jScroller.add("#scroller_container","#scroller","left",8,"true");
  $jScroller.add("#scroller_container1","#scroller1","up",8);
  // Start Autoscroller
  $jScroller.start();
  // fader heaer
  putImg(0);
 });
 
 
var imgArray = new Array();
var arrayKey;
 
imgArray[0]="img/header/1.jpg";
imgArray[1]="img/header/2.jpg";
imgArray[2]="img/header/3.jpg";
imgArray[3]="img/header/4.jpg";
imgArray[4]="img/header/5.jpg";
imgArray[5]="img/header/6.jpg";
imgArray[6]="img/header/7.jpg";
imgArray[7]="img/header/8.jpg";

 

function putImg(arrayKey) {
	imgString='<img src="'+imgArray[arrayKey]+'"/>';
	$(".flash_header").html(imgString); // incarcare prima imagine
	setTimeout ('fader(0)', 2000 ); 
}

function fader (thisKey) {
	arrayKey = keys(thisKey);
	next(arrayKey)
	setTimeout("fader(arrayKey)",2500);
}

function keys (val) {
	newVal = val+1;
	if (newVal == 8) newVal = 0;

return newVal;	
}

function next(nextKey) {
	$('.flash_header > img').fadeOut("slow",function() {
		$(".flash_header").html('<img src="'+imgArray[nextKey]+'"/>');
		$(".flash_header > img").fadeIn("slow");
	})
}


 
function showMenu(uniqueID) {
	document.getElementById("side"+uniqueID).style.display = "block";
	document.getElementById("side"+uniqueID).style.bgColor ="#999";
}
function hideMenu(uniqueID) {
	document.getElementById("side"+uniqueID).style.display = "none";
}

function F_mail() {
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
	
	if (document.contact.nume.value=="") {
		alert ("Va rugam completati numele dumneavostra!");
		document.contact.nume.focus();
		return false;
	}
	if (document.contact.mail.value=="") {
		alert ("Va rugam completati adresa dumneavostra de e-mail!");
		document.contact.mail.focus();
		return false;
	}
	
	if(!filter.test(document.contact.mail.value)){
		alert("Adresa de e-mail nu este valida!")
		document.contact.mail.focus()
		return false
	}
	
	if(document.contact.mesaj.value == ''){
		alert("Va rugam completati mesajul");
		document.contact.mesaj.focus();
		return false;
	}
	
	else return true;
}

