//----------------------------------------------------------------------------- 
//----------------------------------------------------------------------------- 
		$(document).ready(function(){
	
			$("#bannslide div[class='bnojs']").removeClass();
			
			try
			{
				$("#bannslide").slideshow({
					pauseSeconds: 25,
					height: 250,
					width: 815
				});		
			}catch(err)
			{
				// catch any error
			}
	
			$("#gallery1 a[class=show_img_a]").lightBox();
		});
//----------------------------------------------------------------------------- 
//----------------------------------------------------------------------------- 
	function validate_mail()
	{
		name = $('#c_name').val();
		mail = $('#c_mail').val();
		text = $('#c_text').val();
		
		mailreg = "^[0-9a-zA-Z]+([.-]?[0-9a-zA-Z]+)*@[0-9a-zA-Z]+([-]?[0-9,a-z,A-Z])*([.]{1}[0-9a-zA-Z]+([-]?[0-9,a-z,A-Z]+)*)*([.]{1}[a-zA-Z0-9]{2,3})+$";
		textreg = "^[^\\#]+$";
		tex0reg = "^[^\\#]+$";

		name = name.replace("\\",'');
		name = name.replace("\#",'');

		text = text.replace("\\",'');
		text = text.replace("\#",'');

		var regmail = new RegExp(mailreg);  
		var regtext = new RegExp(textreg);  
		var regtex0 = new RegExp(tex0reg);  

		if (!regtext.exec(name)){
			return 1;
		}
		
		if (!regmail.exec(mail)){
			return 2;
		}
		
		if (!regtext.exec(text)){
			return 4;
		}
		
		return 5;		
	}
	function send_contact_mail(noname, badmail, notext, mailsent)
	{
		switch(validate_mail())
		{
		case 1:
		  	alert(noname);
		  	break;
		case 2:
		  	alert(badmail);
		  	break;
		case 4:
		  	alert(notext);
		  	break;
		default:
			loadRun("actions.php?contactm=1&amp;n="+name+"&amp;m="+mail+"&amp;t="+text);
		  	alert(mailsent);
			location.reload(true);
		}
	}
