function toggle_layer(checkbox, element_name)
{
	var svgobj = document.embeds["map"].getSVGDocument().getElementById(element_name);
    	if (!checkbox.checked)
      	{
		
		svgobj.setAttributeNS(null,'visibility','hidden');
		} 
	else 
		{
		svgobj.setAttributeNS(null,'visibility','visible');

		}

}

function zoom(k)
{

    svgdoc = document.embeds["map"].getSVGDocument();
    var root = svgdoc.firstChild;
    var oldx =root.currentTranslate.x ;
    var oldy = root.currentTranslate.y;
    var old_scale = root.currentScale;
    var new_scale = old_scale * k;
    root.currentScale = new_scale;
    tx = (548*0.5 ) - (new_scale/old_scale) * (548*0.5 - oldx) ;
    ty = (394*0.5 ) - (new_scale/old_scale) * (394*0.5 - oldy) ;
    kose_noktasix = 548 - tx;
    son_noktax = new_scale * 548;
    kose_noktasiy = 394 - ty;
    son_noktay = new_scale * 394;

    if(k ==1.1)
	{
		if(old_scale>14)
			{
                               root.currentScale = old_scale;
				return;
			}

	}
     if( k == 0.9  )
	{
	     if(son_noktax < kose_noktasix || tx>0 || son_noktay < kose_noktasiy || ty>0  )
			{
                 root.currentScale = old_scale;
        		 return;

			}
 	}
       
   root.currentTranslate.x=tx ;
   root.currentTranslate.y=ty;
          
}
	
function reset()
{
  svgdoc = document.embeds["map"].getSVGDocument()
  svgdoc.getElementById("con").setAttributeNS(null,"viewBox","-7691 -15000 38439 20000");
  root = svgdoc.firstChild;
  root.currentScale= 1;
  root.currentTranslate.x=0;		
  root.currentTranslate.y=0;	
}


	
function pan(yon)
{
	 svgdoc=document.embeds["map"].getSVGDocument();
	 root=svgdoc.firstChild;
	 var old_value=root.currentScale;
	
	 if ( yon == 'left')
	       {
                  old_x=root.currentTranslate.x;
		  x=old_x +  20;
                  if (x > 0)
			{
				return;


			}
                  else
			{

				 root.currentTranslate.x=x;
			}
	         
	       }
 if ( yon == 'right')
	       {
                  old_x=root.currentTranslate.x;
		  x=old_x -  20;
                  t = old_value*548 - 548 +  x;
                  
                  if (t < 0)
			{
				return;


			}
                  else
			{

				 root.currentTranslate.x=x;
			}
	         
	       }
 if ( yon == 'up')
	       {
                  old_y=root.currentTranslate.y;
		  y=old_y +  20;

                  if (y > 0)
			{
				return;


			}
                  else
			{

				 root.currentTranslate.y=y;
			}
	     
                }
		if ( yon == 'down')
	       {
                  old_y=root.currentTranslate.y;
		  y=old_y -  20;
                  t = old_value*394 - 394 +  y;
                  
                  if (t < 0)
			{
				return;


			}
                  else
			{

				 root.currentTranslate.y=y;
			}
		}
}
	

	
function view(parselid)

{
	var con =  document.embeds['map'].getSVGDocument();
    var x = Number(con.getElementById(parselid).getAttributeNS(null,"x"));
    var y = Number(con.getElementById(parselid).getAttributeNS(null,"y"));
    var yatay = Number(con.getElementById(parselid).getAttributeNS(null,"en"));
    var dikey =Number(con.getElementById(parselid).getAttributeNS(null,"boy"));
     con.getElementById("text1").setAttribute("visibility", "visible");
    con.getElementById("text1").setAttribute("x", x);
    con.getElementById("text1").setAttribute("y", y);
    con.getElementById("text1").setAttribute("fill", "orangered");
      
    svgdoc=document.embeds["map"].getSVGDocument();
	root=svgdoc.firstChild;
   	root.currentTranslate.x= -1072;
	root.currentTranslate.y= -383;
    root.currentScale = 3.107;
	document.embeds["map"].getSVGDocument().getElementById(parselid).setAttributeNS(null,"fill","orangered");
    var firma = document.embeds["map"].getSVGDocument().getElementById(parselid).getAttribute("firma");
    con.getElementById("text1").firstChild.nodeValue = firma;
        

      
 
}
function textGoster(evt) 
   {
     var element = evt.target;
     var text2 = document.getElementById("text1");
     renk = text2.getAttribute("fill");
     if (renk == "orangered")
     {
		return;

     }
     text2.setAttribute("visibility","visible");
      text2.setAttribute("visibility","visible");
      var minX = element.getAttribute("x");
      var minY = element.getAttribute("y");
      var en =element.getAttribute("en");
      var boy = element.getAttribute("boy");
      var x = minX ;
      var y = minY;
      var deger= element.getAttribute("firma");
      text2.firstChild.nodeValue = deger;

      text2.setAttribute("x",x);
      text2.setAttribute("y",y);
     
}




function firmaSayfa(evt)
{
	  var element = evt.target;
        var parselId = element.getAttributeNS(null,"id");
        firmaSayfasiAc(parselId);      
		firmaSayfasiAc2(parselId);
}
function printsvg()
{

    svgdoc = document.embeds[0].getSVGDocument();
    svgobj = svgdoc.getElementById('uydu');
    svgobj.setAttributeNS(null,'visibility','hidden');
    svgdoc.getElementById('con').setAttribute('viewBox','18000 -9500  15000 12500');
    url = window.location.search.substring(1);
    qs = url.split("&");
       
	
    kid = qs[0].split("=");
    id = kid[1];
    svgdoc.getElementById(id).setAttributeNS(null,"fill","orangered");
    root=svgdoc.firstChild;
    root.currentScale = 1.5;
    var firma = svgdoc.getElementById(id).getAttributeNS(null,"firma");

    var x =  svgdoc.getElementById(id).getAttributeNS(null,"x");
    var y =  svgdoc.getElementById(id).getAttributeNS(null,"y");
 svgdoc.getElementById("text1").setAttributeNS(null,"visibility", "visible");
    svgdoc.getElementById("text1").setAttributeNS(null,"x", x);
    svgdoc.getElementById("text1").setAttributeNS(null,"y", y);
    svgdoc.getElementById("text1").setAttributeNS(null,"fill", "orangered");
    svgdoc.getElementById("text1").firstChild.nodeValue = firma;
       
  

   
    

     //var OLECMDID = 8;
    //var PROMPT = 1; // 2 DONTPROMPTUSER
   // var WebBrowser = "<OBJECT ID='WebBrowser1' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></OBJECT>";
  //  document.body.insertAdjacentHTML("beforeEnd", WebBrowser);
 //   WebBrowser1.ExecWB(OLECMDID, PROMPT);
//    WebBrowser1.outerHTML = "";
 



} 

function printurlsvg(parselid)

{       
        //var parselid = 13206;

	    window.open("svgprint.html?id=" + parselid + "");


}

function firmaSayfasiAc(parselID) 
	{
		if (navigator.appName == 'Netscape') {
			window.open ("../index.php?s=15&parsel="+parselID+"","_parent");
		}
	}


