isSavePressed = false;

function updatePage()
{
//alert(document.getElementById("content_title").style.height);
 document.getElementById("content_footer").style.top=document.getElementById("content").style.top+ document.getElementById("content").style.height;
}
function getNumberValue(value)
{
	var res = parseInt(value,10);
	if (isNaN(res))
   {
	   return 0;
   }  else
   {	
   		return res;
   }
}

function validateNr(number,lng){
var rNo=parseInt(number.value, 10)
if (isNaN(rNo)||rNo<0)
   {
      if (lng==2) {alert("Incorrect number!");}
      if (lng==0) { alert("Număr incorect!");}
      if (lng==1) {alert("Hibás szám!");}
	number.focus();
	return false;
   }
return true;
}


function validateFloat(number){
var rNo=parseFloat(number.value)
if (isNaN(rNo))
   {
    alert("Invalid value!");
	number.focus();
	return false;
   }
return true;
}

function fix(number,decimals)
{
 var multiplier=Math.pow(10,decimals);
 var newValue=Math.round(number*multiplier)/multiplier;
 return newValue;
}
function requiredField(name)
{
var aux=/^[\s]*/;
name.value=name.value.replace(aux,"");
aux=/[\s]*$/;
name.value=name.value.replace(aux,"");
if (name.value=="")
	{
	alert("Required field!");
	name.focus();
	return false;
	}
return true;
}

function checkBlank(name)
{
var aux=/^[\s]*/;
name.value=name.value.replace(aux,"");
aux=/[\s]*$/;
name.value=name.value.replace(aux,"");
if (name.value=="")
	{
	return true;
	}
return false;
}



function validateEmail(email,lng)
{
var pattern=/^[A-Za-z0-9._]+@[A-Za-z0-9._]+\.[a-z]+$/;
var matchEmail=email.value.match(pattern);
if (matchEmail==null)
       {
	  if (lng==2) {alert("Invalid e-mail format!");}
      if (lng==0) {alert("Adresa de e-mail nu este corect introdusă!");}
      if (lng==1) {alert("Helytelen e-mail cím!");}
	email.focus();
	return false;
	}
return true;
}

function validate_date(date_fld)
{
var pattern=/\d{4}-\d{1,2}-\d{1,2}/;
var matchDate=date_fld.value.match(pattern);
if (matchDate==null)
   { 
   if (!checkBlank(date_fld))
    {
     alert("Invalid date format! Use the following format: YYYY-MM-DD");
	 date_fld.focus();
	 return false;
	} 
	}
return true;
}

function SavePressed()
{
	isSavePressed = true;
}

function confirmUnload()
{
	if(!isSavePressed)
  		return 'You may have unsaved data.';
}

function validatePasswords()
{
	isOk = !($('old_password').value.blank()) && !($('new_password').value.blank()) && !($('retype_new_password').value.blank());
	if(!isOk)
	{
		alert("Fill in the password fields !");
		return false;
	}
	isOk = ($('new_password').value == $('retype_new_password').value);
	if (!isOk)
	{
		$('new_password').value ="";
		$('retype_new_password').value = "";
		alert("The new password does not match with the retyped new password !");
		return false;
	} else
	{
		SavePressed();
		return true;
	}
	
}
	hs.showCredits = false;
	hs.graphicsDir = 'highslide/graphics/';
	hs.align = 'center';
	hs.transitions = ['expand', 'crossfade'];
	hs.fadeInOut = true;
	hs.outlineType = 'rounded-white';
	hs.wrapperClassName = 'blue';
	hs.captionEval = 'this.a.title';
	hs.numberPosition = 'caption';
	hs.useBox = true;
	hs.width = 700;
	hs.height = 500;

	//hs.dimmingOpacity = 0.8;

	// Add the slideshow providing the controlbar and the thumbstrip
	hs.addSlideshow({
		//slideshowGroup: 'group1',
		interval: 5000,
		repeat: false,
		useControls: true,
		fixedControls: false,
		overlayOptions: {
			opacity: 1,
			position: 'bottom center',
			hideOnMouseOut: true
		},
		thumbstrip: {
			position: 'above',
			mode: 'horizontal',
			relativeTo: 'expander'
		}


	});


	// Make all images animate to the one visible thumbnail
	var miniGalleryOptions1 = {
		thumbnailId: 'thumb1'
	}