//----------------------------------------------------------------------------- 
//----------------------------------------------------------------------------- 
	function valid_reg()
	{
		// --- name
		id = 'fname';
		text = $('#'+id).val();
		text = text.replace("\\",'');
		text = text.replace("\#",'');

		textreg = "[^\\\\#]{3,100}";  // least 3 char max 100
		var regtext = new RegExp(textreg);  

		if (!regtext.exec(text)){
			el = document.getElementById(id);
			el.select();
			el.focus();
			$('#'+id).css({borderColor:'#ff0000'});
			alert('Numele firmei trebuie sa contina cel putin 3 caractere si nu poate contine caractere speciale.');
			return false;
		}else{
			$('#'+id).css({borderColor:'#666666 #CCCCCC #CCCCCC #666666'});
		}
		
		// --- cui
		id = 'cui';
		text = $('#'+id).val();
		text = text.replace("\\",'');
		text = text.replace("\#",'');

		textreg = "[^\\\\#]{1,25}";  // least 1 char 
		var regtext = new RegExp(textreg);  

		if (!regtext.exec(text)){
			el = document.getElementById(id);
			el.select();
			el.focus();
			$('#'+id).css({borderColor:'#ff0000'});
			alert('Va rog sa completati campul cu C.U.I.');
			return false;
		}else{
			$('#'+id).css({borderColor:'#666666 #CCCCCC #CCCCCC #666666'});
		}

		
		// --- regnr
		id = 'regnr';
		text = $('#'+id).val();
		text = text.replace("\\",'');
		text = text.replace("\#",'');

		textreg = "[^\\\\#]{1,25}";  // least 1 char 
		var regtext = new RegExp(textreg);  

		if (!regtext.exec(text)){
			el = document.getElementById(id);
			el.select();
			el.focus();
			$('#'+id).css({borderColor:'#ff0000'});
			alert('Va rog sa completati campul cu Nr. reg. com.');
			return false;
		}else{
			$('#'+id).css({borderColor:'#666666 #CCCCCC #CCCCCC #666666'});
		}

		
		// --- uname
		id = 'uname';
		text = $('#'+id).val();
		text = text.replace("\\",'');
		text = text.replace("\#",'');
		uname = text;
		textreg = "^[0-9a-zA-Z]+([.-]?[0-9a-zA-Z]+)*@[0-9a-zA-Z]+([-]?[0-9,a-z,A-Z])*([.]{1}[0-9a-zA-Z]+([-]?[0-9,a-z,A-Z]+)*)*([.]{1}[a-zA-Z0-9]{2,3})+$";  // mail 
		var regtext = new RegExp(textreg);  

		if (!regtext.exec(text)){
			el = document.getElementById(id);
			el.select();
			el.focus();
			$('#'+id).css({borderColor:'#ff0000'});
			alert('E-mail invalid!');
			return false;
		}else{
			$('#'+id).css({borderColor:'#666666 #CCCCCC #CCCCCC #666666'});
		}

		
		// --- cuname
		id = 'cuname';
		text = $('#'+id).val();
		text = text.replace("\\",'');
		text = text.replace("\#",'');
		if (uname != text){
			el = document.getElementById(id);
			el.select();
			el.focus();
			$('#'+id).css({borderColor:'#ff0000'});
			alert('Eroare la confirmare adresa e-mail!');
			return false;
		}else{
			$('#'+id).css({borderColor:'#666666 #CCCCCC #CCCCCC #666666'});
		}

		
		// --- pxord
		id = 'pxord';
		text = $('#'+id).val();
		pxord = text;
		textreg = ".{6,40}";  // pass 
		var regtext = new RegExp(textreg);  

		if (!regtext.exec(text)){
			el = document.getElementById(id);
			el.select();
			el.focus();
			$('#'+id).css({borderColor:'#ff0000'});
			alert('Parola trebuie sa contina cel putin 6 caractere');
			return false;
		}else{
			$('#'+id).css({borderColor:'#666666 #CCCCCC #CCCCCC #666666'});
		}


		// --- cpxord
		id = 'cpxord';
		text = $('#'+id).val();
		if (pxord != text){
			el = document.getElementById(id);
			el.select();
			el.focus();
			$('#'+id).css({borderColor:'#ff0000'});
			alert('Ati introdus parole diferite');
			return false;
		}else{
			$('#'+id).css({borderColor:'#666666 #CCCCCC #CCCCCC #666666'});
		}


		// --- chcod
		id = 'chcod';
		text = $('#'+id).val();
		text = text.replace("\\",'');
		text = text.replace("\#",'');
		textreg = "[^\\\\#]{4}";  // security code 
		var regtext = new RegExp(textreg);  

		if (!regtext.exec(text)){
			el = document.getElementById(id);
			el.select();
			el.focus();
			$('#'+id).css({borderColor:'#ff0000'});
			alert('Va rog sa introduceti codul din imagine');
			return false;
		}else{
			$('#'+id).css({borderColor:'#666666 #CCCCCC #CCCCCC #666666'});
		}

		
		return true;		
	}
//======================================================================================================================================== resetpass click
function resetpassClick()
{
	var usermail = document.getElementById('imp_login_user').value;
	if (rtest(usermail,'^[0-9a-zA-Z]+([.-]?[0-9a-zA-Z]+)*@[0-9a-zA-Z]+([-]?[0-9,a-z,A-Z])*([.]{1}[0-9a-zA-Z]+([-]?[0-9,a-z,A-Z]+)*)*([.]{1}[a-zA-Z0-9]{2,3})+$','i'))
	{
		answer = confirm(confirm_passreset)
		if (answer != 0)
		{
			window.xmlHttppassr=GetXmlHttpObject()
			function stateChanged() 
				{ 
					if (window.xmlHttppassr.readyState==4)
					{ 
						if (window.xmlHttppassr.responseText != 1)
						{
							alert(window.xmlHttppassr.responseText);
						}
					}
				}
			if (window.xmlHttppassr==null)
			  {
				  alert ("Your browser does not support AJAX!");
				  return;
			  } 
			window.xmlHttppassr.onreadystatechange=stateChanged;
			url = 'actions.php?reset='+md5(usermail);
			url = url.replace(/&amp;/g,'&');

			window.xmlHttppassr.open("GET",url,true);
			window.xmlHttppassr.send(null);
		}
	}else{
		alert(please_type_user);
	}
}
//=================================================================================
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
//============================= REGTEST ============
		function rtest(text,regex,op){
			
			var regz = new RegExp(regex,op); 
			if ( regz.exec(text)){
				return true;
			}else{ 
				return false;
			}	
		}

	
