﻿var url_statshome = 'istatistik.asp';
var ajaxObjects = new Array();
var leftmenuinited = false;

function showStatsHome(ajaxIndex){
	document.getElementById('divist').innerHTML = ajaxObjects[ajaxIndex].response;
	ajaxObjects[ajaxIndex]=false;
}

function ajaxStatsHome(){
    var ajaxIndex = ajaxObjects.length;
    ajaxObjects[ajaxIndex] = new sack();
    ajaxObjects[ajaxIndex].requestFile = url_statshome;
    ajaxObjects[ajaxIndex].onCompletion = function(){showStatsHome(ajaxIndex);};
    ajaxObjects[ajaxIndex].runAJAX();	
}

	/************************************************************************************************************
  Sol Menu
	************************************************************************************************************/

	var timeBeforeAutoHide = 700;	// Microseconds to wait before auto hiding menu(1000 = 1 second)
	var slideSpeed_out = 1000;	// Steps to move sub menu at a time ( higher = faster)
	var slideSpeed_in = 1000;
		
	var slideTimeout_out = 25;	// Microseconds between slide steps ( lower = faster)
	var slideTimeout_in = 10;	// Microseconds between slide steps ( lower = faster)
	
	var showSubOnMouseOver = true;	// false = show sub menu on click, true = show sub menu on mouse over
	var fixedSubMenuWidth = false;	// Width of sub menu items - A number(width in pixels) or false when width should be dynamic
	
	var xOffsetSubMenu = 0; 	// Offset x-position of sub menu items - use negative value if you want the sub menu to overlap main menu
	
	var slideDirection = 'right';	// Slide to left or right ?
	
	/* Don't change anything below here */
	
	var activeSubMenuId = false;
	var activeMainMenuItem = false;
	var currentZIndex = 1000;		
	var autoHideTimer = 0;
	var submenuObjArray = new Array();
	var okToSlideInSub = new Array();
	var subPositioned = new Array();
	
	function stopAutoHide()
	{
		autoHideTimer = -1;
	}
	function initAutoHide()
	{
		autoHideTimer = 0;
		if(autoHideTimer>=0)autoHide();
	}
	function autoHide()
	{
		if(autoHideTimer>timeBeforeAutoHide)
		{
			if(activeMainMenuItem){
				activeMainMenuItem.className='';
				activeMainMenuItem = false;
			}
			
			if(activeSubMenuId){
				var obj = document.getElementById('subMenuDiv' + activeSubMenuId);
				showSub();
			}
		}else{
			if(autoHideTimer>=0){
				autoHideTimer+=50;
				setTimeout('autoHide()',50);
			}
		}
	}	
	function getTopPos(inputObj)
	{		
	  var returnValue = inputObj.offsetTop;
	  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetTop;
	  return returnValue;
	}
	
	function getLeftPos(inputObj)
	{
	  var returnValue = inputObj.offsetLeft;
	  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
	  return returnValue;
	}
	function showSub()
	{
		var subObj = false;
		if(this && this.tagName){
			var numericId = this.parentNode.id.replace(/[^0-9]/g,'');
			okToSlideInSub[numericId] = false;
			var subObj = document.getElementById('subMenuDiv' + numericId);
			if(activeMainMenuItem)activeMainMenuItem.className='';
			if(subObj){
				if(!subPositioned[numericId]){
					if(slideDirection=='right'){
						subObj.style.left = getLeftPos(submenuObjArray[numericId]['parentDiv']) + submenuObjArray[numericId]['parentDiv'].offsetWidth + xOffsetSubMenu + 'px';
					}else{
						subObj.style.left = getLeftPos(submenuObjArray[numericId]['parentDiv']) + xOffsetSubMenu + 'px';
						
					}
					submenuObjArray[numericId]['left'] = subObj.style.left.replace(/[^0-9]/g,'');
					subObj.style.top = getTopPos(submenuObjArray[numericId]['parentDiv']) + 'px';
					subPositioned[numericId] = true;
				}				
				subObj.style.visibility = 'visible';
				subObj.style.zIndex = currentZIndex;
				currentZIndex++;	
				this.className='activeMainMenuItem';
				activeMainMenuItem = this;
			}
		}else{
			var numericId = activeSubMenuId;
		}
		if(activeSubMenuId && (numericId!=activeSubMenuId || !subObj))slideMenu(activeSubMenuId,(slideSpeed_in*-1));
		if(numericId!=activeSubMenuId && this && subObj){
			subObj.style.width = '0px';	
			slideMenu(numericId,slideSpeed_out);
			activeSubMenuId = numericId;
		}else{
			if(numericId!=activeSubMenuId)activeSubMenuId = false;
		}
		if(showSubOnMouseOver)stopAutoHide();
	}
	function slideMenu(menuIndex,speed){
		var obj = submenuObjArray[menuIndex]['divObj'];
		var obj2 = submenuObjArray[menuIndex]['ulObj'];
		var width = obj.offsetWidth + speed;
		if(speed<0){
			if(width<0)width = 0;
			obj.style.width = width + 'px';
			if(slideDirection=='left'){
				obj.style.left = submenuObjArray[menuIndex]['left'] - width + 'px';
				obj2.style.left = '0px';
			}else{
				obj2.style.left = width - submenuObjArray[menuIndex]['width'] + 'px' 
			}
			if(width>0 && okToSlideInSub[menuIndex])setTimeout('slideMenu(' + menuIndex + ',' + speed + ')',slideTimeout_in); else{
				obj.style.visibility = 'hidden';
				obj.style.width = '0px';
				if(activeSubMenuId==menuIndex)activeSubMenuId=false;
			}
		}else{
			if(width>submenuObjArray[menuIndex]['width'])width = submenuObjArray[menuIndex]['width'];
			if(slideDirection=='left'){
				obj.style.left = submenuObjArray[menuIndex]['left'] - width + 'px';
				obj2.style.left = '0px';
			}else{
				obj2.style.left = width - submenuObjArray[menuIndex]['width'] + 'px' 
			}		
			
			obj.style.width = width + 'px';
			if(width<submenuObjArray[menuIndex]['width']){
				setTimeout('slideMenu(' + menuIndex + ',' + speed + ')',slideTimeout_out);
			}else{
				okToSlideInSub[menuIndex] = true;
			}
		}
	}
	function resetPosition()
	{
		subPositioned.length = 0;
	}
	function initLeftMenu()
	{
		var menuObj = document.getElementById('dhtmlgoodies_menu');	
		menuObj.style.display='block';
		var mainMenuItemArray = new Array();
		var mainMenuItem = menuObj.getElementsByTagName('LI')[0];
		while(mainMenuItem){
			if(mainMenuItem.tagName && mainMenuItem.tagName.toLowerCase()=='li'){
				mainMenuItemArray[mainMenuItemArray.length] = mainMenuItem;
				var aTag = mainMenuItem.getElementsByTagName('A')[0];
				if(showSubOnMouseOver)
					aTag.onmouseover = showSub;	
				else
					aTag.onclick = showSub;	
			}
			mainMenuItem = mainMenuItem.nextSibling;
		}		
		var lis = menuObj.getElementsByTagName('A');
		for(var no=0;no<lis.length;no++){
			if(!showSubOnMouseOver)lis[no].onmouseover = stopAutoHide;
			lis[no].onmouseout = initAutoHide;
			lis[no].onmousemove = stopAutoHide;
		}
		for(var no=0;no<mainMenuItemArray.length;no++){
			var sub = mainMenuItemArray[no].getElementsByTagName('UL')[0];
			if(sub){
				mainMenuItemArray[no].id = 'mainMenuItem' + (no+1);
				var div = document.createElement('DIV');
				div.className='dhtmlgoodies_subMenu';
				document.body.appendChild(div);
				div.appendChild(sub);
				if(slideDirection=='right'){
					div.style.left = getLeftPos(mainMenuItemArray[no]) + mainMenuItemArray[no].offsetWidth + xOffsetSubMenu + 'px';
				}else{
					div.style.left = getLeftPos(mainMenuItemArray[no]) + xOffsetSubMenu + 'px';
				}
				div.style.top = getTopPos(mainMenuItemArray[no]) + 'px';
				div.id = 'subMenuDiv' + (no+1);
				sub.id = 'submenuUl' + (no+1);
				sub.style.position = 'relative';	

				if(navigator.userAgent.indexOf('Opera')>=0){
					submenuObjArray[no+1] = new Array();
					submenuObjArray[no+1]['parentDiv'] = mainMenuItemArray[no];
					submenuObjArray[no+1]['divObj'] = div;
					submenuObjArray[no+1]['ulObj'] = sub;
					submenuObjArray[no+1]['width'] = sub.offsetWidth;
					submenuObjArray[no+1]['left'] = div.style.left.replace(/[^0-9]/g,'');
				}
				sub.style.left = 1 - sub.offsetWidth + 'px';	
				div.style.width = '1px';	
				if(navigator.userAgent.indexOf('Opera')<0){
					submenuObjArray[no+1] = new Array();
					submenuObjArray[no+1]['parentDiv'] = mainMenuItemArray[no];
					submenuObjArray[no+1]['divObj'] = div;
					submenuObjArray[no+1]['ulObj'] = sub;
					submenuObjArray[no+1]['width'] = sub.offsetWidth;
					submenuObjArray[no+1]['left'] = div.style.left.replace(/[^0-9]/g,'');
					if(fixedSubMenuWidth)submenuObjArray[no+1]['width'] = fixedSubMenuWidth;
				}					
					
			}			
		}
		menuObj.style.visibility = 'visible';
		window.onresize = resetPosition;
		ajaxStatsHome();
		this.leftmenuinited=true;
	}
