// --- 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;}
}

// --- elementa ieguushana
function el(obj){
	return document.getElementById(obj);
}

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();
}

// --- formas paarbaudes funkcija
function check_emty_fields2(mas){
  for(var i=0; i < mas.length; i++) {
		if($("#" + mas[i]).val()=="" || $("#" + mas[i]).val()===undefined) {alert("Aizpildiet nepieciešamos laukus!"); $("#" + mas[i]).focus(); return false; break;}
  }
}

// --- 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();
}

// --- 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 void_act(g_arg1,g_arg2){
	$.get("ajax/void_act.php", { rnd:Math.random(),arg1: g_arg1,arg2: g_arg2});
}	
	
// --- doties uz adresi
function go_url(curl){
	document.location.href = curl;	
}

// --- jauna loga func
function open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable){
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  nw=window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
  nw.focus();
}

// --- elementa redzamiibas mainja
function chdisp(el){
	// --- veertiibas ieguushana
	var x = document.getElementById(el);
	if (x.currentStyle)
		var y = x.currentStyle['display'];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue('display');
	// --- stila mainja
	if(y=="block" || y=="table-row"){x.style.display="none";}
	else{x.style.display="";}		
}
