// JavaScript Document
function getObj(objname) { return document.getElementById(objname); }   

function getPageSize() {
	        
	     var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
	
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}

		return [pageWidth,pageHeight];
	}

function CreateSplash(obj_id,obj_bground,obj_width,obj_height,obj_top,obj_sbground,obj_border,obj_containerclass,obj_contentclass)
{
	        if (document.all)
            {               
                document.body.scroll = "no";
				document.body.focus();
				//document.body.style.overflow = "hidden";
				//document.body.style.overflowY="hidden";
			
            }
            else
            {  
                var oTop = document.body.scrollTop;
                document.body.style.overflow = "hidden";
                document.body.scrollTop = oTop;
            }
			
var ad=getPageSize();
newDiv = document.createElement("div");
newDiv.style.zIndex = '1000';
newDiv.contentname=obj_id+'_content';
newDiv.closer=obj_id+'_close';
newDiv.id=obj_id+'_container';
newDiv.style.backgroundColor=obj_bground;

newDiv.style.top='0px';
newDiv.style.left='0px';
newDiv.textAlign='center';
newDiv.style.width=ad[0]+'px';
newDiv.style.height=ad[1]+'px';
newDiv.style.position='absolute';
newDiv.style.position='absolute';
newDiv.style.display='none';
if ((obj_containerclass!='')&&(obj_containerclass!=null))
 { newDiv.className=obj_containerClass; }
newDiv.onclick=function()
						{ $(this.contentname).appear({ from: 0.7, to: 0.0, duration: 0.3 });
						  $(this.closer).appear({ from: 0.7, to: 0.0, duration: 0.3 });
						  $(this.id).appear({ from: 0.7, to: 0.0, duration: 0.5 });
						
						 document.body.scroll = "";
                         document.body.style.overflow = "";
			
						document.getElementsByTagName('body')[0].removeChild($(this.contentname));
						document.getElementsByTagName('body')[0].removeChild($(this.closer));
						document.getElementsByTagName('body')[0].removeChild(this); 
						try
						{
						delete $(this.id);
						delete $(this.contentname); 
						delete $(this.closer);
						} catch(e) {};
						
						}
						
document.getElementsByTagName('body')[0].appendChild(newDiv);

subDiv = document.createElement("div");
closeDiv = document.createElement("div");
closeDiv.id=obj_id+'_close';
subDiv.style.zIndex = '1001';
subDiv.id=obj_id+'_content';
subDiv.style.display='inline';

var arrayPageScroll = document.viewport.getScrollOffsets();
if (obj_top!=0) {subDiv.style.top=obj_top+'px';} else 
{subDiv.style.top=(arrayPageScroll[1]+(document.viewport.getHeight()-(obj_height+20))/2)+'px';}
subDiv.style.width=obj_width+'px';
subDiv.style.height=obj_height+'px';
subDiv.style.backgroundColor=obj_sbground;
subDiv.style.border=obj_border;
subDiv.style.position='absolute';
subDiv.style.left=(Number(ad[0]-obj_width)/2).toFixed(0)+'px';
closeDiv.style.position='absolute';
closeDiv.style.zIndex = '1001';
closeDiv.style.width=obj_width+'px';
closeDiv.style.height=18+'px';
closeDiv.style.border=obj_border;
closeDiv.style.backgroundColor=obj_sbground;
closeDiv.style.left=(Number(ad[0]-obj_width)/2).toFixed(0)+'px';
closeDiv.style.top=(parseInt(subDiv.style.top)+parseInt(subDiv.style.height)+1)+'px';
closeDiv.innerHTML='<div id="'+obj_id+'_closelabel'+'" style="font-size:12px;font-weight:bold;text-decoration:underline;cursor:pointer" align="center">Zatvori</div>';
closeDiv.own=obj_id+'_container';
closeDiv.onclick=function (){ getObj(this.own).onclick(); };
if ((obj_contentclass!='')&&(obj_contentclass!=null))
 { closeDiv.className=obj_contentclass; 
 subDiv.className=obj_contentclass; }
 
document.getElementsByTagName('body')[0].appendChild(subDiv);
document.getElementsByTagName('body')[0].appendChild(closeDiv);
$(obj_id+'_container').appear({ from: 0.0, to: 0.7, duration: 0.5 })

return newDiv;
}