/***********************************************
 Haber manşet 
***********************************************/
//Set tab to intially be selected when page loads:
//[which tab (1=first tab), ID of tab content to display]:
var initialtab=[1, "sc1"];
//Turn menu into single level image tabs (completely hides 2nd level)?
var turntosingle=0; //0 for no (default), 1 for yes
//Disable hyperlinks in 1st level tab images?
var disabletablinks=0; //0 for no (default), 1 for yes
////////Stop editting////////////////
var previoustab="";

if (turntosingle==1)
document.write('<style type="text/css">\n#tabcontentcontainer{display: none;}\n</style>');
function expandcontent(cid, aobject)
{
    if (disabletablinks==1) aobject.onclick=new Function("return false");
    if (document.getElementById)
    {
        highlighttab(aobject)
        if (turntosingle==0)
        {
            if (previoustab!="")
            document.getElementById(previoustab).style.display="none";
            //document.getElementById(previoustab+'u').style.display="none";
            document.getElementById(cid).style.display="block";
            //document.getElementById(cid+'u').style.display="block;"
            previoustab=cid;
        }
    }
}
function highlighttab(aobject)
{
    if (typeof tabobjlinks=="undefined") collecttablinks()
    for (i=0; i<tabobjlinks.length; i++) tabobjlinks[i].className="";
    aobject.className="current";
}
function collecttablinks()
{
    var tabobj=document.getElementById("tablist");
    tabobjlinks=tabobj.getElementsByTagName("A");
}
/***********************************************
  İlan Oluşturma
***********************************************/

