var nv = (navigator.appName.indexOf("Netscape") != -1) || window.opera;

function initSettings()
{
	MM_preloadImages(site_root+'media/img/mnu/acasa_on.jpg',site_root+'media/img/mnu/despre_noi_on.jpg',site_root+'media/img/mnu/stiri_on.jpg',site_root+'media/img/mnu/librarie_on.jpg',site_root+'media/img/mnu/contact_on.jpg',site_root+'media/img/mnu/contact_on.jpg');	
}

function checkSendContact(f)
{
	if(!isEMailAddr(f.email.value)){
		f.email.focus();
		alert('Adresa de email invalida!');
		return false;
	}
	if(isEmpty(f.mesaj.value)){
		f.mesaj.focus();
		alert('Introduceti mesajul!');
		return false;
	}
return true;	
}

function chDownForm(f)
{
	if(isEmpty(f.nume.value)){
		f.nume.focus();
		alert('Introduceti Numele!');
		return false;
	}
	if(isEmpty(f.prenume.value)){
		f.prenume.focus();
		alert('Introduceti Prenumele!');
		return false;
	}
	if(!isEMailAddr(f.email.value)){
		f.email.focus();
		alert('Adresa de email invalida!');
		return false;
	}
	if(isEmpty(f.localitate.value)){
		f.localitate.focus();
		alert('Introduceti Localitatea!');
		return false;
	}
	
	return true;
}

function downloadFile(dfloc)
{
	document.location = dfloc;
}

function setFileForDownload(fileSource,fileTitle)
{
	x = document.getElementById('df_title');
	y = document.getElementById('df_href');
	x.innerHTML = fileTitle;
	y.href = fileSource;
}

function showDownloadPopup(dfile)
{
	dPop = createPopup(400,'downloadPopup');	
	dPop.innerHTML = dpopcont;
}

function closeDwnForm()
{
	closePopup('downloadPopup');
}

function createPopup(w,pname,e)
{
		var newdiv = document.createElement('div');
		newdiv.id = pname;
		newdiv.className = 'popup';
		newdiv.style.width = w + "px";
		scrTop  = nv ? pageYOffset : ieTest().scrollTop;
		if(!e){
			newdiv.style.top     = bodySize('H')/2-80+scrTop+'px';
			newdiv.style.left    = (bodySize('W')/2 - w/2) +'px';
		}else{
			newdiv.style.top = e + 'px';
			newdiv.style.left    = 5 +'px';
		}
		//newdiv.style.top     = 300+scrTop+'px';
	
		document.body.appendChild(newdiv);
		return document.getElementById(pname);
}

function closePopup(p)
{
	document.body.removeChild(document.getElementById(p));	
}

function ieTest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function bodySize(axa) {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  if (axa=='W') { return myWidth };
  if (axa=='H') { return myHeight };  
}
