<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- Полето "'+nm+'" трябва да съдържа email адрес.\n';
      } 
	  else if (test!='R' && test!='G') { num = parseFloat(val);
        if (isNaN(val)) errors+='- Полето "'+nm+'" трябва да съдържа число.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- Полето "'+nm+'" трябва да съдържа число между '+min+' и '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- Моля въведете '+nm+'.\n'; 
	else if (test.charAt(0) == 'G'){ errors += '- Моля изберете '+nm+'.\n';}
	}
  } if (errors) alert('Грешка!\n'+errors);
  document.MM_returnValue = (errors == '');
}
function delConf(parm)    {
return (confirm(parm));
}

function setValue(value){
	 document.form1.picture.value = value;
	 document.form1.pic.src = "../"+value;
}
function setAudio(value){
	 document.form1.source.value = value;
}
function popupMsg(msg) { //v1.0
  alert(msg);
  return false;
}
function popupWindow(url) {
	var scX = (screen.width/2)-320;
	var scY = (screen.height/2)-240;
mwin = window.open(url,'movie','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=320,height=240,screenX=150,screenY=150,top='+scX+',left='+scY+'');
	if (window.focus) {mwin.focus()}
	return false;
}

function NW(mypage, myname, w, h) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes';
win = window.open(mypage, myname, winprops);
win.window.focus();
}
function MM_swapImage() { //v3.0
  var pat = "thumb.php?src=/data/Image/";
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=pat+a[i+2]+"w=200";}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function browse(file){
	newwindow=window.open(file, 'browser', 'width=860, height=650, location=center, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes');
	if (window.focus) {newwindow.focus()}
	return false;
}
function setDate() {
	  var curTime = new Date();
	  var year = curTime.getYear();
	  var month = curTime.getMonth();
	  var day = curTime.getDay();
	  var H = curTime.getHours();
	  var M = curTime.getMinutes();
	  var S = curTime.getSeconds();
      if (month < 10) {month = "0" + month;}
      if (day < 10) {day = "0" + day;}
	  if (H < 10) {H = "0" + H;}
	  if (M < 10) {M = "0" + M;}
	  if (S < 10) {S = "0" + S;}
      var dateString = year+"-"+month+"-"+day+"-"+H+"-"+M+"-"+S;
      return(dateString);
  }
  
function setGallery(){
	 var dir = setDate();
	 var createD = document.form1.img_path.value;
	 if(createD.length < 1){
	 if(dir.length == 0){
	 dir = prompt("Име на папката на латиница:", "");
	 }
	 if(dir){
	 openGall(dir);
	 }
	 else {
	 //return false;
	 }
	 }
	 else {
		 dir = createD;
		 openGall(dir);
	 }
	 
}
function openGall(dir){
	document.form1.img_path.value = dir;
	newDwindow = window.open('browse_gallery.php?newDir='+dir, 'browser',  'width=850, height=650, location=center, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes');
	if (window.focus) {newDwindow.focus()}
	return false;
}

//-->