

function MyResize() {

	var theHeight = 0;
	if (window.innerHeight) {
	    theHeight=window.innerHeight;
	} else {                       
	    if (document.documentElement && document.documentElement.clientHeight) {
		theHeight=document.documentElement.clientHeight;                     
	    } else {                                                               
		if (document.body) {                                               
		    theHeight=document.body.clientHeight;                            
		}                                                                  
	    }                                                                      
	}                                                                          
	WindowHeight = theHeight;  
	var theWidth = 0;
	if (window.innerWidth) {
	    theWidth=window.innerWidth;
	} else {                       
	    if (document.documentElement && document.documentElement.clientWidth) {
		theWidth=document.documentElement.clientWidth;                     
	    } else {                                                               
		if (document.body) {                                               
		    theWidth=document.body.clientWidth;                            
		}                                                                  
	    }                                                                      
	}                                                                          
	WindowWidth = theWidth;  
	document.getElementById('dynamic').style.left = parseInt((WindowWidth - 960) / 2)+'px';
	document.getElementById('dynamic').style.height = parseInt(576)+'px';
//	document.getElementById('dynamic').style.top = parseInt((WindowHeight - 576) / 2)+'px';
}

function AddGalleryControls() {
//	ele = document.createElement("div");
//	gc = document.getElementById("GalleryControls");
//	ele.innerHTML = "<div id='gallery_back'><a href='/p/content/view/3' title='Späť na menu'><img class='tile' src='/files/img/arrow_back.png' border='0' alt='' /></a></div>";
//	document.appendChild(ele);
//	alert("a");
}

function ShowGalleryImage(GalleryID, AttachmentID) {
	document.getElementById('gallery_controls_top').style.display = "block";
	document.getElementById('gallery_controls_bottom').style.display = "block";
	document.getElementById('image_area').style.display = "block";
//	alert("/p/user_gallery_maria/view/" + GalleryID + "&ImageID=" + AttachmentID);
	Text = Sjax("/p/user_gallery_maria/view/" + GalleryID + "&ImageID=" + AttachmentID, {});
	if (Text.substring(0, 1) == "{") {
		Data = JSON.parse(Text, null);
		document.getElementById('image_view_url').src = "http://maria.bbalaz.sk/lib/image.php?width=736&height=420&filename=" + Data.URL;
		document.getElementById('image_counter').innerHTML = Data.ImagesCurrent + " / " + Data.ImagesTotal;
		document.getElementById('image_title').innerHTML = Data.Counter + ". " + Data.Title + ((Data.ImageMeasure == "") ? "":", ") + Data.ImageMeasure + ((Data.ImageTechnics == "") ? "":", ") + Data.ImageTechnics + ((Data.Created == "") ? "":", ") + Data.ImageCreated + ((Data.Description == "") ? "":", ") + Data.Description;
//		document.getElementById('image_measure').innerHTML = ;
		document.getElementById('image_full').setAttribute('onclick', "window.open('http://blazej.bbalaz.sk/files/" +Data.URL+ "', 'Image', 'width=" + screen.availWidth + ",height=" + screen.availHeight + "')");
		if (Data.ImagesCurrent == 1) 
			document.getElementById('image_previous').style.display = "none"; else
			document.getElementById('image_previous').style.display = "block";		
		document.getElementById('image_previous').setAttribute('onclick', "javascript:ShowGalleryImage(" + Data.GalleryID + ", " + Data.PreviousImageID + ")");
		if (Data.ImagesCurrent == Data.ImagesTotal) {
			document.getElementById('image_next').style.display = "none";
			document.getElementById('image_next').setAttribute('onclick', "javascript:void(0)");
		} else {
			document.getElementById('image_next').style.display = "block";		
			document.getElementById('image_next').setAttribute('onclick', "javascript:ShowGalleryImage(" + Data.GalleryID + ", " + Data.NextImageID + ")");
		}
		document.getElementById('image_view').setAttribute('onclick', "javascript:ShowGalleryImage(" + Data.GalleryID + ", " + Data.NextImageID + ")");
		document.getElementById('images_back').style.display = "block";
	}
}

function ScrollToElement(ElementName){
	theElement = document.getElementById(ElementName);
//	if (!theElement) return true;
	var selectedPosX = 0;
	var selectedPosY = 0;
	while(theElement != null){
		selectedPosX += theElement.offsetLeft;
		selectedPosY += theElement.offsetTop;
		theElement = theElement.offsetParent;
	}
	window.scrollTo(selectedPosX,selectedPosY);
}


function ValidateHelpdeskForm() {
  var x=document.forms["Helpdesk"]["meno"].value;
  if (x==null || x=="") { alert("Meno nie je vyplnené !"); return false; }
  var x=document.forms["Helpdesk"]["firma"].value;
  if (x==null || x=="") { alert("Firma nie je vyplnená !"); return false; }
  var x=document.forms["Helpdesk"]["tel"].value;
  if (x==null || x=="") { alert("Telefón nie je vyplnený !"); return false; }
  var x=document.forms["Helpdesk"]["email"].value;
  if (x==null || x=="") { alert("E-mail nie je vyplnený !"); return false; }
  var x=document.forms["Helpdesk"]["spam"].value;
  if (x==null || x!="2") { alert("Anti-spamové políčko musí mať hodnotu 2"); return false; }
  var x=document.forms["Helpdesk"]["modul"].value;
  if (x==null || x=="") { alert("Modul nie je vyplnený !"); return false;  }
	  return true;
}

function GoPokladne() {
	window.location.href='/p/content/view/16';
}










