	var frontObj;	
	expirationDate = new Date();
	expirationDate.setDate(expirationDate.getDate() + 30);	
	var app=navigator.appName.substring(0,1);//Mozilla-N,Opera-O,Internet Explorer-M
	
	function getWindowHeight() {
		var windowHeight=0;
		if (typeof(window.innerHeight)=='number') {
			windowHeight=window.innerHeight;
		}
		else {
			if (document.documentElement && document.documentElement.clientHeight) {
				windowHeight=document.documentElement.clientHeight;
			}
			else {
				if (document.body && document.body.clientHeight) {
					windowHeight=document.body.clientHeight;
				}
			}
		}
		return windowHeight;
	}
		
	function minimize(obj){	 	
		
	 	var objekat = document.getElementById(obj);
	 	var prikaz = objekat.style.display;		
		
	 	if(prikaz=="block"){
		 objekat.style.display = "none";		 
		}else{
			objekat.style.display = "block";				 	 					
		}	
		
		v1=parseInt(getAbsTop(document.getElementById("root"))+document.getElementById("root").clientHeight)-175;//+175	
		v2=parseInt(getAbsTop(document.getElementById("root2"))+document.getElementById("root2").clientHeight)-175;
		v3=parseInt(getAbsTop(document.getElementById("root3"))+document.getElementById("root3").clientHeight)-175;
		v4=parseInt(getAbsTop(document.getElementById("root4"))+document.getElementById("root4").clientHeight)-175;		
		//h=parseInt(window.innerHeight)-255;//-250	
		h=getWindowHeight()-215;/*255*/	
		tmp=findBottom(v1,v2,v3,h);	
		//alert("v1:"+v1+" v2:"+v2+" v3:"+v3+" h:"+h+" tmp:"+tmp);
		document.getElementById("vis").style.height=tmp+"px";
	}
	function ispredSvih(obj) {
	
	    if (frontObj) {
	        frontObj.style.zIndex = 0;	        
	    }		
   		frontObj = obj;   	
    	frontObj.style.zIndex = 1;
		
	}    
	function dimenzije(event){
	
	 root2.style.width=dugme.style.left;
	 sadrzaj2.style.height=dugme.style.top;
	 //alert(dugme.style.top);
		//root2.style.width=dugme.style.left-root2.style.left;
	//	root2.style.height=dugme.style.top-root2.style.top;
	} 
	function podesavanja(){	
		
		v1=parseInt(getAbsTop(document.getElementById("root"))+document.getElementById("root").clientHeight)-135;//+175	
		v2=parseInt(getAbsTop(document.getElementById("root2"))+document.getElementById("root2").clientHeight)-135;
		v3=parseInt(getAbsTop(document.getElementById("root3"))+document.getElementById("root3").clientHeight)-135;		
		//h=parseInt(window.innerHeight)-255;//-250	
		h=getWindowHeight()-215;/*255*/	
		tmp=findBottom(v1,v2,v3,h);	
		//alert("v1:"+v1+" v2:"+v2+" v3:"+v3+" h:"+h+" tmp:"+tmp);
		document.getElementById("vis").style.height=tmp+"px";
		
	} 
	function snimanjePozicije(e){
		//if (!e) {e = window.event}	
		// Store the position of the dragged object
		// as a cookie / the cookie value is a snippet of JavaScript
		//oLeft = e.clientX-mouseLeft;
		//oTop = e.clientY-mouseTop;
		oLeft1=getAbsLeft( document.getElementById("root") );
		oTop1=getAbsTop( document.getElementById("root") );
		oLeft2=getAbsLeft( document.getElementById("root2") );
		oTop2=getAbsTop( document.getElementById("root2") );
		oLeft3=getAbsLeft( document.getElementById("root3") );
		oTop3=getAbsTop( document.getElementById("root3") );
		oLeft4=getAbsLeft( document.getElementById("root4") );
		oTop4=getAbsTop( document.getElementById("root4") );		
		
		cookieValue = "var oLeft1=" + oLeft1 + ";" + "var oTop1=" + oTop1 + ";";
		cookieValue += "var oLeft2=" + oLeft2 + ";" + "var oTop2=" + oTop2 + ";";
		cookieValue += "var oLeft3=" + oLeft3 + ";" + "var oTop3=" + oTop3 + ";";
		cookieValue += "var oLeft4=" + oLeft4 + ";" + "var oTop4=" + oTop4 + ";";		
		//cookieValue = "var oLeft=" + 0 + ";" + "var oTop=" + 0;
		setCookie("recPos",cookieValue,expirationDate);
		//alert("Cookie:"+getCookie("recPos") );
		//document.getElementById("vis").style.height="0px";
		//document.getElementById("vis").style.height=(document.body.parentNode.scrollHeight-220)+"px";	
		
		v1=parseInt(getAbsTop(document.getElementById("root"))+document.getElementById("root").clientHeight)-135;//+175	
		v2=parseInt(getAbsTop(document.getElementById("root2"))+document.getElementById("root2").clientHeight)-135;
		v3=parseInt(getAbsTop(document.getElementById("root3"))+document.getElementById("root3").clientHeight)-135;		
		//h=parseInt(window.innerHeight)-255;//-250	
		h=getWindowHeight()-215;	
		tmp=findBottom(v1,v2,v3,h);	
		//alert("v1:"+v1+" v2:"+v2+" v3:"+v3+" h:"+h+" tmp:"+tmp);
		document.getElementById("vis").style.height=tmp+"px";
	}  