//Specify display mode. 3 possible values are:
//1) "always"- This makes the fade-in box load each time the page is displayed
//2) "oncepersession"- This uses cookies to display the fade-in box only once per browser session
//3) integer (ie: 5)- Finally, you can specify an integer to display the box randomly via a frequency of 1/integer...
// For example, 2 would display the box about (1/2) 50% of the time the page loads.

var displaymode="oncepersession";

var enablefade="yes"; //("yes" to enable fade in effect, "no" to disable)
var autohidebox=["yes", 20]; //Automatically hide box after x seconds? [yes/no, if_yes_hide_after_seconds]
var showonscroll="yes"; //Should box remain visible even when user scrolls page? ("yes"/"no)
var IEfadelength=1; //fade in duration for IE, in seconds
var Mozfadedegree=0.05; //fade in degree for NS6+ (number between 0 and 1. Recommended max: 0.2)

////////No need to edit beyond here///////////

if (parseInt(displaymode)!=NaN)
  var random_num=Math.floor(Math.random()*displaymode);

function displayfadeinbox(){
  var ie=document.all && !window.opera;
  var dom=document.getElementById;
  iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body;
  objref=(dom)? document.getElementById("fadeinbox") : document.all.fadeinbox;
  var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset;
  var docwidth=(ie)? iebody.clientWidth : window.innerWidth;
  docheight=(ie)? iebody.clientHeight: window.innerHeight;
  var objwidth=objref.offsetWidth;
  objheight=objref.offsetHeight;
  objref.style.left=docwidth/2-objwidth/2+"px";
  objref.style.top=scroll_top+docheight/2-objheight/2+"px";

  if (showonscroll=="yes")
    showonscrollvar=setInterval("staticfadebox()", 50);

  if (enablefade=="yes" && objref.filters){
    objref.filters[0].duration=IEfadelength;
    objref.filters[0].Apply();
    objref.filters[0].Play();
  }
  objref.style.visibility="visible"
  if (objref.style.MozOpacity){
    if (enablefade=="yes")
      mozfadevar=setInterval("mozfadefx()", 90)
    else{
        objref.style.MozOpacity=1;
        controlledhidebox();
    }
  }
  else
    controlledhidebox();
}

function mozfadefx(){
  if (parseFloat(objref.style.MozOpacity)<1)
    objref.style.MozOpacity=parseFloat(objref.style.MozOpacity)+Mozfadedegree
  else{
    clearInterval(mozfadevar);
    controlledhidebox();
  }
}

function staticfadebox(){
  var ie=document.all && !window.opera;
  var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset;
  objref.style.top=scroll_top+docheight/2-objheight/2+"px";
}

function hidefadebox(){
  objref.style.visibility="hidden";
  if (typeof showonscrollvar!="undefined")
     clearInterval(showonscrollvar);
}

function controlledhidebox(){
  if (autohidebox[0]=="yes"){
    var delayvar=(enablefade=="yes" && objref.filters)? (autohidebox[1]+objref.filters[0].duration)*1000 : autohidebox[1]*1000;
    setTimeout("hidefadebox()", delayvar);
  }
}

function initfunction(){
  setTimeout("displayfadeinbox()", 100);
}

function get_cookie(Name) {
  var search = Name + "=";
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search);
    if (offset != -1) {
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1)
        end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end));
    }
  }
  return returnvalue;
}
