function is_integer(value)
{
	for (i=0;i<value.length;i++)
	{
		if (value[i]<'0' || value[i]>'9')
		{
			return false;
		}
	}
	return true;
}
function echeck(str) 
{
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1)
	{
	   return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
	{
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
	{
	    return false
	}

	 if (str.indexOf(at,(lat+1))!=-1)
	 {
	    return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
	 {
	    return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1)
	 {
	    return false
	 }
	
	 if (str.indexOf(" ")!=-1)
	 {
	    return false
	 }
	 return true					
}

function slideShow(mounted, prev)
{
	current=(prev+1) % mounted.length
	client=document.getElementById('client');
	//judet=document.getElementById('judet');
	localitate=document.getElementById('localitate');
	system=document.getElementById('system');
	photo=document.getElementById('photo');
	link=document.getElementById('link');
	
	client.innerHTML=mounted[current][0];
	//judet.innerHTML=mounted[current][1];
	localitate.innerHTML=mounted[current][2]+" / "+mounted[current][1];
	system.innerHTML=mounted[current][3];
	photo.src="img_gd.php?img_path=upl/mounted_system/"+mounted[current][4]+"&img_op=2&to_w=115&to_h=105";
	link.href="detalii_sistem_montat.php?id="+mounted[current][5];
	setTimeout("slideShow(mounted, current)", slideInterval);
}

function toogle(id, ids)
{
	obj=document.getElementById(id);
	if (obj.style.display!="block")
	{
		hideAll(ids)
		obj.style.display="block";
	}
	else obj.style.display="none";
}

function showAll(isd)
{
	for (i=0;i<ids.length;i++)
	{
		document.getElementById(ids[i]).style.display="block";
	}
}
function hideAll(isd)
{
	for (i=0;i<ids.length;i++)
	{
		document.getElementById(ids[i]).style.display="none";
	}
}


function validate_contact()
{
	if (document.contact.name.value=="")
	{
		alert("Introduceti numele");
		document.contact.name.focus();
		return false;
	}
	if (document.contact.firm.value=="")
	{
		alert("Introduceti numele firmei");
		document.contact.firm.focus();
		return false;
	}
	if (document.contact.city.value=="")
	{
		alert("Introduceti orasul");
		document.contact.city.focus();
		return false;
	}
	if (document.contact.county.selectedIndex==0)
	{
		alert("Selectati judetul");
		document.contact.county.focus();
		return false;
	}
	if (document.contact.email.value!="" && !echeck(document.contact.email.value))
	{
		alert("Adresa de email nu este valida");
		document.contact.email.focus();
		return false;
	}
	if (document.contact.message.value=="")
	{
		alert("Introduceti mesajul dumneavoastra");
		document.contact.message.focus();
		return false;
	}
	return confirm('Confirmati trimiterea datelor');
}
