	var contentHeight = 0; 	// The total height of the content
	var visibleContentHeight = 0;	
	var scrollActive = false;
	
	var scrollHandleObj = false; // reference to the scroll handle
	var scrollHandleHeight = false;
	var scrollbarTop = false;
	var eventYPos = false;

	var scrollbuttonActive = false;
	var scrollbuttonDirection = false;
	var scrollbuttonSpeed = 2; // How fast the content scrolls when you click the scroll buttons(Up and down arrows)
	var scrollTimer = 10;	// Also how fast the content scrolls. By decreasing this value, the content will move faster	
	
	var scrollMoveToActive = false;
	var scrollMoveToYPosition = false;
	
	var operaBrowser = false;
	if(navigator.userAgent.indexOf('Opera')>=0)operaBrowser=1;
		
	function scrollDiv_startScroll(e)
	{
		if(document.all && !operaBrowser)e = event;
		scrollbarTop = document.getElementById('scrolldiv_theScroll').offsetTop;
		eventYPos = e.clientY;
		scrollActive = true;
	}
	
	function scrollDiv_stopScroll()
	{
		scrollActive = false;
		scrollbuttonActive = false;
		scrollMoveToActive = false;
	}
	function scrollDiv_scroll(e)
	{
		if(!scrollActive)return;
		if(document.all && !operaBrowser)e = event;
		if(e.button!=1 && document.all)return;
		var topPos = scrollbarTop + e.clientY - eventYPos; 
		if(topPos<0)topPos=0;
		if(topPos/1>visibleContentHeight-(scrollHandleHeight+4)/1)topPos = visibleContentHeight-(scrollHandleHeight+4);
		document.getElementById('scrolldiv_theScroll').style.top = topPos + 'px';
		document.getElementById('scrolldiv_content').style.top = 0 - Math.floor((contentHeight) * ((topPos)/(visibleContentHeight-scrollHandleHeight)))+'px' 
	}
	
	/*
	Click on the slider
	Move the content to the this point
	*/
	function scrolldiv_scrollMoveToInit(e)
	{		
		if(document.all && !operaBrowser)e = event;
		scrollMoveToActive = true;
		scrollMoveToYPosition = e.clientY - document.getElementById('scrolldiv_scrollbar').offsetTop;
		if(document.getElementById('scrolldiv_theScroll').offsetTop/1 > scrollMoveToYPosition) scrollbuttonDirection = scrollbuttonSpeed*-2; else  scrollbuttonDirection = scrollbuttonSpeed*2;
		scrolldiv_scrollMoveTo();	
	}
	
	function scrolldiv_scrollMoveTo()
	{
		if(!scrollMoveToActive || scrollActive)return;
		var topPos = document.getElementById('scrolldiv_theScroll').style.top.replace('px','');
		topPos = topPos/1 + scrollbuttonDirection;
		if(topPos<0){
			topPos=0;
			scrollMoveToActive=false;
		}
		if(topPos/1>visibleContentHeight-(scrollHandleHeight+4)/1){
			topPos = visibleContentHeight-(scrollHandleHeight+4);	
			scrollMoveToActive=false;
		}
		if(scrollbuttonDirection<0 && topPos<scrollMoveToYPosition-scrollHandleHeight/2)return;	
		if(scrollbuttonDirection>0 && topPos>scrollMoveToYPosition-scrollHandleHeight/2)return;			
		document.getElementById('scrolldiv_theScroll').style.top = topPos + 'px';
		document.getElementById('scrolldiv_content').style.top = 0 - Math.floor((contentHeight) * ((topPos)/(visibleContentHeight-scrollHandleHeight)))+'px' 		
		setTimeout('scrolldiv_scrollMoveTo()',scrollTimer);		
	}
	
	function cancelEvent()
	{
		return false;			
	}

	function scrolldiv_scrollButton()
	{
		if(this.id=='scrolldiv_scrollDown')scrollbuttonDirection = scrollbuttonSpeed; else scrollbuttonDirection = scrollbuttonSpeed*-1;
		scrollbuttonActive=true;
		scrolldiv_scrollButtonScroll();
	}
	function scrolldiv_scrollButtonScroll()
	{
		if(!scrollbuttonActive)return;
		var topPos = document.getElementById('scrolldiv_theScroll').style.top.replace('px','');
		topPos = topPos/1 + scrollbuttonDirection;
		if(topPos<0){
			topPos=0;
			scrollbuttonActive=false;
		}
		if(topPos/1>visibleContentHeight-(scrollHandleHeight+4)/1){
			topPos = visibleContentHeight-(scrollHandleHeight+4);	
			scrollbuttonActive=false;
		}	
		document.getElementById('scrolldiv_theScroll').style.top = topPos + 'px';
		document.getElementById('scrolldiv_content').style.top = 0 - Math.floor((contentHeight) * ((topPos)/(visibleContentHeight-scrollHandleHeight)))+'px' 			
		setTimeout('scrolldiv_scrollButtonScroll()',scrollTimer);
	}
	function scrolldiv_scrollButtonStop()
	{
		scrollbuttonActive = false;
	}
	
	
	function scrolldiv_initScroll()
	{
		visibleContentHeight = document.getElementById('scrolldiv_scrollbar').offsetHeight ;
		contentHeight = document.getElementById('scrolldiv_content').offsetHeight - visibleContentHeight;		
		scrollHandleObj = document.getElementById('scrolldiv_theScroll');
		scrollHandleHeight = scrollHandleObj.offsetHeight;
		scrollbarTop = document.getElementById('scrolldiv_scrollbar').offsetTop;		
		document.getElementById('scrolldiv_theScroll').onmousedown = scrollDiv_startScroll;
		document.body.onmousemove = scrollDiv_scroll;
		document.getElementById('scrolldiv_scrollbar').onselectstart = cancelEvent;
		document.getElementById('scrolldiv_theScroll').onmouseup = scrollDiv_stopScroll;
		if(document.all)document.body.onmouseup = scrollDiv_stopScroll; else document.documentElement.onmouseup = scrollDiv_stopScroll;
		document.getElementById('scrolldiv_scrollDown').onmousedown = scrolldiv_scrollButton;
		document.getElementById('scrolldiv_scrollUp').onmousedown = scrolldiv_scrollButton;
		document.getElementById('scrolldiv_scrollDown').onmouseup = scrolldiv_scrollButtonStop;
		document.getElementById('scrolldiv_scrollUp').onmouseup = scrolldiv_scrollButtonStop;
		document.getElementById('scrolldiv_scrollUp').onselectstart = cancelEvent;
		document.getElementById('scrolldiv_scrollDown').onselectstart = cancelEvent;
		document.getElementById('scrolldiv_scrollbar').onmousedown = scrolldiv_scrollMoveToInit;
	}
	/*
	Change from the default color
	*/	
	function scrolldiv_setColor(rgbColor)
	{
		document.getElementById('scrolldiv_scrollbar').style.borderColor = rgbColor;
		document.getElementById('scrolldiv_theScroll').style.backgroundColor = rgbColor;
		document.getElementById('scrolldiv_scrollUp').style.borderColor = rgbColor;
		document.getElementById('scrolldiv_scrollDown').style.borderColor = rgbColor;
		document.getElementById('scrolldiv_scrollUp').style.color = rgbColor;
		document.getElementById('scrolldiv_scrollDown').style.color = rgbColor;
		document.getElementById('scrolldiv_parentContainer').style.borderColor = rgbColor;
	}
	/*
	Setting total width of scrolling div
	*/
	function scrolldiv_setWidth(newWidth)
	{
		document.getElementById('dhtmlgoodies_scrolldiv').style.width = newWidth + 'px';
		document.getElementById('scrolldiv_parentContainer').style.width = newWidth-15 + 'px';		
	}
	
	/*
	Setting total height of scrolling div
	*/
	function scrolldiv_setHeight(newHeight)
	{
		document.getElementById('dhtmlgoodies_scrolldiv').style.height = newHeight + 'px';
		document.getElementById('scrolldiv_parentContainer').style.height = newHeight + 'px';
		document.getElementById('scrolldiv_slider').style.height = newHeight + 'px';
		document.getElementById('scrolldiv_scrollbar').style.height = newHeight + 'px';		
	}
	/*
	Setting new background color to the slider 
	*/
	function setSliderBgColor(rgbColor)
	{
		document.getElementById('scrolldiv_scrollbar').style.backgroundColor = rgbColor;
		document.getElementById('scrolldiv_scrollUp').style.backgroundColor = rgbColor;
		document.getElementById('scrolldiv_scrollDown').style.backgroundColor = rgbColor;
	}
	/*
	Setting new content background color
	*/
	function setContentBgColor(rgbColor)
	{
		document.getElementById('scrolldiv_parentContainer').style.backgroundColor = rgbColor;
	}
	
	/*
	Setting scroll button speed
	*/
	function setScrollButtonSpeed(newScrollButtonSpeed)
	{
		scrollbuttonSpeed = newScrollButtonSpeed;
	}
	/*
	Setting interval of the scroll
	*/
	function setScrollTimer(newInterval)
	{
		scrollTimer = newInterval;
	}
	
	
	function checkme(width){
	    if(width)
	    {
	        scrolldiv_setWidth(width);
	    }
	    	
		var divScrollHeight = document.getElementById('scrolldiv_content').offsetHeight;
		if(divScrollHeight>380 && PageId != 'L325' && PageId != 'L43' && PageId != 'L701')
	      {
	        scrolldiv_setColor('');
	        setSliderBgColor('');
	        setContentBgColor('');
	        setScrollButtonSpeed(1);
	        setScrollTimer(1);	
	        if(!width)
	        {
	        scrolldiv_setWidth(620);	
	        scrolldiv_setHeight(400);	
	        }
	        else
	        {
				scrolldiv_setHeight(400);
	        }
	        scrolldiv_initScroll();	
	      }
	      else
	      {
	        document.getElementById('scrolldiv_slider').style.display='none';
	        document.getElementById('scrolldiv_content').style.width = '96%';
	        document.getElementById('dhtmlgoodies_scrolldiv').style.width = '99%';
	        document.getElementById('scrolldiv_parentContainer').style.width = '99%';
	      }
		
		  footerFix();
		  //$innerHTML('alt','<div style="position:absolute;height:95px;width:100px;left:0px;cursor:pointer;" onclick="window.open(\'http://www.koc.com.tr\',\'_blank\');"></div>');
	}
	
	
	
