

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 - 768) / 2)+'px';
//	document.getElementById('dynamic').style.height = parseInt(576)+'px';
//	document.getElementById('dynamic').style.top = parseInt((WindowHeight - 576) / 2)+'px';
//	document.getElementById('image_area').style.left = parseInt((WindowWidth - 768) / 2)+'px';
//	document.getElementById('image_area').style.height = parseInt(576)+'px';
//	document.getElementById('image_area').style.top = parseInt((WindowHeight - 576) / 2)+'px';
//	document.getElementById('design_top').style.left = parseInt((WindowWidth - 768) / 2)+'px';
//	document.getElementById('design_top').style.top = parseInt((WindowHeight - 576) / 2)+'px';
//	if (document.getElementById('gallery_controls_top')) {
//		document.getElementById('gallery_controls_top').style.left = parseInt((WindowWidth - 768) / 2)+'px';
//		document.getElementById('gallery_controls_top').style.top = parseInt((WindowHeight - 576) / 2)+'px';
//	}
//	if (document.getElementById('gallery_controls_bottom')) {
//		document.getElementById('gallery_controls_bottom').style.left = parseInt((WindowWidth - 768) / 2)+'px';
//		document.getElementById('gallery_controls_bottom').style.top = parseInt(((WindowHeight - 576) / 2) + 512)+'px';
//	}
//	document.getElementById('design_bottom').style.left = parseInt((WindowWidth - 768) / 2)+'px';
//	document.getElementById('design_bottom').style.top = parseInt(((WindowHeight - 576) / 2)+512)+'px';
///	document.getElementById('design_copy').style.left = parseInt((WindowWidth - 768) / 2)+'px';
//	document.getElementById('design_copy').style.top = parseInt(((WindowHeight - 576) / 2)+570)+'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_bottom').style.display = "block";
	document.getElementById('image_area').style.display = "block";
	Text = Sjax("/p/user_gallery/view/" + GalleryID + "&ImageID=" + AttachmentID, {});
	if (Text.substring(0, 1) == "{") {
		Data = JSON.parse(Text, null);
		document.getElementById('image_view_url').src = "http://blazej.bbalaz.sk/lib/image.php?width=768&height=447&filename=" + Data.URL;
		document.getElementById('image_counter').innerHTML = Data.ImagesCurrent + " / " + Data.ImagesTotal;
		document.getElementById('image_title').innerHTML = "<strong>" + Data.Title + "</strong><br />" + Data.ImageTechnics;
		document.getElementById('image_measure').innerHTML = Data.ImageCreated  + "<br />" + Data.ImageMeasure;
		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('gallery_back').style.display = "none";
		document.getElementById('images_back').style.display = "block";
	}
}

