
// gets screen width
function get_window_width(value) {
  
  if( typeof( window.innerWidth ) == 'number' ) {
	  return window.innerWidth;
	} else if( document.documentElement && document.documentElement.clientWidth ) {
	  return document.documentElement.clientWidth;
	} else if( document.body && document.body.clientWidth ) {
	  return document.body.clientWidth;
  }
  return value;

}

 
// gets screen height
function get_window_height(value) {
  
  if( typeof( window.innerHeight ) == 'number' ) {
	  return window.innerHeight;
	} else if( document.documentElement && document.documentElement.clientHeight ) {
	  return document.documentElement.clientHeight;
	} else if( document.body && document.body.clientHeight ) {
	  return document.body.clientHeight;
  }
  return value;

}

function showdata (url) {

   var info = null; 
   
   if (parent.frames['info'] == null) {
      info = window.open("", "info", "width=400,height=300,left=100,top=100,menubar=no,toolbar=no,scrollbars=yes,status=yes,resizable=yes");
      info.focus();
   } else {
      info = parent.frames['info'];
   }

   if (info!=null) {
      info.location.href = url;
      return true;
   } else return false;
   
}

function changeTab(tab) {
	var i = 0;
	var oTab;
	for (i=1 ; i < 5; i++) {
		oTab = document.getElementById('menuInfo'+i);
		if (oTab){
			if (i == tab) {
				oTab.className = "tdMenuInfoSelected";
			} else {
				oTab.className = "tdMenuInfo";
			}
		}
	}
}

    function findPos(obj) {
    	var curleft = curtop = 0;
    	if (obj.offsetParent) {
    		curleft = obj.offsetLeft
    		curtop = obj.offsetTop
    		while (obj = obj.offsetParent) {
    			curleft += obj.offsetLeft
    			curtop += obj.offsetTop
    		}
    	}
    	return [curleft,curtop];
    }	
    
 function openDetails(id){
 	showdata(appURL+"/db/fitxa.php?id="+id);
 	return false;
	
}


    function changePage(tab,url) {
      if (tab!=null && url!=null) {
        newUrl = url.replace("#","%23");
        parent.oTabManager.activate(tab);


	var oIframePage;
	var oDoc;
	
	oIframePage = document.getElementById(tab);
	if (!oIframePage){
		oDoc = (parent.contentWindow || parent.contentDocument);
		oIframePage = oDoc.getElementById(tab);
	}
	if (!oIframePage){
		return false;
	}
	
	oDoc = (oIframePage.contentWindow || oIframePage.contentDocument);
	if(oDoc){
		//framedoc = oDoc.getElementById("documentContainer");
		framearbre = oDoc.document.getElementById("textContainer");
		framearbre.style.visibility = "hidden";
		framedocument = oDoc.document.getElementById("documentContainer");
		framedocument.style.visibility = "visible";
		//alert(newUrl);
		framedocument.src = newUrl;
	}
/*
		
        el = parent.document.getElementById(tab);
		
		framedoc = el.document.getElementById("documentContainer");
		alert(framedoc.visibility);
        //if (el) el.src= newUrl;
		*/
      }
    }	
