var FULLURL = 'http://www.livemedia.ro/';

// Scroll
var cursor = 0;
var viteza = 15;
var timeID;
var scrol = {
	stanga: function(id) {
		cursor = (cursor - viteza)<0 ? 0 : (cursor-viteza);
		$(id).scrollLeft = cursor;
		timeID = setTimeout("scrol.stanga('"+id+"')", 60);
	},
	dreapta: function(id) {
		cursor += viteza;
		$(id).scrollLeft = cursor;
		timeID = setTimeout("scrol.dreapta('"+id+"')", 60);
	},
	restart: function() {
		clearTimeout(timeID);	
	}
}

function gotoImage(idd) {
	var agt = navigator.userAgent.toLowerCase();
	var val = 0;
	if(agt.indexOf("msie") != -1) {
		val = $(idd).offsetLeft - 13;
	} else {
		val = $(idd).x;
	}
	//alert(val);
	$("zonaDeScroll").scrollLeft = (val);
	scrol.restart();
	cursor = val;
}


function goTop() {
	new Effect.ScrollTo('header');
}

function clearFiled(id) {
	$(id).value = "";
}

function sendNewsletter() {
	var a = $('nl').value;
	var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
	if(a != "" && a != "adresa e-mail") {
		if(document.newsletterForm.newsletter_email.value.search(emailRegEx) == -1) {
			alert("Adresa de email invalida!");
			$('nl').value = "";
		}
		else {
			alert("Te-ai abonat.");
			document.newsletterForm.submit();
		}
	} else {
		alert("Completeaza cu adresa ta de email.");
		$('nl').value = "adresa e-mail";
	}
}

function showPozaMare(id, source) {
	$('pozaMareSrc'+id).src = FULLURL + source;
	
	if($('pozaMare'+id).style.display != "")
		new Effect.SlideDown('pozaMare'+id, {duration:0.7});
}
function hidePozaMare(id) {
	new Effect.SlideUp('pozaMare'+id, {duration:0.7});
}

var unde = 'fc';
function showDFCF() {
	if(unde == 'fc') {
		$("formularContact").style.display = "none";
		$("dateleFirmei").style.display = "block";
		$("dfcf").value = "Formular de contact";
		unde = "df";
	} else {
		$("formularContact").style.display = "block";
		$("dateleFirmei").style.display = "none";
		$("dfcf").value = "Datele firmei";
		unde = "fc";
	}
}

function showFtpInfo() {
	msg = "Date de conectare la FTP\n\n";
	msg += "ftp://liveprints.ro/\n";
	msg += "Username: client\n";
	msg += "Parola: live";
	if(confirm(msg)) {
		w = window.open('ftp://liveprints.ro/', 'FTP', 'status=0,toolbar=0,menubar=0,scrollbars=0,width=600,height=400,resizable=1');
		w.focus();
	}
}

var eff = {
	toggleSlide: function(id) {
		new Effect.toggle(id, "slide", {duration:1});
	},
	toggleAppear: function(id) {
		new Effect.toggle(id, "appear", {duration:1});
	},
	toggleAppear2: function(id) {
		var elms = $("serviciiOutdoorBody").getElementsByClassName("pozaMare");
		for(var i=0; i<elms.length; i++) {
			div = elms[i].id;
			if(div != "" && $(div).style.display == "") {
				new Effect.SlideUp(div, {duration:0.7});
				break;
			}
		}
		new Effect.toggle(id, "appear", {duration:1});
	}
}

