/*
	2006, i.based: network applications
	a.hoepner@ibased.de,
	m.waldeck@ibased.de
*/

function isIE6 ()
{
	

	if (navigator.userAgent.toLowerCase().indexOf("msie 6") == -1) return false;
	return true;	
}

function getGraphicsExt ()
{

	if ( isIE6() ) return  ".gif";
	else return ".png";
	
}


function nav_highlight (obj, action, access, colour)
{
	id = document.getElementById ("o_" + obj);
	

	var file_ext=getGraphicsExt();
	
	if (!id) return;

	var divs =id.getElementsByTagName("a");		

	if (colour =="" ) c = "#A4222B";
	else c = colour;

	if ( action == 1 )
	{
		id.style.backgroundColor=c;
		
		divs[0].style.color="#ffffff";
	}
	else
	{
		id.style.background='none';
		divs[0].style.color="#000000";
	}
		
		
	e_id = 	document.getElementById ("e_" + obj);
	a_id = 	document.getElementById ("a_" + obj);

	var str="";	
	
	if ( action == 1 )
	{
		e_id.src="/html/img/abe_rotop_2006/nav_point_03"+ file_ext;//gif MW

		if ( access==0 )
		{
//			a_id.src="/html/img/abe_rotop_2006/nav_point_02" + file_ext; //.gif"; MW
			str = "/html/img/abe_rotop_2006/nav_point_02" + file_ext; //.gif"; MW
		}
		else if ( access==3 )
		{
			// a_id.src="/html/img/abe_rotop_2006/nav_point_02ul" + file_ext; // .gif"; MW
			str="/html/img/abe_rotop_2006/nav_point_02ul" + file_ext; // .gif"; MW
		}
		else	 
		{

				//	a_id.src = "/html/img/abe_rotop_2006/nav_point_02a" + file_ext; //.gif"; MW
				str = "/html/img/abe_rotop_2006/nav_point_02a" + file_ext;
		}
	}	
	else
	{
		e_id.src="/html/img/abe_rotop_2006/nav_point_spacer.gif";
		// a_id.src="/html/img/abe_rotop_2006/nav_point_01" + file_ext ;// .gif";	 MW
		str="/html/img/abe_rotop_2006/nav_point_01" + file_ext ;
	}
	
	
	var imgNew = document.createElement('img');	
	imgNew.src = str;
  divParent = a_id.parentNode;
  divParent.replaceChild(imgNew, a_id);
	a_id.id = "old_a_" + obj;
	imgNew.id="a_" + obj;
}


function s_nav_highlight (obj, action, access, colour)
{
	id = document.getElementById ("o_" + obj);
	var file_ext=getGraphicsExt();
	var str="";
		
	if (!id) return;

	var divs =id.getElementsByTagName("a");		

	if (colour =="" ) c = "#A4222B";
	else c = colour;

	if ( action == 1 )
	{
		id.style.backgroundColor=c;
		
		divs[0].style.color="#ffffff";
	}
	else
	{
		id.style.background='none';
		divs[0].style.color="#000000";
	}
		
		
	e_id = 	document.getElementById ("e_" + obj);
	a_id = 	document.getElementById ("a_" + obj);
		
	if ( action == 1 )
	{
		e_id.src="/html/img/abe_rotop_2006/nav_point_02"+ file_ext; //.gif";

		if ( access==0 )
		{
//			a_id.src="/html/img/abe_rotop_2006/nav_point_02s"+ file_ext; //.gif";
			str="/html/img/abe_rotop_2006/nav_point_02s"+ file_ext; //.gif";			
		}
		else if ( access==3 )
		{
			//a_id.src="/html/img/abe_rotop_2006/nav_point_02ul"+ file_ext; //.gif";
			str="/html/img/abe_rotop_2006/nav_point_02ul"+ file_ext; //.gif";			
		}
		else	
		{
			//a_id.src="/html/img/abe_rotop_2006/nav_point_02a"+ file_ext; //.gif";		
			str="/html/img/abe_rotop_2006/nav_point_02a"+ file_ext; //.gif";					
		}
	}	
	else
	{
		e_id.src="/html/img/abe_rotop_2006/nav_point_spacer.gif";
		//a_id.src="/html/img/abe_rotop_2006/nav_point_01"+ file_ext; //.gif";	
		str = "/html/img/abe_rotop_2006/nav_point_01"+ file_ext; //.gif";	
	}
	
/*	var imgNew = document.createElement('img');	
	imgNew.src = str;
  divParent = a_id.parentNode;
  divParent.replaceChild(imgNew, a_id);
	*/
	a_id.src = str;
	
	
}




