////////////////////////////////////////////////////////////////
//
// Beschreibung: Browsererkennung
//
////////////////////////////////////////////////////////////////

var ns  = (document.layers) ? 1 : 0;
var ie  = (document.all) ? 1 : 0;
var dom = (document.getElementById) ? 1 : 0;
var mac = (navigator.platform.indexOf("Mac") != -1) ? 1 : 0;
var gecko     = (navigator.userAgent.indexOf("Gecko") != -1) ? 1 : 0;
var geckoVers = parseFloat(navigator.userAgent.replace(/.*rv:(\d+\.\d+).*/, '$1'));
var ieVers    = navigator.appVersion.substring(navigator.appVersion.lastIndexOf("MSIE") + 4,navigator.appVersion.lastIndexOf("MSIE") + 8);



var objButton = "";
var objLoading = "";
var title      = "";
function addToInstallList(downloadPath, ressourcePath,title, obj, loadingBut, browseId){

   var titleEsc = escape(title);
   jQuery(obj).hide("fast");
   
   if(ie){
    var yPos = absTop(obj);
    var xPos = absLeft(obj) - 120;
   }else{
    var yPos = obj.offsetTop;
    var xPos = obj.offsetLeft - 120;
   }
   
  
   var scrollY = getScrollY();
   var sizeWindow = getSizeWindow();
   var h = sizeWindow-78;
   yPos = yPos - scrollY;
   
   jQuery("#installInfoArea").css("top", yPos);
   jQuery("#installInfoArea").css("left", xPos);
   jQuery("#installInfoArea").show("fast");
   jQuery("#installInfoArea").animate({ left: "0px", top: h+"px", height: "80px", width: "292px"},300);
   jQuery(obj).show("fast");
   jQuery.ajax({ type: "POST", url: "/weblics/downloads/scripts/index.php", data: "action=addRessource&downloadPath="  + downloadPath + "&ressourcePath=" + ressourcePath + "&title=" + titleEsc + "&browseId=" + browseId ,
   success: function(msg){
    
   }
   });
   jQuery("#installInfoAreaQueue").text(title);
   return false;

}

function absTop(obj) {
return (obj.offsetParent)?
obj.offsetTop+absTop(obj.offsetParent) : obj.offsetTop;
}

function absLeft(obj) {
return (obj.offsetParent)?
obj.offsetLeft+absLeft(obj.offsetParent) : obj.offsetLeft;
}

function addToInstallResponse(responseText){

}

// Vertikale Scrollposition ermitteln
function getScrollY() {
	 
	    if( typeof( window.pageYOffset ) == 'number' ) {
	        //Netscape compliant
	        scrOfY = window.pageYOffset;
	    } else if( document.body && document.body.scrollTop ) {
	        //DOM compliant
	        scrOfY = document.body.scrollTop;
	    } else if( document.documentElement) {
	        //IE6 standards compliant mode
	        scrOfY = document.documentElement.scrollTop;
	    }
	    
	    return scrOfY;
	}

// Innere Fensterhöhe ermitteln
function getSizeWindow() {
	var myHeight = 0;

	if( typeof( window.innerHeight ) == 'number' ) {
		//Non-IE
		myHeight = window.innerHeight;
	} else if( document.documentElement && document.documentElement.clientHeight  ) {
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && document.body.clientHeight ) {
		//IE 4 compatible
		myHeight = document.body.clientHeight;
	}
	return myHeight;
}







function ajustButtom(id,cAction) {
  var x,y;
  var innerx,innery;
  var bM = document.getElementById('blockMain');

  if (ie != '1') // all except Explorer
  {
   x = self.pageXOffset;
   y = self.pageYOffset;
   innerx = self.innerWidth;
   innery = self.innerHeight;
   bM.style.minHeight = innery+'px';
  }
  
  else {
    if (ieVers == ' 7.0') {
       y = document.documentElement.scrollTop;
       innery = document.documentElement.clientHeight;
       if (y > 0){
          finaly = innery + y;
       } else {
          finaly = innery;
       }
        bM.style.height = finaly +'px';
        /*
       x = document.body.scrollLeft;
       y = document.body.scrollTop;
       innerx = document.body.clientWidth;
        innery = document.body.clientHeight;
        finaly = innery + document.body.scrollTop;
       bM.style.height = finaly +'px';

        innery = document.documentElement.clientHeight;
       bM.style.height = innery +'px';
       */
    } else {
     x = document.documentElement.scrollLeft;
     y = document.documentElement.scrollTop;   
      innerx = document.documentElement.clientWidth;
     innery = document.documentElement.clientHeight;
     finaly = innery + document.body.scrollTop;
     bM.style.height = finaly +'px'; 

    }
  }
}

function resizeContent(){

  var targetHeightAll = jQuery('body').height()-285;
  var innerContentY   = jQuery('#weblicRessourceInner').height();
  var innerRightY     = jQuery('#blockRightInner').height();
  
  var heightDiffInnerContentY = 0;
  var heightDiffInnerRightY   = 0;
  
  if (innerContentY < targetHeightAll){
    heightDiffInnerContentY = targetHeightAll-innerContentY;
  }  
  
  if (innerRightY < targetHeightAll){
    heightDiffInnerRightY = targetHeightAll-innerRightY;
  }  
  
  if(innerContentY > innerRightY){
    setHeight = innerContentY+20+heightDiffInnerContentY;
    jQuery('#blockRightInner').height(setHeight);
  } 
  if(innerRightY > innerContentY){
    setHeight = (innerRightY+heightDiffInnerRightY) - 20;
    jQuery('#weblicRessourceInner').height(setHeight);
  }
}


function openExtended(obj){
 if(obj.style.display == 'block'){
   obj.style.display = 'none';
   document.searchRessources.filterTime.value = "";
   document.searchRessources.filterType.value = "";
 }else{
   obj.style.display = 'block';
 }
 
}

