function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		anaSayfa_over = newImage("images/anaSayfa-over.gif");
		hakkimizda_over = newImage("images/hakkimizda-over.gif");
		hizmetlerimiz_over = newImage("images/hizmetlerimiz-over.gif");
		referanslarimiz_over = newImage("images/referanslarimiz-over.gif");
		mevzuat_over = newImage("images/mevzuat-over.gif");
		linkler_over = newImage("images/linkler-over.gif");
		iletisim_over = newImage("images/iletisim-over.gif");
		preloadFlag = true;
	}
}

//News
var interval;
yukseklik=0; 
ust=yukseklik;
HrCursor=0;
HrCursorTop=0;
dikeyuzunluk=200
speed=75
waitingspeed=1000

function ayarla()
{
	yukseklik=document.all.news.offsetHeight;				
	if (document.all('hr0')!=null)
	{HrCursorTop=document.all('hr0').offsetTop;	
	}				
	if (yukseklik==0) {setTimeout("ayarla()",60)};				
}

function dongu()
{
	if (ust<=-yukseklik) {ust=dikeyuzunluk};
	if (scrolling) 
	{
	ust=ust-1;
	document.all.news.style.top=ust;
	}
	if (ust==-HrCursorTop)
	{	
	cursorchange();
	interval=setTimeout("dongu()",waitingspeed)
	}
	else
	{
	interval=setTimeout("dongu()",speed)
	}
}

function cursorchange()
{
	HrCursor=HrCursor+1;
	if (document.all('hr'+HrCursor)!=null)
	{ HrCursorTop=document.all('hr'+HrCursor).offsetTop;	
	}
	else
	{
	HrCursor=0;
	HrCursorTop=0;
	if (document.all('hr0')!=null)
		{HrCursorTop=document.all('hr0').offsetTop;
		}
	}				
}

function NewsWrite(SubDikeyuzunluk,SubSpeed,SubWaitingspeed)
{
dikeyuzunluk=SubDikeyuzunluk
speed=SubSpeed
waitingspeed=SubWaitingspeed
scrolling=true
document.all('news').innerHTML='<label onmousemove="javascript:scrolling=false;" onmouseout="javascript:scrolling=true;" > '
  + document.all('news').innerHTML +'</label>'
ayarla();
dongu();	
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function mOvr(src,clrOver) {
    if (!src.contains(event.fromElement)) {
	  //src.style.cursor = 'hand';
	  src.bgColor = clrOver;	  
	}
  }

 function mOut(src,clrIn) {
		if (!src.contains(event.toElement)) {
			src.style.cursor = 'default';
			src.bgColor = clrIn;
		}
  }

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

 function ShowHideBlock(blockId)
        {
            if (document.getElementById(blockId).style.display == "block")
            {
                document.getElementById(blockId).style.display = "none";
            }
            else
            {
                document.getElementById(blockId).style.display = "block";
            }
        }

function openDocument(docURL, w, h) {
 var opt='scrollbars=no,toolbar=no,status=no,menubar=no,width='+w+',height='+h+',left=100,top=100';
 imgWin = window.open(docURL,'',opt);
}

function getScreenSize() {
    var screenW = 1024, screenH = 768;
    if (parseInt(navigator.appVersion)>3) {
    screenW = screen.width;
    screenH = screen.height;
    }
    else if (navigator.appName == "Netscape" && parseInt(navigator.appVersion)==3 && navigator.javaEnabled()) {
        var jToolkit = java.awt.Toolkit.getDefaultToolkit();
        var jScreenSize = jToolkit.getScreenSize();
        screenW = jScreenSize.width;
        screenH = jScreenSize.height;
    }
    return new Array(screenW, screenH);
}

function popImage(pictureID) 
        {
            var screen = getScreenSize();
            var opt='scrollbars=no,width=150,height=100,left=100,top=100';
            
            imgWin = window.open('','',opt);
            with (imgWin.document) {
                    writeln('<html><head><title>...</title><style type="text/css">body { margin: auto; margin:0; padding: 0;}</style>');
                    writeln('<sc'+'ript type="text/javascript">');
                    writeln('function resizePopup() {');
                    writeln('width = document.images[0].width ; ');
                    writeln('height = document.images[0].height ; ');
                    writeln('if ('+ screen[0]+' < width || '+screen[1]+' < height) { width = '+screen[0]+'/2; height='+screen[1]+'/2; document.images[0].width = width; document.images[0].height = height;}');
                    writeln('window.resizeTo(width+10, height+70);');
                    writeln('if (window.innerWidth) { window.innerWidth = width ; window.innerHeight = height; }');
                    writeln('}');
                    writeln('</s' + 'cript>');
                    writeln('</head><body bgcolor="#ffffff" onload="resizePopup();">')
                    writeln('<img src="../Picture/PictureHandler.ashx?pictureID='+pictureID+'" onclick="window.close();" border="0" style="position: absolute; left: 0px; top: 0px; cursor: pointer;"/></body></html>');
                    close();
            }
        }
        
 function change_picture(img_name, img_src) 
        {
            var image = document.getElementById(img_name);
            image.setAttribute("src", img_src);            
        }  
                 

function SwitchMenu3(obj, obj_header){
    if(document.getElementById){
        var el = document.getElementById(obj);        
        var header = document.getElementById(obj_header);        
        if(el.style.display != "block"){ 
            var ar = document.getElementById("master_menu").getElementsByTagName("div"); 
            for (var i=0; i<ar.length; i++){
                if (ar[i].className=="sub_product_category_list") 
                    ar[i].style.display = "none";
                if ((ar[i].className=="product_category_list_selected") || (ar[i].className=="product_category_list")) 
                    ar[i].className="product_category_list";
            }
            el.style.display = "block";
            header.className = "product_category_list_selected";
        }
        else{
            el.style.display = "none";
            header.className = "product_category_list";
        }
    }
}                 