function processKeyDownEvents (event)
{


	var e = event || window.event;

	if ( e == null ) return;
	
	if ( n = e.keyCode ) 
	{
		if ( n == 38 ) // up
		{
				if ( dw_scrollObj ) 
				{
					dw_scrollObj.initScroll('wn','up');
					dw_scrollObj.doubleSpeed('wn');
				
				}
		}
		else if ( n == 40 ) // down
		{
				if ( dw_scrollObj ) 
				{
					dw_scrollObj.initScroll('wn','down');
					dw_scrollObj.doubleSpeed('wn');
				}
		}
		
		else if ( n == 33 ) // up
		{
				if ( dw_scrollObj ) 
				{
					dw_scrollObj.initScroll('wn','up');
					dw_scrollObj.highSpeed('wn');
				
				}
		}
		else if (  n == 34 ) // down
		{
				if ( dw_scrollObj ) 
				{
					dw_scrollObj.initScroll('wn','down');
					dw_scrollObj.highSpeed('wn');
				}
		}
		
		
		
		
		
	}
	
}

function processKeyUpEvents ( event )
{
	var e = event || window.event;
	if ( e == null ) return;
	if ( dw_scrollObj ) dw_scrollObj.stopScroll('wn');

}






var IntervalStarter = 0;
function processMouseWheelEvent ( _event )
{

	var event = '';
	var e = event || window.event;
	if ( e == null ) return;

	if ( navigator.appName.indexOf ('Explorer') > 0 )
	{
			event = window.event;
	}
	else
	{
			event = _event;
	}

	if ( event.type != 'mousewheel' ) return;
	if ( event.wheelDelta == null ) return;
		
	if ( event.wheelDelta < 0 )
	{
		if ( dw_scrollObj ) 
		{
			dw_scrollObj.initScroll('wn','down');
			dw_scrollObj.highSpeed('wn');
		}

	}
	else if ( event.wheelDelta > 0 )
	{
		if ( dw_scrollObj ) 
		{
			dw_scrollObj.initScroll('wn','up');
			dw_scrollObj.highSpeed('wn');
		}


	}

	window.setTimeout("stopScrolling()", 600);
	return 0;

}


function stopScrolling ()
{
	if ( dw_scrollObj ) dw_scrollObj.stopScroll('wn');
}


function showScrollbar ( _div_name, _wn, _lyrid )
{
	var lyr = document.getElementById ( _lyrid );
	var wn = document.getElementById ( _wn );	
	var div_scroll = document.getElementById ( _div_name );

	if ( !lyr || !wn || !div_scroll ) return;
		
	if ( lyr.offsetHeight < wn.offsetHeight )
	{
		div_scroll.style.visibility = 'hidden';
	}
	else
	{
		div_scroll.style.visibility="visible";		

	}

}





function logoutUser ( session_string )
{

		var n = window.open('/cms/templates/abe_rotop_2006_inc/inc_logout.php?'+session_string,'','width=340,height=120');
	

}




function checkOrderLogin ()
{




}

function openImgZoomWindow (str, w,h,options)
{
	var file = '' + str;	
  var padding; 
  (navigator.appName == "Microsoft Internet Explorer") ? (padding = 10) : (padding = 0); 

  var screenw = screen.availWidth; 
  var screenh = screen.availHeight; 
  var winw = (w + 15 + padding); 
  var winh = (h + 15 + padding); 
  var posx = (screenw / 2) - (winw / 2); 
  var posy = (screenh / 2) - (winh / 2); 

  var mywin = window.open(file,"","top="+posy+",left="+posx+",width="+winw+",height="+winh+",menubar=no,locationbar=no,statusbar=no,resizable=no,toolbar=no,dependent=yes,scrollbars=no");
   mywin.focus(); 

}