/* ---------------------------------- footer fix ------------------------------------- */
function footerFix()
{
	/*baskiBoyu = parseInt(document.body.offsetHeight);
	divBoyu = document.getElementById('alt').offsetHeight;
	divUst = document.getElementById('ust').offsetHeight;
	divOrta = document.getElementById('orta').offsetHeight;
	Height = parseInt(divUst+divOrta+divBoyu);
	
	var sayfaEni = 0, sayfaBoyu = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    sayfaBoyu = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    sayfaBoyu = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    sayfaBoyu = document.body.clientHeight;
  }
 	
		if(sayfaBoyu>Height)
		{
			document.getElementById('alt').className = 'altAbsolute';
		}
		else
		{
			document.getElementById('alt').className = 'altNormal';
		}
	
	window.onresize = function() {
		footerFix();
	}
	*/
}


/* ---------------------------------- openPicture ----------------------------------*/
function resimleriLinkle(){
	    if(seviye1 == 'L44' || seviye1 == 'L692'){
			var resim = document.getElementsByTagName('img');
				for(i=0;i<resim.length;i++){
					if(resim[i].src.indexOf('urun/') != -1){
						resim[i].onclick = function(){
							var yeniResimAdresi = this.src.replace('.gif','.jpg');
							openPictureWindow(yeniResimAdresi,'RMK Naval');
							return true;
						};
						
						resim[i].style.cursor = 'pointer';
					}
				}
		}
	}
		
		
