/***************************************************************************************************************
* REPOSITIONING THE OUTER-CONTAINER 																									*
*																																					*
* FOR HORIZONTALLY-AND-VERTICALLY-CENTERED SITES:																					*
* <body onResize='reposition_main('outer_container',10,10)' onLoad='reposition_main('outer_container',10,10)'> *
*																																					*
* FOR HORIZONTALLY-CENTERED ONLY SITES:																								*
* <body onResize='reposition_main('outer_container',10,'')' onLoad='reposition_main('outer_container',10,'')'> *
*																																					*
* CSS-STYLES FOR OUTER_CONTAINER HAVE TO BE SET WITHIN THE HTML CODE       												*
*																																					*
*  m = margin  ||  w = width  ||  h = height 																						*
*  hor = horizontal  || vert = vertical																								*
****************************************************************************************************************/


function reposition_main(container,new_hor_margin,new_vert_margin){

	cont = document.getElementById(container).style;
	
	cont_w_px = cont.width;
	
	if(cont_w_px.length==5){
		w_count=3;																				// 3-stellige outer_container_width 
		m_count=4;
		h_count=3;
	}
	if(cont_w_px.length==6){
		w_count=4;																				// 4-stellige outer_container_width 
		m_count=4;
		h_count=3;
	}
	

	cont_w = cont_w_px.substr(0, w_count);								
																								
	cont_hor_m_px = cont.marginLeft;
	cont_hor_m = cont_hor_m_px.substr(0, m_count);
			
	cont_h_px = cont.height;
	cont_h = cont_h_px.substr(0, h_count);
	
	cont_vert_m_px = cont.marginTop;
	cont_vert_m = cont_vert_m_px.substr(0, w_count);
	
	
				
	if (window.innerHeight!=undefined){							//mozilla etc
		avail_win_w = window.innerWidth;
		avail_win_h = window.innerHeight;
	}
	else {
		avail_win_w = document.body.offsetWidth;				//pc ie
		avail_win_h = document.body.offsetHeight;	
	}
		
	
	if (new_hor_margin!=''){
		if (avail_win_w < cont_w){
			new_hor_m = Math.abs(cont_hor_m - new_hor_margin);
			cont.left = new_hor_m;
		}
		else {
			cont.left='50%';
		}
	}
	
	
	if (new_vert_margin!=''){
		if (avail_win_h < cont_h){
			new_vert_m = Math.abs(cont_vert_m - new_vert_margin);
			cont.top= new_vert_m;
		}
		else {
			cont.top='50%';
		}
	}

}	

/* START GET BROWSER */

var br = getBrowser();

function getBrowser(){
	var agt=navigator.userAgent.toLowerCase();

   if((agt.indexOf("msie") != -1)&&
   	(agt.indexOf("netscape/8") == -1)&&	 //making sure we are not detecting NN8 in IE mode
   	(agt.indexOf("opera") == -1)){       //making sure we are not detecting older opera-versions
   	return "IE";	
   }	
   if(agt.indexOf("firefox") != -1){
   	return "FIREFOX";
   }
    if(agt.indexOf("safari") != -1){
   	return "SAFARI";	
   }
   if((agt.indexOf("netscape/8") != -1)&&(agt.indexOf("msie") != -1)){
   	return "NETSCAPE 8 - IE RENDERING";
   }
   if((agt.indexOf("netscape/8") != -1)&&(agt.indexOf("msie") == -1)){
   	return "NETSCAPE 8 - FF RENDERING";
   }
   if(agt.indexOf("netscape/7") != -1){
   	return "NETSCAPE 7";
   }
   if(agt.indexOf("opera") != -1){
   	return "OPERA";
   }
   if(agt.indexOf("camino") != -1){
   	return "CAMINO";
   }	
}


/* START PROCESS PNGS */
function processPNGs()
{	if((br=='IE')||(br=='NETSCAPE 8 - IE RENDERING'))
	{	imgs=document.getElementsByTagName('img');
		for(var i=imgs.length-1;i>=0;i--)
		{	if(imgs[i].className=='png')
			{	var src=imgs[i].src;
				src=src.replace(/%26/,'%2526');
				imgs[i].outerHTML='<span style="font-size:0px;display:inline; width:1;height:1;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='+encodeURI(src)+', sizingMethod=\'image\');"></span>';
			}
		}
	}
}