function findBottom(v1,v2,v3,h){
	t1=(v1>v2)?v1:v2;
	t2=(v3>h)?v3:h;
	//alert('v1:'+v1+' v2:'+v2+' v3:'+v3+' h:'+h);
	return (t1>t2)?t1:t2;
}
	
function setCookie(cookieName,cookieValue,cookieExpiration) {
    
	if (cookieExpiration!=null) {
        // Cookie has a duration / date object is expected
		document.cookie=cookieName + "=" + escape(cookieValue) + ";path=/;expires=" + cookieExpiration.toGMTString();
    } else {
        // Cookie has no duration / it will remain only for the browser session
		document.cookie=cookieName + "=" + escape(cookieValue) + ";path=/";
    }
}

// Get cookie value
function getCookie(cookieName) { 

	cookieString=document.cookie;
    cookieName+="=";
    
	// If at least one cookie exists...
    if (cookieString.length>0) {
        
		// Search for the cookie name
		i=cookieString.indexOf(cookieName);
        
		// If the cookie name exists, return its value
        if (i!=-1) {
            i += cookieName.length;
            j = cookieString.indexOf(";",i);
            
            if (j==-1) {j = cookieString.length};
            
            return unescape(cookieString.substring(i,j));
        }
    }

    // Return a null value if the cookie doesn't exist
	return null;
}

// Delete a cookie
function deleteCookie(cookieName) {
	
	// Get a date object for the 1st january 1970
	cookieExpiration = new Date(1970,0,1)
	// Set cookie value to an empty string and its expiration date to the 1st january 1970
	document.cookie=cookieName + "=;path=/;expires=" + cookieExpiration.toGMTString();
}

// Get object left position, even if nested
function getAbsLeft(o) {
	oLeft = o.offsetLeft;
	while(o.offsetParent!=null) {
		oParent = o.offsetParent;
		oLeft += oParent.offsetLeft;
		o = oParent;
	}
	return oLeft;
}

// Get object top position, even if nested
function getAbsTop(o) {
	oTop = o.offsetTop;
	while(o.offsetParent!=null) {
		oParent = o.offsetParent;
		oTop += oParent.offsetTop;
		o = oParent;
	}
	return oTop;
}

// Set object left position
/*
function setLeft(o,oLeft) {
	o.style.left = oLeft + "px";
}
// Set object top position
function setTop(o,oTop) {
	o.style.top = oTop + "px";
}
// Set object top and left positions
function setPosition(o,oLeft,oTop) {
	setLeft(o,oLeft);
	setTop(o,oTop);
}
*/

	
