function colsheight()
{
   var leftheight;
   var centerheight;
   var rightheight;

   leftheight   = document.getElementById("left").offsetHeight;
   centerheight = document.getElementById("center").offsetHeight;
   rightheight  = document.getElementById("right").offsetHeight;
   windowheight = getWindowHeight();
	
   var allheights  = new Array(leftheight, centerheight, rightheight, windowheight);

   function Numsort(a,b)
   {
     return b-a;
   }
   allheights.sort(Numsort);
   // allheights[0]+=2;

   document.getElementById("left").style.height   = allheights[0] + 'px';
   document.getElementById("center").style.height = allheights[0] + 'px';
   document.getElementById("right").style.height  = allheights[0] + 'px';

}

function getWindowHeight(){
var x,y;
if (self.innerHeight) // all except Explorer
{
	x = self.innerWidth;
	y = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
{
	x = document.documentElement.clientWidth;
	y = document.documentElement.clientHeight;
}
else if (document.body) // other Explorers
{
	x = document.body.clientWidth;
	y = document.body.clientHeight;
}

	return y;
}

// DEEPWEB AJAX FUNCTIONS


	(function($) {
	    $.fn.imagetools = function() {
		return this.each(function(){
			var image = $(this).find('img');
			var link = $(this).find('a:has(img)');
			var wrapper = $(this).find('td:has(img)');
			var target = image.attr('src');
			
			/* find Mediaid in Image Source */
			 var mediaid = -1;
 			 mediaid = target.split("/");
			 mediaid = mediaid[2].split(".");
			 mediaid = mediaid[0];
			 mediaid = mediaid.split("_"); 
			 mediaid = mediaid[1];
			/* found Mediaid */

			/* find sessionid */
			 var qsParm = new Array();
			 var query = window.location.search.substring(1);
			 var parms = query.split('&');
			 for (var i=0; i<parms.length; i++) {
			     var pos = parms[i].indexOf('=');
			     if (pos > 0) {
				 var key = parms[i].substring(0,pos);
			 	 var val = parms[i].substring(pos+1);
				 qsParm[key] = val;
			     }
			 }
			 var sessionid = qsParm['jsessionid'];
			/* found sessionid */

			/* find Publicationid in further tag */
			var dwmediatag = $(this);
			var pubid = dwmediatag.attr('dwtablepubid');
			/* found pubid */
			
			/* give name to image */
			image.attr('name', 'media_'+mediaid+'_'+pubid);
			$(this).wrap('<span name="media_'+mediaid+'_'+pubid+'" >');
			var imgeditdiv = '<div style="position: absolute; cursor:pointer; width:20px; height:20px;" contentEditable="false" class="editimg"> <img src="/odyssee/gfx/de/list/edit.gif" alt="Bild bearbeiten" /> </div>';
			wrapper.hover(
			    function(){
				var offset = image.offset();
				var iWidth = image.outerWidth();
				var sTop = offset.top + 5 ;
				var sLeft = offset.left + iWidth + 10;
				wrapper.append(imgeditdiv);
				wrapper.find(".editimg").offset({top: sTop , left: sLeft}).click(function(){
					if(pubid == '' || mediaid == '' || sessionid == '') alert('Für dieses Objekt steht diese Funktion leider nicht zur Verfügung!');
					  else openMediaWindow(100,100,pubid,mediaid,sessionid);
					  //alert('openMediaWindow('+' 100,100,'+pubid+','+mediaid+','+sessionid+')');
				    });
			    },function(){
				    wrapper.find(".editimg").remove();
			    });
			
		    });
	    };
	})(jQuery);

//  DEEPWEB AJAX FUNCTIONS END
