
function changeImage(id) {
	// change src
	try {
		newImage = document.getElementById(id).src.replace("thumb", "normal");
		document.getElementById(id).src = document.getElementById("big").src.replace("normal", "thumb");
		document.getElementById("big").src = newImage;
	}catch(e) {
		if(window.error_reporting) {
			alert('Error: ('+e+') in euroimobile.js line 12');
		}
	}
}
	
	
// VERIFICARE LUNGIME DESCRIERE
function checkDescrLength(nr) {
	try {
		length = nr;
		if (document.getElementById("descriere").value.length>length) {
			alert("Maximum lenght " + length + " characters");
		}
		document.getElementById("descriere").value = document.getElementById("descriere").value.substr(0,length);
	}catch(e) {
		if(window.error_reporting) {
			alert('Error: ('+e+') in euroimobile.js line 28');
		}
	}
}

if(typeof(window.onload)=='function') {
	try {
		var oldEvent = window.onload;
		window.onload = function() {
			oldEvent();
			initApplication();
		}
	}catch(e) {
		if(window.error_reporting) {
			alert('Error:'+e);
		}
	}
} else {
	window.onload = function() {
		initApplication();
	}
}

//$(document).ready(initApplication);

function initApplication () {
	
	try {
		$("#link-back").attr("href", "javascript:history.go(-1)");
		
		// SHOW TOGGLE LINK IF JS ENABLED
		$("#toggle-filter").css({"visibility":"visible", "display":"block"});
		$("#toggle-filter2").css({"visibility":"visible", "display":"block"});
		// HIDE PANEL IF JS ENABLED
		//$("#filterPanel").hide();
		// HIDE descr-selectie-locatie-fara-js IF JS ENABLED
		$("#descr-selectie-locatie-fara-js").hide();
		
		// TOGGLE FILTERS
		$("#toggle-filter").click(function() {
			$("#filterPanel").slideToggle(350);
		});
		$("#toggle-filter2").click(function() {
			$("#filterPanel2").slideToggle(350);
		});
	}catch(e) {
		if(window.error_reporting) {
			alert('Error: ('+e+') in euroimobile.js line 75');
		}
	}
	
	/*
	// RESET SEARCH KEYWORDS
	function reset_keywords(string) {
		if (document.getElementById("search-keywords").value==string) {
			document.getElementById("search-keywords").value='';
		}
	}
	
	
	// REDIRECT
	$("a[@rel='external']").click(function() {
		return !window.open($(this).attr("href"));
	});
	
	
	
	// LEGISTALIE
	$("#legislatie-ro").hide();
	$("#but-legislatie-ro").click(function() {
		$("#legislatie-hu").hide();
		$("#legislatie-sr").hide();
		$("#legislatie-ro").slideToggle(600);
	});
	
	$("#legislatie-sr").hide();
	$("#but-legislatie-sr").click(function() {
		$("#legislatie-hu").hide();
		$("#legislatie-ro").hide();
		$("#legislatie-sr").slideToggle(600);
	});
	
	$("#legislatie-hu").hide();
	$("#but-legislatie-hu").click(function() {
		$("#legislatie-ro").hide();
		$("#legislatie-sr").hide();
		$("#legislatie-hu").slideToggle(600);
	});
	
	
	
	// PRINT DECREMENT
	$("#but_print").click(function() {
		$.get("inc_proc/ads/decrement_print_credit.php");
	});
	
	
	// NOTIFICATIONS
	window.postNotification = function (post) {
		
		post.nume_notificare = $('#nume_notificare').val();
		
		$.post("inc_proc/ads/notifications_js.php",post,function(data){
			$('#notif_alert').html(data);
		});
		return false;
	}
	*/
	
	// BUTTONS
	/*
	$('.btn').each(function(){
		var b = $(this);
		var tt = b.text() || b.val();
		
		if ($(':submit,:button',this)) {
			b = $('<a>').insertAfter(this). addClass(this.className).attr('id',this.id);
			$(this).remove();
		}
		b.text('').css({cursor:'pointer'}). prepend('<i></i>').append($('<span>').
		text(tt).append('<i></i><span></span>'));
	});
	*/
}


/*
function openDir( form ) { 
	var newIndex = form.fieldname.selectedIndex; 
	if ( newIndex == 0 ) { 
		alert( "Please select a location!" ); 
	} else { 
		cururl = form.fieldname.options[ newIndex ].value; 
		window.location.assign( cururl ); 
	} 
} 
*/