function resimleriLinkleIceik(){
	    if(seviye1 == 'L43' || seviye1 == 'L691'){
			var resim = document.getElementsByTagName('img');
				for(i=0;i<resim.length;i++){
					if(resim[i].src.indexOf('icerik/') != -1){
						resim[i].onclick = function(){
							var yeniResimAdresi = this.src.replace('icerik/','icerik/buyuk/');
							openPictureWindow(yeniResimAdresi,'RMK Naval');
							return true;
						};
						
						resim[i].style.cursor = 'pointer';
					}
				}
		}
	}		
		
	function openPictureWindow(resimURL,resimALT,galeri) {
		if(galeri == 'galeri'){
				resimURL = '/naval/images/galeri/'+resimURL+'.jpg';
			}
		newWindow = window.open("","newWindow","width=80,height=80,resizable=1,scrollbars=yes");
		newWindow.document.open();
		newWindow.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//TR" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
		newWindow.document.write('<html xmlns="http://www.w3.org/1999/xhtml">');
		newWindow.document.write('<head><script language="javascript">function boyutlandir(alfa){genislik=eval(alfa.offsetWidth)+80;yukseklik=eval(alfa.offsetHeight)+200;if(yukseklik-200>eval(alfa.offsetHeight)){yukseklik = eval(alfa.offsetHeight-200)}else{yukseklik = eval(alfa.offsetHeight+210)} window.resizeTo(genislik+10,yukseklik);');
		newWindow.document.write('}</' + 'script>');
		newWindow.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />');
		newWindow.document.write('<title>RMK Naval </title>');
		newWindow.document.write('<style>');
		newWindow.document.write('body{margin:0px;padding:0px;width:100%;height:auto;background:#379CCC url(/naval/images/popup/arkaplan.gif) left top repeat-x ;}');
		newWindow.document.write('div#top{margin:0px;height:79px;padding-top:7px;width:100%;display:block;background:url(/naval/images/popup/logo_back.gif) left top repeat-x;}');
		newWindow.document.write('div#kapat{position:absolute;top:31px;right:13px;display:block;}');
		newWindow.document.write('div#logo{margin-left:14px;background:url(/naval/images/popup/logo.gif) left top no-repeat;width:147px;display:block;height:72px;}');
		newWindow.document.write('#picDiv{background:#fff;display:block;padding:5px 7px 5px 5px;margin:0 20px;width:auto;border:solid 3px #eee;}	');
		newWindow.document.write('</style>');
		newWindow.document.write('</head>');
		newWindow.document.write('<body>');
		newWindow.document.write('	<div id="top">');
		newWindow.document.write('    	<div id="logo"></div>');
		newWindow.document.write('        <div id="kapat"><a href="javascript:;" onclick="self.close();"><img src="/naval/images/popup/btn_kapat.gif" alt="" border="0"/></a></div>');
		newWindow.document.write('    </div>');
		newWindow.document.write('				<table id="picDiv"><tr><td>');
		newWindow.document.write('        	<img src="' + resimURL + '" id="resim" alt="'+ resimALT +'"   onload="boyutlandir(resim)" />');
		newWindow.document.write('        </td></tr></table>');
		newWindow.document.write('</body>');
		newWindow.document.write('</html>');
		newWindow.document.close();
		newWindow.focus();
	}
	
