// --- galerijas apskates funkcija
function prewview(url,dir){
var url;
var dir;
var td_hei = document.body.scrollTop + 75;
var content = "<table border='0' cellpadding='0' cellspacing='0' style='height: 100%; width: 100%'>";
    content += "<tr><td height='"+td_hei+"' colspan='3' class='opac70'>&nbsp;</td></tr>";
    content += "<tr><td width='50%' class='opac70'>&nbsp;</td>";
    content += "<td bgcolor='#FFFFFF' onclick='hide()' style='cursor: pointer'><img src='"+dir+"/"+url+"' hspace='2' vspace='2'></td>";
    content += "<td width='50%' class='opac70'>&nbsp;</td></tr>";
    content += "<tr><td height='100%' colspan='3' class='opac70'>&nbsp;</td></tr>";
    content += "</table>";
document.all.img_box.innerHTML=content;
document.getElementById('img_box').style.top = 0;
if(document.body.scrollHeight > document.body.clientHeight){document.getElementById('img_box').style.height = document.body.scrollHeight;}
else{document.getElementById('img_box').style.height = document.body.clientHeight;}
}

function hide(){
document.getElementById('img_box').style.top = -1 * document.body.scrollHeight; ;
}

// --- galerijas apskates funkcija(jauns logs, viena bilde)
function view_img(url,dir){
var url;
var dir;
nw=window.open('php/show_img.php?src='+url+'&dir='+dir,"img","width=590,height=500");
nw.focus();
}
// --- galerijas apskates funkcija no admin(jauns logs, viena bilde)
function view_img_adm(url,dir){
var url;
var dir;
nw=window.open('../php/show_img.php?src='+url+'&dir='+dir,"img","width=590,height=500");
nw.focus();
}

// --- albuma apskate
function view_alb(id){
	nw2=window.open('php/view_alb.php?id=' + id,"alb","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=200,height=200");
	nw2.focus();
}

// --- linka apstiprinaajuma funkcija
function confirm_link(link) {
	msg = "Are you shore whant to continue?";
	c_link = window.confirm(msg);
	if (c_link) {document.location = link;}
}

// --- formas apstiprinaajuma funkcija
function confirm_form(){
       msg = "Are you shore whant to continue?";
       return confirm(msg);
}

// --- lapas elementa paraadiishana vai nosleepshana
function chb(id) {
	if (document.getElementById(id).style.display=='none') {
		document.getElementById(id).style.display='inline';
	} else {
		if (document.getElementById(id).style.display=='inline') {
			document.getElementById(id).style.display='none';
		}
	}
}

// --- progresa bildes paraadiishana
function progr_go(){
	document.getElementById('prog_box').style.display = "inline";
}

// --- bannera aktiv
function ban_hit(id){
	$.get("ajax/banner_act.php", { rnd:Math.random(),id: id});
}	

// --- formas paarbaudes funkcija
function check_emty_fields(mas,txt){
	var msg = "Aizpildiet nepieciesamos laukus!";
	if(txt) msg = txt;
  for(var i=0; i < mas.length; i++) {  	
		if($("#" + mas[i]).val()=="") {alert(msg); $("#" + mas[i]).focus(); return false; break;}
  }	
  return true;
}

// --- formas 1 paarbaudes funkcija
function check_emty_fields1(){
	var mas = new Array('word_tp','word_name','amats','vieta','word_file');
	var msg = "Aizpildiet nepieciesamos laukus!";
  for(var i=0; i < mas.length; i++) {  	
		if($("#" + mas[i]).val()=="") {alert(msg); $("#" + mas[i]).focus(); return false; break;}
  }	
  $('#form1').submit();
}

// --- formas paarbaudes funkcija
function check_emty_fields2(mas){	
  for(var i=0; i < mas.length; i++) {  	
		if($("#" + mas[i]).val()=="") {
			alert("Aizpildiet nepieciesamos laukus!"); 
			$("#" + mas[i]).focus();
			$("#" + mas[i]).css("background-color","#fcc");
			return false;
			break;
		}
  }	
}