/*----------------------basın odası notları ----------------------*/

function pressDisplay(id){
	i=1;
	while($('basin'+i)){
			var did = 'basin'+i;
			if(id == did && $(did).style.display=='none')
			{
			$open(did);
			checkme();
			}
			else 
			{
			$close(did);
			checkme();
			}
			i++;
		}
	}
	
/* --------------------------------------------------------------------------------------- */

function $(id)
{
	return document.getElementById(id);
}
function $v(id)
{
	return document.getElementById(id).value;
}
function $tag(tagname)
{
	return document.getElementsByTagName(tagname);
}
function cssC(id,tag,yenideger)
{
	satir = '$(id).style.'+tag+' = yenideger';
	eval(satir);
}

function $class(id,newclass)
{
	$(id).className = newclass;
}

function $focus(id)
{
		$(id).style.border = 'solid 2px #c00';
}

function $blur(id)
	{
		$(id).style.border = $sd();
	}


function $innerHTML(id,html)
{
	$(id).innerHTML += html;
}

function $a(href)
{
    window.location = (href);
}

function $ot(id)//open.toggle açılan menüler için
{
    if($(id).style.display=='none')
    {
        $(id).style.display='block';
    }
    else
    {
        $(id).style.display='none';
    }
}

function $open(id){
		$(id).style.display='block';
	}
function $close(id){
		if($(id).style.display == 'block')
		{
			$(id).style.display='none';
		}
	}

