/*Copyright ©2006 Tüm hakları saklıdır.
MERKEZ GAZETE DERGİ BASIM YAYINCILIK SANAYİ VE TİCARET A.Ş.
BURADAKI FONKSIYONLARIN IZINSIZ KOPYALANMASI VE KULLANILMASI YASAKTIR!*/

var req = null;
var markermode = 0;
var isMarkersSaved=0;
var isAnyMarkers=0;
var x,y;
var postitmode=0;
var marker_counter = 0;
var thickness = 20;
var jg = null;
var markerbegin_x;
var markerbegin_y;
var prev_x;
var prev_y;
var ismarking = 0;
var currentpage = 0;
var currentpage_markers = null;
var currentpage_newmarkers = null;
var currentpage_deletedmarkers = null;
var currentpage_deletedpostit = new Array;
var currentpage_postit = null;
var newmarkerid = 0;
var curcolor = "#FFFF00";
var zoommode = false;
var lastpagedecimal = 0;
var noofpages = 0;
var gosterilen_sayfalar;
var zoomed_sayfalar;
var temp_saved_counter=0;
var savedpostit=0;
var current_postits=new Array;
var deleted=0;
var deletedCurrent=0;
var node_string= new Array;
var postitID=0;
var zIndex=350;
var template;
var theHandle;
var postitcount=0;
var savedpostit_count=0;
var postit_array=new Array;
var savedpostit_array=new Array;
var dataInner;
var draggable;
var noteID="";
var current_postit_node;
var editMode=0;
var data2Postit=new Array;
var dataLayer= new Array;
var deletedCurrentPostitArray=new Array;
function trial()
{
	alert("Linkler dergimize abone olduğunuzda aktif olacaktır");
}
function processPostitSil(evt)
{
        if (req.readyState == 4)
        {
                if (req.status == 200)
					alert("Sayfadaki notunuz silinmiştir.");
		}
}

function saveInDB(yayin_id,node_id,sayfa,coord_x,coord_y,note_data,editMode,note)
{
	    try
        {
                req = new ActiveXObject("Msxml2.XMLHTTP");
        }

        catch(e)
        {
                try
                {
                        req = new ActiveXObject("Microsoft.XMLHTTP");
                }

                catch(oc) { req = null; }
        }
        if (req == null && typeof XMLHttpRequest != "undefined")
        {
                req = new XMLHttpRequest();

        }

        if (req != null)
        {
			  req.onreadystatechange =function()
			  {
			       if (req.readyState == 4)
       			   {
               			 if (req.status == 200)
               			 {
							var postitLastId=req.responseText
							if(postitLastId ==-1)
							{
								alert("Lütfen kaydetmek için bir not yazın.");
							}
							else if(postitLastId ==0)
							{
								alert("Notunuz Kaydedilemedi. Lütfen Tekrar Deneyin.");
							}
							else if (postitLastId =="-100")
							{
								alert("Sadece hepoku üyelerinin notları kaydedilmektedir.");
							}
							else
							{
								if(editMode ==0)
								{
									node_string[node_id]=postitLastId;
								}
								alert("Notunuz sayfaya kaydedilmiştir.");
								
							}
						}
        			}		
			  };
			  req.open( "post", 'save_postit.php', true ); 
	req.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=ISO-8859-9'); 
	coord_x=coord_x-5;
			  req.send("yayin_id="+yayin_id +"&sayfa="+sayfa+"&coord_x="+coord_x+"&coord_y="+(coord_y-4)+"&note="+note_data+"&editmode="+editMode+"&noteID="+note);
		}
}
function SaveCurrentPostit(loc_x,loc_y,markerid,id,real_id)
{
		activePostIt_tosave=document.getElementById(markerid);
		var bottomArea=document.getElementById('Bottom'+id);
		var dataDivId_save="data"+id;
		var toolBarofPostit=document.getElementById('MyToolBar'+id);
		var subnodes=activePostIt_tosave.childNodes;
		for(var count=0;count<subnodes.length;count++)
		{
			if(subnodes[count].id ==dataDivId_save)
				var dataNode=subnodes[count];
			else if(subnodes[count].id =="MyToolBar"+id)
			{
				var toolbarSub=subnodes[count].childNodes;
				for(var counter=0;counter<toolbarSub.length;counter++)
				{
					if(toolbarSub[counter].id =="SaveMe")
						var saveMeLink=toolbarSub[counter];
					if(toolbarSub[counter].id =="Empty")
						var dummyLink=toolbarSub[counter];
					if(toolbarSub[counter].id =="EditMe")
						var editLink=toolbarSub[counter];
				}
			}
		}
		var dataSubNode=dataNode.childNodes[0];
		if(dataSubNode.value =="")
		{
			alert("Lütfen kaydetmek için bir not yazınız...");
			activePostIt_tosave.style.backgroundColor="#FFF";
	dataNode.innerHTML='<textarea name="'+dataDivId_save+'_text" id="'+dataDivId_save+'_text" wrap="hard" style="padding:0px;margin=0px;height:103px;width:200px;overflow:auto;border:none;background-color:#FFF;" cols="15" rows="5"></textarea>';
	dataNode.focus();
			return false;
		}
		else
		{
			Drag.stopDrag(toolBarofPostit,activePostIt_tosave);
			Drag.stopDrag(bottomArea,activePostIt_tosave);
			bottomArea.style.cursor="default";
			toolBarofPostit.style.cursor="default";
		}
	    try
        {
                req = new ActiveXObject("Msxml2.XMLHTTP");
        }

        catch(e)
        {
                try
                {
                        req = new ActiveXObject("Microsoft.XMLHTTP");
                }

                catch(oc) { req = null; }
        }

        if (req == null && typeof XMLHttpRequest != "undefined")
        {
                req = new XMLHttpRequest();

        }

        
        if (req != null)
        {
			  req.onreadystatechange =function()
			  {
			       if (req.readyState == 4)
       			   {
                		
               			 if (req.status == 200)
               			 {
							if (req.responseText ==1)
								alert("Notunuz Güncellenmiştir.");
							else
								alert("Bir hata oluştu. lütfen tekrar deneyin");
							var text=dataSubNode.value;
							var temp=text.replace(/\n/g, "<br>")
							currentNodeData
							dataNode.innerHTML=temp;
							dataNode.style.backgroundColor="#fdfdc4";
							saveMeLink.style.display="none";
							dummyLink.style.padding="0px 0px 0px 100px";
							activePostIt_tosave.style.backgroundColor="#fdfdc4";
							editLink.onclick=function ()
							{
								EditCurrentPostit(loc_x,loc_y,'eski',id,markerid,'',real_id,text.replace(/<BR>/g,"\n"));
							}
						 }
        			}		
			  };
			  req.open( "post", 'save_postit.php', true ); 
	req.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=ISO-8859-9'); 
var currentNodeData=dataSubNode.value.replace(/\n/g, "<br>");
req.send("yayin_id="+dergi_id +"&sayfa="+currentpage+"&coord_x="+loc_x+"&coord_y="+loc_y+"&note="+currentNodeData+"&editmode=1&noteID="+real_id);
		}

}

function EditCurrentPostit(pos_x,pos_y,eski_yeni,id,markerid,button,real_id,currentValue)
{
	var activePostIt=document.getElementById(markerid);
	var bottomArea=document.getElementById('Bottom'+id);
	activePostIt.style.backgroundColor="#FFF";
	var toolBarofPostit=document.getElementById('MyToolBar'+id);
	toolBarofPostit.style.cursor="move";
	Drag.init(toolBarofPostit,activePostIt,0,595,0,MaxHeight-20);
	Drag.init(bottomArea,activePostIt,0,595,0,MaxHeight-20);
	bottomArea.style.cursor="move";
	var subnode=activePostIt.childNodes;
	var dataDivId="data"+id;
	for(var count=0;count<subnode.length;count++)
	{
		if(subnode[count].id ==dataDivId)
		{
			var dataNode=subnode[count];
			var text=dataNode.innerHTML;
		}
		else if(subnode[count].id =="MyToolBar"+id)
		{
			var toolbarSub=subnode[count].childNodes;
			for(var counter=0;counter<toolbarSub.length;counter++)
			{
				if(toolbarSub[counter].id =="Empty")
				{
					var dummyDiv=toolbarSub[counter];
					dummyDiv.style.padding="0px 0px 0px 61px";
				}
				if(toolbarSub[counter].id =="SaveMe")
				{
					toolbarSub[counter].style.display="inline";
					toolbarSub[counter].onclick=function ()
					{
						SaveCurrentPostit(x,y,markerid,id,real_id);
					};
				}
				if(toolbarSub[counter].id =="EditMe")
					toolbarSub[counter].onclick="";
			}
		}
	}
	var tempData=text.replace(/<BR>/g,"\n");
	dataNode.style.backgroundColor="#FFF";
	dataNode.innerHTML='<textarea name="'+dataDivId+'_text" id="'+dataDivId+'_text" wrap="none" style="font-family:Verdana;font-size:12px;padding:0px;margin=0px;height:103px;width:200px;overflow:auto;border:none;background-color:#FFF;border:0px;" cols="16" rows="6">'+tempData+'</textarea>';
}
function deletePostit(eski_yeni,id,markerid,button,real_id)
{
	var ans=confirm("Notu silmek istediğinizden eminisiniz?");
	if(ans)
	{
			document.getElementById(markerid).style.visibility="hidden";
		if(eski_yeni == "eski")
		{
			currentpage_deletedpostit[deleted] =markerid;
			deleted++;
			var querystring2= "?delete=";
			querystring2 = querystring2 + real_id;
			loadXMLDoc('postit_sil','postit_sil.php'+querystring2+"&yayin_id="+dergi_id);
		}
		
		
	}
	}
function validCharacters(e)
{
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if( whichCode ==13)
		return false;
}
function noEntry(e)
{
	return false;
}

function setEditFor(targetLayer,oldLayer)
{
	document.getElementById(targetLayer).style.zIndex=201;
	document.getElementById(oldLayer).style.zIndex=200;
}
function isLastPageSon(current)
{
	if(current ==noofpages-2)
	{
		if(document.getElementById("son").style.display=="none") 
			document.getElementById("son").style.display="block";
			
		if(document.getElementById("sonbottom").style.display=="none") 
		document.getElementById("sonbottom").style.display="block";
	}
	else
	{
		if(document.getElementById("son").style.display=="block") 
			document.getElementById("son").style.display="none";
			
		if(document.getElementById("sonbottom").style.display=="block") 
			document.getElementById("sonbottom").style.display="none";
	}
	
}
function showSonSayfa()
{	
		if( (js_hemenoku ==0) && (js_showsepeteekle ==1) )
		{
			if(!zoommode)
			{
				document.getElementById("LastPage").style.display="block";
				document.getElementById("ShowSepet").style.display="block";
				document.getElementById("LastPage").style.opacity=.85;
				document.getElementById("LastPage").style.filter = 'alpha(opacity=' +85 + ')';
			}
		}
		else
		{
			if(!zoommode)
			{
				document.getElementById("son").style.display="none";
				document.getElementById("sonbottom").style.display="none";
				gotoPage(0);
			}
		}
}
function writeImpressions(evt)
{
        
        if (req.readyState == 4)
        {
               
                if (req.status == 200)
                {
					//alert(req.responseText);
                }
        }
}



function SaveNewMarkers()
{
	isMarkersSaved=1;
	isAnyMarkers=0;
	var querystring1= "param1=";
	var first2 = 1;
	for(var i=0;i<currentpage_newmarkers.length;i++)
	{
		if(currentpage_newmarkers[i])
		{
		if(first2==1)
		{
			first2 = 0;
		}
		else
		{
			querystring1 = querystring1 + ",";
		}
		var first = 1;
		for(var j in currentpage_newmarkers[i])
		{
			var prop = "";
			if(first==1)
			{
				first = 0;
			}
			else
			{
				prop = prop + ";";
			}
			prop = prop + j+":"+currentpage_newmarkers[i][j];
			querystring1 = querystring1 + prop;
			
		}
		}
	}

	var querystring2= "param2=";
	first2 = 1;
	for(var i=0;i<currentpage_deletedmarkers.length;i++)
	{
		if(first2==1)
		{
			first2 = 0;
		}
		else
		{
			querystring2 = querystring2 + ":";
		}

		querystring2 = querystring2 + currentpage_deletedmarkers[i]['ID'];

	}

	var querystring3 = "pageno="+currentpage;
	var querystring = "?"+querystring1+"&"+querystring2+"&"+querystring3;
	loadXMLDoc('kaydet','kaydet.php'+querystring);
	alert("Sayfadaki işaretleriniz kaydedildi.");
}
function processMaps(evt)
{
       
        if (req.readyState == 4)
        {
                
                if (req.status == 200)
                {
                		var map_counter = 0;
						_layer_map=document.getElementById("maplayer");
						_layer_map.style.zIndex=123;
                		currentpage_maps = new Array();
						_layer_map.innerHTML="";
						if(req.responseText.length != "")
						{
							var map_str = req.responseText.split("\n");
							for(var i=0;i<map_str.length;i++)
							{
								currentpage_maps[i] = new Array();
								var propss = map_str[i].split(";");
								
								
								for(var j=0;j<propss.length;j++)
								{
									var fields = propss[j].split("!");
									currentpage_maps[i][fields[0]] = fields[1];
									var targetPage;
									var mapid="map"+i;
									var clickAction;
									var link_type;currentpage_maps[i]['link_type'];
									if (currentpage_maps[i]['data'])
									{
										targetPage=currentpage_maps[i]['data'];
										link_type=currentpage_maps[i]['link_type'];
										if(link_type ==1)
											clickAction="zoomedPageFromIndex("+targetPage+");";
										else
											clickAction="goToURL('"+targetPage+"');";
										if (js_hemenoku ==1)
										{
									_layer_map.innerHTML +='<div title="'+currentpage_maps[i]['link_title']+'" onmouseout="outme(\''+mapid+'\');" onmouseover="overme(\''+mapid+'\');" onclick="'+clickAction+'" id="'+mapid+'"  style="cursor:pointer;position:absolute;top:'+currentpage_maps[i]['coord_y']+'px;left:'+currentpage_maps[i]['coord_x']+'px;height:'+currentpage_maps[i]['height']+'px;width:'+currentpage_maps[i]['width']+'px;"></div>';
										}
										else
										{
									_layer_map.innerHTML +='<div title="'+currentpage_maps[i]['link_title']+'" onmouseout="outme(\''+mapid+'\');" onmouseover="overme(\''+mapid+'\');" onclick="trial();" id="'+mapid+'"  style="cursor:pointer;position:absolute;top:'+currentpage_maps[i]['coord_y']+'px;left:'+currentpage_maps[i]['coord_x']+'px;height:'+currentpage_maps[i]['height']+'px;width:'+currentpage_maps[i]['width']+'px;"></div>';
										}
									}
								}
	
								map_counter = map_counter++;
	
							}
						}
                }
        }
}
function goToURL(addr)
{
	window.open(addr);
}
function overme(target)
{
		var mapObject=document.getElementById(target);
		mapObject.style.border="2px solid red";
}
function outme(target)
{
		var mapObject=document.getElementById(target);
		mapObject.style.border="none";
}
function zoomedPageFromIndex(page_number)
{
	var _plugin = _getPlugin('dergi');
	var pstr = "?page="+page_number;
	_plugin.SetVariable("/:__jsAction", "getPage");
	_plugin.SetVariable("/:__jsParams", pstr);
	_plugin.GotoFrame(39);
}
function processChange(evt)
{
       	
        if (req.readyState == 4)
        {
                
                if (req.status == 200)
                {
                		currentpage_newmarkers = new Array();

						newmarkerid = 0;
						currentpage_deletedmarkers = new Array();
                		var _layerpostit = document.getElementById('postitlayer');
                		var marker_counter = 0;
						var marker_counter_postit=0;
                		currentpage_markers = new Array();
						currentpage_deletedpostit = new Array();
						currentpage_postit = new Array();
						if(req.responseText.length != "")
						{
							var temp=req.responseText.split("<post_it>");
							var postit=temp[1].split("\n");
							if (postit =="")
								savedpostit=0;
							else
								savedpostit=postit.length;
							temp_saved_counter=savedpostit;
							_layerpostit.innerHTML = "";
							if (temp[1].length !="")
							{
							for(var count=0;count<postit.length;count++)
							{
								currentpage_postit[count] = new Array();
								var propsp = postit[count].split(";");
								for(var k=0;k<propsp.length;k++)
								{
									var fields = propsp[k].split(":");
	
									currentpage_postit[count][fields[0]] = fields[1];
								}
								marker_counter_postit = marker_counter_postit + 1;
								current_postits[count]='postit_eski'+count;
								var postitCoordX=currentpage_postit[count]['coord_left'];
								var postitCoordY=parseInt(currentpage_postit[count]['coord_top'])+20;
								var w=parseInt(currentpage_postit[count]['width'])-2;
								_layerpostit.innerHTML += '<div class="root" id="postit_eski'+count+'" style="border:1px solid #AFAFAF;cursor:default;z-index:140;text-align:left;overflow:none;position:absolute;background-color:#fdfdc4;left:'+currentpage_postit[count]['coord_left']+'px;top:'+currentpage_postit[count]['coord_top']+'px;width:'+w+'px;height:138px"><div style="cursor:move;padding-left:3px;" id="MyToolBar'+count+'" class="handleSaved" align="left"><strong>Not:</strong><span id="Empty" style="padding-left:100px;"></span><a id="SaveMe" style="display:none;" href="javascript:;" onclick=""><img src="i/post_kaydet.gif" width="39" align="absmiddle" height="15" vspace="3" /></a><a id="EditMe" style="padding-left:2px;" href="javascript:;" onclick="javascript:EditCurrentPostit('+postitCoordX+','+postitCoordY+',\'eski\','+count+',\'postit_eski'+count+'\',event.button,'+currentpage_postit[count]['ID']+');"><img src="i/post_duzenle.gif" align="absmiddle" height="15" vspace="3" /></a><a style="padding-left:2px;" href="javascript:;" onclick="javascript:deletePostit(\'eski\','+count+',\'postit_eski'+count+'\',event.button,'+currentpage_postit[count]['ID']+');"><img src="i/post_sil.gif" width="18" height="15" align="absmiddle" /></a></div><div style="position:absolute;height:10px;top:128px;left:0px;" id="Bottom'+count+'"><img align="right" width="10" height="10" src="i/post_rcrve.gif" alt="post_rcrve.gif" /></div><div style="font-size:12px;background-color:#fdfdc4;padding-top:2px;padding-left:2px;height:105px;width:200px;font-family:Verdana;overflow:auto;" id="data'+count+'">'+currentpage_postit[count]['note']+'</div></div>';
							}
						}
							var markers=temp[0].split("\n");
							_layer = document.getElementById('imagelayer');
							//document.getElementById('imagelayer').style.zIndex=-2;
							for(var i=0;i<markers.length;i++)
							{
								currentpage_markers[i] = new Array();
								var props = markers[i].split(";");
								for(var j=0;j<props.length;j++)
								{
									var fields = props[j].split(":");
	
									currentpage_markers[i][fields[0]] = fields[1];
								}
								marker_counter = marker_counter + 1;
								_layer.innerHTML += '<div title="İşareti silmek için mouse\'un sağ tuşuna tıklayın" id="marker_eski'+i+'"  onMouseUp="javascript:deleteMarker(\'eski\','+i+',this.id,event.button);" style="cursor:text;overflow:hidden;-moz-opacity:0.25;filter: alpha(opacity=25);position:absolute;background-color:#'+currentpage_markers[i]['color']+';left:'+currentpage_markers[i]['coord_left']+'px;top:'+currentpage_markers[i]['coord_top']+'px;width:'+currentpage_markers[i]['width']+'px;height:'+currentpage_markers[i]['height']+'px"></div>';
							}
						}
loadXMLDoc('showmaps','showmappings.php?pageno='+currentpage);
                }
        }
}
function processKaydet(evt)
{
        
        if (req.readyState == 4)
        {
               
                if (req.status == 200)
                {
					currentpage_newmarkers = new Array();
					newmarkerid = 0;
					currentpage_deletedmarkers = new Array();
					
					_layer = document.getElementById('imagelayer');
					_layer.innerHTML = "";
					var marker_counter = 0;
					currentpage_markers = new Array();
					var markers = req.responseText.split("\n");

					for(var i=0;i<markers.length;i++)
					{
					      currentpage_markers[i] = new Array();
					      var props = markers[i].split(";");
					      
					      for(var j=0;j<props.length;j++)
					      {

								var fields = props[j].split(":");

								currentpage_markers[i][fields[0]] = fields[1];
					      }

						  marker_counter = marker_counter + 1;

						  _layer.innerHTML += '<div id="marker_eski'+i+'" onMouseUp="javascript:deleteMarker(\'eski\','+i+',this.id,event.button);" style="overflow:hidden;-moz-opacity:0.25;filter: alpha(opacity=25);position:absolute;background-color:#'+currentpage_markers[i]['color']+';left:'+currentpage_markers[i]['coord_left']+'px;top:'+currentpage_markers[i]['coord_top']+'px;width:'+currentpage_markers[i]['width']+'px;height:'+currentpage_markers[i]['height']+'px"></div>';

                	}

                }
        }
}

function getObject(name)
{
        var ns4 = (document.layers) ? true : false;
        var w3c = (document.getElementById) ? true : false;
        var ie4 = (document.all) ? true : false;

        if (ns4) return eval('document.' + name);
        if (w3c) return document.getElementById(name);
        if (ie4) return eval('document.all.' + name);
        return false;
}
function testToggle() {

  var el = event.srcElement;
  while ((el.getAttribute("swap")==null) && (el.tagName!="BODY"))
	el = el.parentElement;
  return el;
}

function doSwapIt() {

  var el = testToggle();
  if (el.getAttribute("swap")!=null) {
	
	if (el.getAttribute("swap")!="") {
	  var temp = el.innerHTML;
	  el.innerHTML = el.getAttribute("swap");
	  el.setAttribute("swap", temp, false);
	}

	el.className = (el.className=="down") ? "up" : "down";
	markermode = (markermode==1) ? 0 : 1;
	if(markermode==1)
	{
		_layer = document.getElementById('imagelayer');
		_layer.style.cursor = "text";

		_layer2 = document.getElementById('colorpick_layer');
		_layer2.style.visibility = 'visible';


	}
	else
	{
		_layer = document.getElementById('imagelayer');


		_layer2 = document.getElementById('colorpick_layer');
		_layer2.style.visibility = 'hidden';
	}
	return true;
  }
  else
  {
  	return false;
  }
}

function doTestSelect() {

  var el = testToggle();
  return (el.getAttribute("swap")==null);
}


function isIE() {
	return ((navigator.userAgent.indexOf('MSIE') != -1) &&
		(navigator.userAgent.indexOf('Opera') == -1));
}
function _getPlugin(name) {
	return isIE() ? window[name] :
		window[name] != null ? window[name] :
		document[name];
}

function onColorSet()
{
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function changecolor(color)
{
	document.getElementById('imagelayer').style.zIndex=122;
	document.getElementById('postitlayer').style.zIndex=-2;
	document.getElementById("maplayer").style.zIndex=-1;
	var sarirenk = document.getElementById("sarirenk");
	var morrenk = document.getElementById("morrenk");
	var turuncurenk = document.getElementById("turuncurenk");
	var sarirenk_alt = document.getElementById("sarirenk_alt");
	var morrenk_alt = document.getElementById("morrenk_alt");
	var turuncurenk_alt = document.getElementById("turuncurenk_alt");
	if(color == "sari")
	{
		curcolor = "#FFFF00";
		sarirenk.src="i/buttons/t_marker_y_1.gif";
		morrenk.src="i/buttons/t_marker_m_0.gif";
		turuncurenk.src="i/buttons/t_marker_o_0.gif";

		sarirenk_alt.src="i/buttons/b_marker_y_1.gif";
		morrenk_alt.src="i/buttons/b_marker_m_0.gif";
		turuncurenk_alt.src="i/buttons/b_marker_o_0.gif";
	}
	else if(color == "turuncu")
	{
		curcolor = "#FF8000";
		sarirenk.src="i/buttons/t_marker_y_0.gif";
		morrenk.src="i/buttons/t_marker_m_0.gif";
		turuncurenk.src="i/buttons/t_marker_o_1.gif";

		sarirenk_alt.src="i/buttons/b_marker_y_0.gif";
		morrenk_alt.src="i/buttons/b_marker_m_0.gif";
		turuncurenk_alt.src="i/buttons/b_marker_o_1.gif";
	}
	else if(color == "mor")
	{
		curcolor = "#FF00FF";
		sarirenk.src="i/buttons/t_marker_y_0.gif";
		morrenk.src="i/buttons/t_marker_m_1.gif";
		turuncurenk.src="i/buttons/t_marker_o_0.gif";

		sarirenk_alt.src="i/buttons/b_marker_y_0.gif";
		morrenk_alt.src="i/buttons/b_marker_m_1.gif";
		turuncurenk_alt.src="i/buttons/b_marker_o_0.gif";
	}
	markermode = 1;
	_layer = document.getElementById('imagelayer');
	_layer.style.cursor = "text";

}
function OnImgUpdate( iProgress )
{
}

function OnImgCompletion()
{
  loadXMLDoc('showpage','showpage.php?pageno='+currentpage);
  document.getElementById("Resim").innerHTML="";
}
function writeToDB()
{
	if (gosterilen_sayfalar== null)
		gosterilen_sayfalar=0; 
	if (zoomed_sayfalar ==null)
		zoomed_sayfalar=0;
	        
        try
        {
                req = new ActiveXObject("Msxml2.XMLHTTP");
        }

        catch(e)
        {
                try
                {
                        req = new ActiveXObject("Microsoft.XMLHTTP");
                }

                catch(oc) { req = null; }
        }

        
        if (req == null && typeof XMLHttpRequest != "undefined")
        {
                req = new XMLHttpRequest();

        }

      
        if (req != null)
        {
			  req.onreadystatechange = writeImpressions;
			  req.open( "post", 'save_db.php', false ); 
			  req.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); 
			  req.send("gosterilen="+gosterilen_sayfalar +"&zoomed="+zoomed_sayfalar+"&dergi_id="+dergi_id);
		}
}
function VisitedPage(curpage)
{	
	if( js_hemenoku ==1)
	{
		left=curpage;
		right=curpage+1;
		if( curpage !=0)
		{
			if (gosterilen_sayfalar)
				gosterilen_sayfalar=gosterilen_sayfalar+left+"-"+right+"-";
			else
				gosterilen_sayfalar=left+"-"+right+"-";
		}
	}
}
function isLastPage(curpage)
{
	if ( (js_hemenoku ==1) &&(curpage+2 == noofpages) )
	{
		document.getElementById("son").style.display="none";
		document.getElementById("sonbottom").style.display="none";
		gotoPage(0);
	}
	else if( (curpage+2 == noofpages) && (js_hemenoku==0) && (js_showsepeteekle ==0))
	{
		document.getElementById("son").style.display="none";
		document.getElementById("sonbottom").style.display="none";
		gotoPage(0);
	}
	else if( (curpage+2 == noofpages) && (js_hemenoku==0) && (js_showsepeteekle ==1)) 
	{
		document.getElementById("LastPage").style.display="block";
		document.getElementById("ShowSepet").style.display="block";
		document.getElementById("LastPage").style.opacity=.85;
		document.getElementById("LastPage").style.filter = 'alpha(opacity=' +85 + ')';
	}
	else
	{
		document.getElementById("ShowSepet").style.display="none";
		document.getElementById("LastPage").style.display="none";
	}
}
function zoomToPage(pagepath,curpage)
{
	isMarkersSaved=0;
	markermode=0;
	if( js_hemenoku ==1)
	{
		if (zoomed_sayfalar)
			zoomed_sayfalar=zoomed_sayfalar+curpage+"-";
		else
			zoomed_sayfalar=curpage+"-";
	}
	if (document.getElementById("LastPage").style.display=="block")
	{
		document.getElementById("LastPage").style.display="none";
		document.getElementById("ShowSepet").style.display="none";
	}
	zoommode = true;
	
	document.getElementById("object_layer").style.height=js_tpl_height*2+"px";

	var _plugin = _getPlugin('dergi');
	_plugin.height = js_tpl_height*2;
	
	currentpage = curpage;

	_layer = document.getElementById('mylayer');
	markermode = 0;

	_layer.innerHTML = '<div style="z-index:11;width:5px;height:'+js_tpl_height*2+'px;background-image:url(i/ic_back.gif);"></div><div style="position:absolute;left:5px;top:0px;z-index:1;width:800px;height:'+js_tpl_height*2+'px;background-color:#FFFFFF;text-align:center;vertical-align:middle;font-size:20px;"><img src="i/loading.gif" width="112" height="132" border="0" style="padding-top:170px;"/></div><div id="Resim" style="position:absolute;left:5px;top:0;z-index:2;width:800px;height:'+js_tpl_height*2+'px;background-image:url('+pagepath+');"><img width="800" height="'+js_tpl_height*2+'" src="'+pagepath+'"></div><div id="imagelayer" style="position:absolute;left:5px;top:0;z-index:11;width:800px;height:'+js_tpl_height*2+'px;" onmousemove = "javascript:moveMarker(event.x || event.layerX,event.y || event.layerY,event.button);" onMouseDown="beginMarker(event.x || event.layerX,event.y || event.layerY,event.button);" onMouseUp="javascript:endMarker(event.x || (event.clientX-24),event.y || event.clientY,event.button);"></div><div style="position:absolute;left:805px;top:0px;z-index:11;width:5px;height:'+js_tpl_height*2+'px;background-image:url(i/ic_back.gif);"></div><div id="postitlayer" style="position:absolute;left:5px;top:0;z-index:11;width:800px;height:'+js_tpl_height*2+'px;"></div><div id="maplayer" style="position:absolute;left:5px;top:0;z-index:1;width:800px;height:'+js_tpl_height*2+'px;"></div><div style="position:absolute;left:805px;top:0px;z-index:11;width:5px;height:'+js_tpl_height*2+'px;background-image:url(i/ic_back.gif);"></div>';
	
	var szImages = new Array(pagepath);
	var oPreload = new ImagePreload( szImages, OnImgUpdate, OnImgCompletion );
	
	_layer = document.getElementById('uppertoolbar_layer');
	_layer.style.zIndex = 12;
	_layer.innerHTML= '<div id="MainPanel"><table align="left" width="680" border="0" cellspacing="0" cellpadding="0"><tr><td width="48"><img src="i/_void.gif" width="1" height="58" /></td><td width="37"><div id="upper_slider_layer" name = "upper_slider_layer" style="display:none;"></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:dezoomFromPage(0,0);"><img border="0" src="i/buttons/zoom_out.gif" alt="Küçült" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:gotoTOC_zoomed();"><img border=0 src="i/buttons/t_o_c.gif" alt="İçindekiler Sayfası" width="37" height="38" /></a></td><td width="5"></td><td width="37"><a href="javascript:PopUpFixed(\'oner.php?d_id='+dergi_id+'\', \'\', 400, 250, 100, 100);" ><img src="i/buttons/send_mail.gif" alt="Arkadaşına Gönder" width="37" height="38" /></a></td><td width="10"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td><td width="10"></td><td align="center"><a title="Kalemleri göster" href="javascript:;" onclick="switchPanel(\'MarkerPanel\',\'MainPanel\');"><img src="i/buttons/tepe_marker_ac_0.gif" border="0"></a></td><td width="10"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td><td align="center"><a title="Notları göster" href="javascript:;" onclick="switchPanel(\'PostItPanel\',\'MainPanel\');"><img src="i/buttons/tepe_post_ac_0.gif" border="0"></a></td><td width="80"></td></tr></table></div><div id="MarkerPanel" style="display:none;"><table align="left" width="680" border="0" cellspacing="0" cellpadding="0"><tr><td width="48"><img src="i/_void.gif" width="1" height="58" /></td><td width="37"><div id="upper_slider_layer" name = "upper_slider_layer" style="display:none;"></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:dezoomFromPage(0,0);"><img border="0" src="i/buttons/zoom_out.gif" alt="Küçült" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:gotoTOC_zoomed();"><img border=0 src="i/buttons/t_o_c.gif" alt="İçindekiler Sayfası" width="37" height="38" /></a></td><td width="5"></td><td width="37"><a href="javascript:PopUpFixed(\'oner.php?d_id='+dergi_id+'\', \'\', 400, 250, 100, 100);" ><img src="i/buttons/send_mail.gif" alt="Arkadaşına Gönder" width="37" height="38" /></a></td><td width="10"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td></td><td width="20"></td><td width="47"><a href="javascript:;" onClick="javascript:changecolor(\'mor\');"><img id="morrenk" border="0" src="i/buttons/t_marker_m_0.gif" alt="Mor Renk" width="37" height="38" /></td><td width="1"></td><td width="37"><a href="javascript:;" onClick="javascript:changecolor(\'turuncu\');"><img id="turuncurenk" border="0" src="i/buttons/t_marker_o_0.gif" alt="Turuncu Renk" width="37" height="38" /></td><td width="1"></td><td width="47"><a href="javascript:;" onClick="javascript:changecolor(\'sari\');"><img border="0" id="sarirenk" src="i/buttons/t_marker_y_0.gif" alt="Sarı Renk" width="37" height="38" /></td><td width="10"></td><td width="37"><a href="javascript:;" onClick="javascript:ClearMarks();"><img border="0" src="i/buttons/t_temizle_0.gif" alt="Temizle" width="37" height="38" /></td><td width="5"></td><td width="37"><a href="javascript:;" onClick="javascript:SaveNewMarkers();"><img border="0"  src="i/buttons/t_kaydet_0.gif" alt="Kaydet" width="37" height="38" /></td><td width="10"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td><td width="20"></td><td colspan="5" align="left"><a title="Notları göster" href="javascript:;" onclick="switchPanel(\'PostItPanel\',\'MarkerPanel\');"><img src="i/buttons/tepe_post_ac_0.gif" border="0"></a></td></tr></table></div><div id="PostItPanel" style="display:none;"><table align="left" width="680" border="0" cellspacing="0" cellpadding="0"><tr><td width="48"><img src="i/_void.gif" width="1" height="58" /></td><td width="37"><div id="upper_slider_layer" name = "upper_slider_layer" style="display:none;"></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:dezoomFromPage(0,0);"><img border="0" src="i/buttons/zoom_out.gif" alt="Küçült" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:gotoTOC_zoomed();"><img border=0 src="i/buttons/t_o_c.gif" alt="İçindekiler Sayfası" width="37" height="38" /></a></td><td width="5"></td><td width="37"><a href="javascript:PopUpFixed(\'oner.php?d_id='+dergi_id+'\', \'\', 400, 250, 100, 100);" ><img src="i/buttons/send_mail.gif" alt="Arkadaşına Gönder" width="37" height="38" /></a></td><td width="10"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td><td width="27"></td><td width="50" align="center"><a title="Kalemleri göster" href="javascript:;" onclick="switchPanel(\'MarkerPanel\',\'PostItPanel\');"><img src="i/buttons/tepe_marker_ac_0.gif" border="0"></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td><td width="20"></td><td align="right" width="35"><a href="javascript:;" title="Yeni not ekle" onclick="Drag.clone(0,598,0,'+(MaxHeight-20)+',null,null,null,null,null);"><img src="i/t_ekle_0.gif" id="popPostIt" border="0" alt="Yeni not ekle"></a></td><td width="10"></td><td align="left" width="35"><a href="javascript:;" onClick="Drag.closeAll();"><img src="i/t_kucult_0.gif" id="popPostIt" border="0" alt="Sayfadaki notları gizle"></a></td><td width="10"></td><td align="left"><a href="javascript:;" onClick="Drag.openAll();"><img src="i/t_buyut_0.gif" id="popPostIt" border="0" alt="Sayfadaki notları göster"></a></td><td width="40"></td></tr></table></div>';


	_layer = document.getElementById('lowertoolbar_layer');

	_layer.style.zIndex = 12;
	_layer.innerHTML= '<div id="MainPanelDown"><table align="left" width="680" border="0" cellspacing="0" cellpadding="0"><tr><td width="48"><img src="i/_void.gif" width="1" height="58" /></td><td width="37"><div id="lower_slider_layer" name = "lower_slider_layer" style="display:none;"></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:dezoomFromPage(0,0);"><img border="0" src="i/buttons/zoom_out_a.gif" alt="Küçült" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:gotoTOC_zoomed();"><img border=0 src="i/buttons/t_o_c_a.gif" alt="İçindekiler Sayfası" width="37" height="38" /></a></td><td width="5"></td><td width="37"><a href="javascript:PopUpFixed(\'oner.php?d_id='+dergi_id+'\', \'\', 400, 250, 100, 100);" ><img src="i/buttons/send_mail_a.gif" alt="Arkadaşına Gönder" width="37" height="38" /></a></td><td width="10"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td><td width="10"></td><td align="center"><a title="Kalemleri göster" href="javascript:;" onclick="switchPanel(\'MarkerPanel\',\'MainPanel\');"><img src="i/buttons/alt_marker_ac_0.gif" border="0"></a></td><td width="10"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td><td align="center"><a title="Notları göster" href="javascript:;" onclick="switchPanel(\'PostItPanel\',\'MainPanel\');"><img src="i/buttons/alt_post_ac_0.gif" border="0"></a></td><td width="80"></td></tr></table></div><div id="MarkerPanelDown" style="display:none;"><table align="left" width="680" border="0" cellspacing="0" cellpadding="0"><tr><td width="48"><img src="i/_void.gif" width="1" height="58" /></td><td width="37"><div id="lower_slider_layer" name = "lower_slider_layer" style="display:none;"></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:dezoomFromPage(0,0);"><img border="0" src="i/buttons/zoom_out_a.gif" alt="Küçült" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:gotoTOC_zoomed();"><img border=0 src="i/buttons/t_o_c_a.gif" alt="İçindekiler Sayfası" width="37" height="38" /></a></td><td width="5"></td><td width="37"><a href="javascript:PopUpFixed(\'oner.php?d_id='+dergi_id+'\', \'\', 400, 250, 100, 100);" ><img src="i/buttons/send_mail_a.gif" alt="Arkadaşına Gönder" width="37" height="38" /></a></td><td width="10"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td></td><td width="20"></td><td width="47"><a href="javascript:;" onClick="javascript:changecolor(\'mor\');"><img id="morrenk_alt" border="0" src="i/buttons/b_marker_m_0.gif" alt="Mor Renk" width="37" height="38" /></td><td width="1"></td><td width="37"><a href="javascript:;" onClick="javascript:changecolor(\'turuncu\');"><img id="turuncurenk_alt" border="0" src="i/buttons/b_marker_o_0.gif" alt="Turuncu Renk" width="37" height="38" /></td><td width="1"></td><td width="47"><a href="javascript:;" onClick="javascript:changecolor(\'sari\');"><img border="0" id="sarirenk_alt" src="i/buttons/b_marker_y_0.gif" alt="Sarı Renk" width="37" height="38" /></td><td width="10"></td><td width="37"><a href="javascript:;" onClick="javascript:ClearMarks();"><img border="0" src="i/buttons/b_temizle_0.gif" alt="Temizle" width="37" height="38" /></td><td width="5"></td><td width="37"><a href="javascript:;" onClick="javascript:SaveNewMarkers();"><img border="0"  src="i/buttons/b_kaydet_0.gif" alt="Kaydet" width="37" height="38" /></td><td width="10"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td><td width="20"></td><td colspan="5" align="left"><a title="Notları göster" href="javascript:;" onclick="switchPanel(\'PostItPanel\',\'MarkerPanel\');"><img src="i/buttons/alt_post_ac_0.gif" border="0"></a></td></tr></table></div><div id="PostItPanelDown" style="display:none;"><table align="left" width="680" border="0" cellspacing="0" cellpadding="0"><tr><td width="48"><img src="i/_void.gif" width="1" height="58" /></td><td width="37"><div id="lower_slider_layer" name = "lower_slider_layer" style="display:none;"></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:dezoomFromPage(0,0);"><img border="0" src="i/buttons/zoom_out_a.gif" alt="Küçült" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:gotoTOC_zoomed();"><img border=0 src="i/buttons/t_o_c_a.gif" alt="İçindekiler Sayfası" width="37" height="38" /></a></td><td width="5"></td><td width="37"><a href="javascript:PopUpFixed(\'oner.php?d_id='+dergi_id+'\', \'\', 400, 250, 100, 100);" ><img src="i/buttons/send_mail_a.gif" alt="Arkadaşına Gönder" width="37" height="38" /></a></td><td width="10"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td><td width="27"></td><td width="50" align="center"><a title="Kalemleri göster" href="javascript:;" onclick="switchPanel(\'MarkerPanel\',\'PostItPanel\');"><img src="i/buttons/alt_marker_ac_0.gif" border="0"></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td><td width="20"></td><td align="right" width="35"><a href="#" title="Yeni not ekle" onclick="Drag.clone(0,598,0,'+MaxHeight+',null,null,null,null,null);"><img src="i/b_ekle_0.gif" id="popPostIt" border="0" alt="Yeni not ekle"></a></td><td width="10"></td><td align="left" width="35"><a href="javascript:;" onClick="Drag.closeAll();"><img src="i/b_kucult_0.gif" id="popPostIt" border="0" alt="Sayfadaki notları gizle"></a></td><td width="10"></td><td align="left"><a href="javascript:;" onClick="Drag.openAll();"><img src="i/b_buyut_0.gif" id="popPostIt" border="0" alt="Sayfadaki notları göster"></a></td><td width="40"></td></tr></table></div>';

	if(curpage ==js_toc_page)
	{
		document.getElementById("FlashDergi").style.zIndex=-1;
		document.getElementById("maplayer").style.zIndex=150;
		document.getElementById("postitlayer").style.zIndex=-1;
		document.getElementById("imagelayer").style.zIndex=-1;
	}
	else
	{
		document.getElementById("FlashDergi").style.zIndex=-1;
		document.getElementById("maplayer").style.zIndex=-1;
		document.getElementById("postitlayer").style.zIndex=-1;
	}


}
function switchPanel(toSwitch,toOff)
{
	document.getElementById(toSwitch).style.display="block";
	document.getElementById(toOff).style.display="none";
	document.getElementById(toSwitch+"Down").style.display="block";
	document.getElementById(toOff+"Down").style.display="none";
	if(toSwitch =="PostItPanel")
	{
		document.getElementById("imagelayer").style.zIndex=-1;
		document.getElementById("maplayer").style.zIndex=-2;
		document.getElementById("postitlayer").style.zIndex=150;
	}
	if(toSwitch =="MarkerPanel")
	{
		document.getElementById("imagelayer").style.zIndex=150;
		document.getElementById("maplayer").style.zIndex=-1;
		document.getElementById("postitlayer").style.zIndex=-2;
		changecolor('mor');
	}
	if(toSwitch =="MainPanel")
	{
		document.getElementById("imagelayer").style.zIndex=-2;
		document.getElementById("maplayer").style.zIndex=150;
		document.getElementById("postitlayer").style.zIndex=-3;
	}
}
function dezoomFromPage(x,y)
{
	if( (isMarkersSaved ==0) && (isAnyMarkers==1) )
	{
		var ans=confirm("Sayfaya koyduğunuz işaretlerin kaydedilmesi için tamam tuşuna basmalısınız. İptal tuşuna bastığınızda işaretlediğiniz alanlar kaydedilmeyecektir.");
	}
	if(ans)
		SaveNewMarkers();
	isAnyMarkers=0;
	isCleared=0;
	zoommode = false;
	
		if (savedpostit >0)
		{
			for(var count=0;count<savedpostit;count++)
			{
				if(document.getElementById('postit_eski'+count) !=null)
				document.getElementById('postit_eski'+count).style.visibility="hidden";
			}
		}
		if( postitID >0)
		{
			for(var count=0;count<postitID;count++)
			{
					if(document.getElementById('postit'+count) !=null)
						document.getElementById('postit'+count).style.visibility="hidden";
			}
		postitcount=0;
		currentpage_deletedpostit=null;
		deleted=0;
		}

		markermode = 0;

	document.getElementById("object_layer").style.height=js_tpl_height+"px";
		var _plugin = _getPlugin('dergi');
		_plugin.height = js_tpl_height;
		_layer = document.getElementById('mylayer');
		_layer.innerHTML = '';
		_layer = document.getElementById('uppertoolbar_layer');
		_layer.style.zIndex = 10;
		if (js_hemenoku==0)
		{
			if (js_showsepeteekle ==1)
			{
		_layer.innerHTML= '<table width="500" border="0" cellspacing="0" cellpadding="0"><tr><td width="48"><img src="i/_void.gif" width="1" height="58" /></td><td width="37"><a href="javascript:;" onClick="javascript:PrevPage();"><img border="0" src="i/buttons/previous.gif" alt="Önceki Sayfa" width="37" height="38" /></a></td><td width="80"><div id="upper_slider_layer" name = "upper_slider_layer" style="position: relative;" onclick="javascript:gotoPage(event.x/80 || event.layerX/80);" onmousemove="javascript:showPageNumber(event.x/80 || event.layerX/80);" onmouseleave = "javascript:hidePageNumber(event.x/80 || event.layerX/80);" onmouseout = "javascript:hidePageNumber(event.x/80 || event.layerX/80);"></div></td><td width="37"><a href="javascript:;" onClick="javascript:NextPage();"><img border="0" src="i/buttons/next.gif" alt="Sonraki Sayfa" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:CurrentPage_zoomed();"><img border="0" src="i/buttons/zoom_in.gif" alt="Büyüt" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:gotoTOC();"><img border=0 src="i/buttons/t_o_c.gif" alt="İçindekiler Sayfası" width="37" height="38" /></a></td><td width="5"></td><td width="37"><a href="javascript:PopUpFixed(\'oner.php?d_id='+dergi_id+'\', \'\', 400, 250, 100, 100);" ><img src="i/buttons/send_mail.gif" alt="Arkadaşına Gönder" width="37" height="38" /></a></td><td width="100"><div align="center" class="button"><a href="javascript:PopUpFixed(\'sepeteekle.php?d_id='+dergi_id+'\', \'sepete_ekle\', 410, 250, 100, 100);" ><img src="i/sepete_ekle_d.gif" alt="Abone Ol" border="0" /></a></div></td></tr></table>';
		}
		else
		{
				_layer.innerHTML= '<table width="500" border="0" cellspacing="0" cellpadding="0"><tr><td width="48"><img src="i/_void.gif" width="1" height="58" /></td><td width="37"><a href="javascript:;" onClick="javascript:PrevPage();"><img border="0" src="i/buttons/previous.gif" alt="Önceki Sayfa" width="37" height="38" /></a></td><td width="80"><div id="upper_slider_layer" name = "upper_slider_layer" style="position: relative;" onclick="javascript:gotoPage(event.x/80 || event.layerX/80);" onmousemove="javascript:showPageNumber(event.x/80 || event.layerX/80);" onmouseleave = "javascript:hidePageNumber(event.x/80 || event.layerX/80);" onmouseout = "javascript:hidePageNumber(event.x/80 || event.layerX/80);"></div></td><td width="37"><a href="javascript:;" onClick="javascript:NextPage();"><img border="0" src="i/buttons/next.gif" alt="Sonraki Sayfa" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:CurrentPage_zoomed();"><img border="0" src="i/buttons/zoom_in.gif" alt="Büyüt" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:gotoTOC();"><img border=0 src="i/buttons/t_o_c.gif" alt="İçindekiler Sayfası" width="37" height="38" /></a></td><td width="5"></td><td width="37"><a href="javascript:PopUpFixed(\'oner.php?d_id='+dergi_id+'\', \'\', 400, 250, 100, 100);" ><img src="i/buttons/send_mail.gif" alt="Arkadaşına Gönder" width="37" height="38" /></a></td><td width="100"></td></tr></table>';
		}
		}
	else
	{
				_layer.innerHTML= '<table width="500" border="0" cellspacing="0" cellpadding="0"><tr><td width="48"><img src="i/_void.gif" width="1" height="58" /></td><td width="37"><a href="javascript:;" onClick="javascript:PrevPage();"><img border="0" src="i/buttons/previous.gif" alt="Önceki Sayfa" width="37" height="38" /></a></td><td width="80"><div id="upper_slider_layer" name = "upper_slider_layer" style="position: relative;" onclick="javascript:gotoPage(event.x/80 || event.layerX/80);" onmousemove="javascript:showPageNumber(event.x/80 || event.layerX/80);" onmouseleave = "javascript:hidePageNumber(event.x/80 || event.layerX/80);" onmouseout = "javascript:hidePageNumber(event.x/80 || event.layerX/80);"></div></td><td width="37"><a href="javascript:;" onClick="javascript:NextPage();"><img border="0" src="i/buttons/next.gif" alt="Sonraki Sayfa" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:CurrentPage_zoomed();"><img border="0" src="i/buttons/zoom_in.gif" alt="Büyüt" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_dark_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:gotoTOC();"><img border=0 src="i/buttons/t_o_c.gif" alt="İçindekiler Sayfası" width="37" height="38" /></a></td><td width="5"></td><td width="37"><a href="javascript:PopUpFixed(\'oner.php?d_id='+dergi_id+'\', \'\', 400, 250, 100, 100);" ><img src="i/buttons/send_mail.gif" alt="Arkadaşına Gönder" width="37" height="38" /></a></td><td width="100"></td></tr></table>';
	}
		_layer = document.getElementById('lowertoolbar_layer');
		_layer.style.zIndex = 10;

		if (js_hemenoku==0)
		{
			if (js_showsepeteekle ==1)
			{
			_layer.innerHTML= '<table width="500" border="0" cellspacing="0" cellpadding="0"><tr><td width="48"><img src="i/_void.gif" width="1" height="58" /></td><td width="37"><a href="javascript:;" onClick="javascript:PrevPage();"><img border="0" src="i/buttons/previous_a.gif" alt="Önceki Sayfa" width="37" height="38" /></a></td><td width="80"><div id="lower_slider_layer" name = "lower_slider_layer" style="position: relative;" onclick="javascript:gotoPage(event.x/80 || event.layerX/80);" onmousemove="javascript:showPageNumber_lower(event.x/80 || event.layerX/80);" onmouseleave = "javascript:hidePageNumber_lower(event.x/80 || event.layerX/80);" onmouseout = "javascript:hidePageNumber_lower(event.x/80 || event.layerX/80);"></div></td><td width="37"><a href="javascript:;" onClick="javascript:NextPage();"><img border="0" src="i/buttons/next_a.gif" alt="Sonraki Sayfa" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:CurrentPage_zoomed();"><img border="0" src="i/buttons/zoom_in_a.gif" alt="Büyüt" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:gotoTOC();"><img border=0 src="i/buttons/t_o_c_a.gif" alt="İçindekiler Sayfası" width="37" height="38" /></a></td><td width="5"></td><td width="37"><a href="javascript:PopUpFixed(\'oner.php?d_id='+dergi_id+'\', \'\', 400, 250, 100, 100);" ><img src="i/buttons/send_mail_a.gif" alt="Arkadaşına Gönder" width="37" height="38" /></a></td><td width="100"><div align="center" class="button"><a href="javascript:PopUpFixed(\'sepeteekle.php?d_id='+dergi_id+'\', \'sepete_ekle\', 410, 250, 100, 100);" ><img src="i/sepete_ekle_l.gif" alt="Abone Ol" border="0" /></a></div></td></tr></table>';
			}
		else
		{
		_layer.innerHTML= '<table width="500" border="0" cellspacing="0" cellpadding="0"><tr><td width="48"><img src="i/_void.gif" width="1" height="58" /></td><td width="37"><a href="javascript:;" onClick="javascript:PrevPage();"><img border="0" src="i/buttons/previous_a.gif" alt="Önceki Sayfa" width="37" height="38" /></a></td><td width="80"><div id="lower_slider_layer" name = "lower_slider_layer" style="position: relative;" onclick="javascript:gotoPage(event.x/80 || event.layerX/80);" onmousemove="javascript:showPageNumber_lower(event.x/80 || event.layerX/80);" onmouseleave = "javascript:hidePageNumber_lower(event.x/80 || event.layerX/80);" onmouseout = "javascript:hidePageNumber_lower(event.x/80 || event.layerX/80);"></div></td><td width="37"><a href="javascript:;" onClick="javascript:NextPage();"><img border="0" src="i/buttons/next_a.gif" alt="Sonraki Sayfa" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:CurrentPage_zoomed();"><img border="0" src="i/buttons/zoom_in_a.gif" alt="Büyüt" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:gotoTOC();"><img border=0 src="i/buttons/t_o_c_a.gif" alt="İçindekiler Sayfası" width="37" height="38" /></a></td><td width="5"></td><td width="37"><a href="javascript:PopUpFixed(\'oner.php?d_id='+dergi_id+'\', \'\', 400, 250, 100, 100);" ><img src="i/buttons/send_mail_a.gif" alt="Arkadaşına Gönder" width="37" height="38" /></a></td><td width="100"></td></tr></table>';
		}
		}
		else
		{
				_layer.innerHTML= '<table width="500" border="0" cellspacing="0" cellpadding="0"><tr><td width="48"><img src="i/_void.gif" width="1" height="58" /></td><td width="37"><a href="javascript:;" onClick="javascript:PrevPage();"><img border="0" src="i/buttons/previous_a.gif" alt="Önceki Sayfa" width="37" height="38" /></a></td><td width="80"><div id="lower_slider_layer" name = "lower_slider_layer" style="position: relative;" onclick="javascript:gotoPage(event.x/80 || event.layerX/80);" onmousemove="javascript:showPageNumber_lower(event.x/80 || event.layerX/80);" onmouseleave = "javascript:hidePageNumber_lower(event.x/80 || event.layerX/80);" onmouseout = "javascript:hidePageNumber_lower(event.x/80 || event.layerX/80);"></div></td><td width="37"><a href="javascript:;" onClick="javascript:NextPage();"><img border="0" src="i/buttons/next_a.gif" alt="Sonraki Sayfa" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:CurrentPage_zoomed();"><img border="0" src="i/buttons/zoom_in_a.gif" alt="Büyüt" width="37" height="38" /></a></td><td width="20"></td><td width="1" valign = "bottom"><img src="i/_button_light_sep.gif" width="1" height="56" /></td><td width="20"></td><td width="37"><a href="javascript:;" onClick="javascript:gotoTOC();"><img border=0 src="i/buttons/t_o_c_a.gif" alt="İçindekiler Sayfası" width="37" height="38" /></a></td><td width="5"></td><td width="37"><a href="javascript:PopUpFixed(\'oner.php?d_id='+dergi_id+'\', \'\', 400, 250, 100, 100);" ><img src="i/buttons/send_mail_a.gif" alt="Arkadaşına Gönder" width="37" height="38" /></a></td><td width="100"></td></tr></table>';
		}
		repositionslider(lastpagedecimal);
		document.getElementById("FlashDergi").style.zIndex="10"; 

}
function beginMarker(x,y,button)
{
	if(button == 1 || button == 0)
	{
		if(markermode)
		{
		ismarking = 1;
		isAnyMarkers=1;
		markerbegin_x = x;
		markerbegin_y = y;
		_layer = document.getElementById('son_cizilen_layer');
		if(_layer)
		{
			_layer = document.getElementById('son_cizilen_layer');
			_layer.style.left = '0px';
			_layer.style.top = '0px';
			_layer.style.width = '0px';
			_layer.style.height = thickness+"px";
			_layer.style.background = curcolor;
		}
		else
		{
	
			_layer = document.getElementById('imagelayer');
			_layer.innerHTML += '<div id="son_cizilen_layer" style="overflow:hidden;-moz-opacity:0.25; filter: alpha(opacity=25);position:absolute;background-color:'+curcolor+';left:0px;top:0px;width:0px;height:'+thickness+'px"></div>';
		}
	}
	else
	{
		dezoomFromPage(0,0);
	}
	}



}
function moveMarker(x,y,button)
{
	if(button==1 || button ==0)
	{
	if(markermode)
	{
	if(ismarking == 1)
	{

		_layer = document.getElementById('son_cizilen_layer');
		if(x>markerbegin_x)
		{
			_layer.style.left = markerbegin_x+'px';
			_layer.style.width = (x-markerbegin_x)+'px' ;
		}
		else
		{
			_layer.style.left = x+'px';
			_layer.style.width = (markerbegin_x-x)+'px' ;
		}
		_layer.style.top = (markerbegin_y-thickness/2)+'px';
		_layer.style.width = ((x>markerbegin_x) ? x-markerbegin_x : markerbegin_x-x)+'px';

	}
	}
	}

}

var IFrameObj; 
function callToServer(URL) {
  var IFrameDoc;

  if (!IFrameObj && document.createElement) {

   try {
      var tempIFrame=document.createElement('iframe');
      tempIFrame.setAttribute('id','RSIFrame');
      tempIFrame.style.border='0px';
      tempIFrame.style.width='0px';
      tempIFrame.style.height='0px';
      IFrameObj = document.body.appendChild(tempIFrame);

      if (document.frames) {

        IFrameObj = document.frames['RSIFrame'];
      }
    } catch(exception) {

      iframeHTML='\<iframe id="RSIFrame" style="';
      iframeHTML+='border:0px;';
      iframeHTML+='width:0px;';
      iframeHTML+='height:0px;';
      iframeHTML+='"><\/iframe>';
      document.body.innerHTML+=iframeHTML;
      IFrameObj = new Object();
      IFrameObj.document = new Object();
      IFrameObj.document.location = new Object();
      IFrameObj.document.location.iframe = document.getElementById('RSIFrame');
      IFrameObj.document.location.replace = function(location) {
        this.iframe.src = location;
      }
    }
  }

  if (navigator.userAgent.indexOf('Gecko') !=-1 && !IFrameObj.contentDocument) {

    setTimeout('callToServer()',10);
    return false;
  }

  if (IFrameObj.contentDocument) {
    
    IFrameDoc = IFrameObj.contentDocument;
  } else if (IFrameObj.contentWindow) {
    
    IFrameDoc = IFrameObj.contentWindow.document;
  } else if (IFrameObj.document) {
  
    IFrameDoc = IFrameObj.document;
  } else {
    return true;
  }

  IFrameDoc.location.replace(URL);
  return false;
}
function endMarker(x,y,button)
{
	if(button==1 || button ==0)
	{
		if(markermode)
		{
		if(ismarking == 1)
		{

        _layer = document.getElementById('son_cizilen_layer');
		_layer.style.left = '0px';
		_layer.style.top = '0px';
		_layer.style.width = '0px';
        _layer = document.getElementById('imagelayer');
        if(x<markerbegin_x)
        {
        	var temp = markerbegin_x;
        	markerbegin_x = x;
        	x = temp;
        }
        marker_counter = marker_counter + 1;
		_layer.innerHTML += '<div title="İşareti silmek için mouse\'un sağ tuşuna tıklayın" id="marker_yeni'+newmarkerid+'" onMouseUp="javascript:deleteMarker(\'yeni\','+newmarkerid+',this.id,event.button);" style="overflow:hidden;-moz-opacity:0.25;filter: alpha(opacity=25);position:absolute;background-color:'+curcolor+';left:'+markerbegin_x+'px;top:'+(markerbegin_y-thickness/2)+'px;width:'+(x-markerbegin_x)+'px;height:'+thickness+'px"></div>';

		currentpage_newmarkers[newmarkerid] = new Array();
		currentpage_newmarkers[newmarkerid]["coord_left"] = markerbegin_x;
		currentpage_newmarkers[newmarkerid]["coord_top"] = (markerbegin_y-thickness/2);
		currentpage_newmarkers[newmarkerid]["width"] = (x-markerbegin_x);
		currentpage_newmarkers[newmarkerid]["height"] = thickness;
		currentpage_newmarkers[newmarkerid]["color"] = curcolor.substring(1,7);
		newmarkerid++;

		ismarking = 0;
		}
	}

	}

}

function setThickness(line_thickness)
{
	thickness = line_thickness;
}
function ClearMarks()
{
	isAnyMarkers=1;
	_layer = document.getElementById('imagelayer');
	_layer.innerHTML = "";
	for(var i=0;i<currentpage_markers.length;i++)
	{
		if(currentpage_markers[i])
		{
			currentpage_deletedmarkers[currentpage_deletedmarkers.length] = currentpage_markers[i];
			currentpage_markers[i] = null;
		}
	}

	currentpage_newmarkers = new Array();
	newmarkerid = 0;
    currentpage_markers = new Array();
}

function NextPage()
{
	var _plugin = _getPlugin('dergi');
	var pstr = "";
	_plugin.SetVariable("/:__jsAction", "nextpage");
	_plugin.SetVariable("/:__jsParams", pstr);
	_plugin.GotoFrame(39);
}

function PrevPage()
{
	if (document.getElementById("LastPage").style.display=="block")
	{
		document.getElementById("LastPage").style.display="none";
		document.getElementById("ShowSepet").style.display="none";
		return;
	}
	var _plugin = _getPlugin('dergi');
	var pstr = "";
	_plugin.SetVariable("/:__jsAction", "prevpage");
	_plugin.SetVariable("/:__jsParams", pstr);
	_plugin.GotoFrame(39);
}

function PrevPage_zoomed()
{
	var _plugin = _getPlugin('dergi');
	var pstr = "?c_page="+currentpage;
	_plugin.SetVariable("/:__jsAction", "prevpage_zoomed");
	_plugin.SetVariable("/:__jsParams", pstr);
	_plugin.GotoFrame(39);
}

function CurrentPage_zoomed()
{
	var _plugin = _getPlugin('dergi');
	var pstr = "?c_page="+currentpage;
	_plugin.SetVariable("/:__jsAction", "currentpage_zoomed");
	_plugin.SetVariable("/:__jsParams", pstr);
	_plugin.GotoFrame(39);
}

function NextPage_zoomed()
{
	var _plugin = _getPlugin('dergi');
	var pstr = "?c_page="+currentpage;
	_plugin.SetVariable("/:__jsAction", "nextpage_zoomed");
	_plugin.SetVariable("/:__jsParams", pstr);
	_plugin.GotoFrame(39);
}

function deleteMarker(eski_yeni,id,markerid,button)
{
	isAnyMarkers=1;
	if(button==2 || button == 3)
	{

		
		if (document.layers && document.layers[markerid])
		{

		  document.layers[markerid].visibility='hide';
		  delete document.layers[markerid];
		}
		else if (document.all && document.all[markerid])
		{

		  document.all[markerid].innerHTML='';
		  document.all[markerid].outerHTML='';
		}
		
		else if(document.getElementById)
		{
			var theDiv = document.getElementById(markerid);
			theDiv.style.visibility="hidden";
		}
		
		if(eski_yeni == "yeni")
		{
			currentpage_newmarkers[id] = null;
		}
		else if(eski_yeni == "eski")
		{
			currentpage_deletedmarkers[currentpage_deletedmarkers.length] = currentpage_markers[id];
			currentpage_markers[id] = null;
		}
	}
	else
	{
		return true;
	}
}

function RpopUp(URL,W,H,L,T) {
alert(URL);
        var id = 1;
  eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + W + ",height=" + H + ",left="+L+",top="+T+"');");
}
function gotoTOC()
{
	if( document.getElementById("ShowSepet").style.display =="block")
	{
		document.getElementById("ShowSepet").style.display="none";
		document.getElementById("LastPage").style.display="none";
	}
	var _plugin = _getPlugin('dergi');
	var pstr = "";
	_plugin.SetVariable("/:__jsAction", "gotoTOC");
	_plugin.SetVariable("/:__jsParams", pstr);
	_plugin.GotoFrame(39);
}
function gotoTOC_zoomed()
{
		switchPanel('MainPanel','MarkerPanel');
		switchPanel('MainPanel','PostItPanel');
		if( postitID >0)
		{
			postitcount=0;
			currentpage_deletedpostit=null;
			deleted=0;
		}	
	
	var _plugin = _getPlugin('dergi');

	var pstr = "";
	_plugin.SetVariable("/:__jsAction", "gotoTOC_zoomed");
	_plugin.SetVariable("/:__jsParams", pstr);
	_plugin.GotoFrame(39);
	document.getElementById("maplayer").style.zIndex=150;
	document.getElementById("imagelayer").style.zIndex=-2;
	document.getElementById("postitlayer").style.zIndex=-1;
}
function gotoPage(pagedecimal)
{
	var _plugin = _getPlugin('dergi');

	var pstr = "?pageno="+pagedecimal;
	if(zoommode)
		_plugin.SetVariable("/:__jsAction", "gotoPage_zoomed");
	else
		_plugin.SetVariable("/:__jsAction", "gotoPage");
	_plugin.SetVariable("/:__jsParams", pstr);
	_plugin.GotoFrame(39);

	repositionslider(pagedecimal);
}
function showPageNumber(pagedecimal)
{
	if (!pagedecimal)
		return;
	var m_position = pagedecimal*80;
	var page_no = pagedecimal*noofpages;
	_layer = document.getElementById('upper_page_number_display');
	_layer.style.left = (m_position+10)+"px";
	_layer.style.top = "20px";
	_layer.style.width = "10px";
	_layer.style.height = "15px";
	_layer.innerHTML = parseInt(page_no);
	_layer.style.visibility = "visible";
}

function hidePageNumber(pagedecimal)
{
	_layer = document.getElementById('upper_page_number_display');
	_layer.style.innerHTML="";
	_layer.style.width = "0px";
	_layer.style.height = "0px";
	_layer.style.visibility="hidden";

}

function showPageNumber_lower(pagedecimal)
{
		if (!pagedecimal)
		return;
	var m_position = pagedecimal*80;
	var page_no = pagedecimal*noofpages;
	_layer = document.getElementById('lower_page_number_display');
	_layer.style.left = (m_position+10)+"px";
	_layer.style.top = "20px";
	_layer.style.width = "10px";
	_layer.style.height = "15px";
	_layer.innerHTML = parseInt(page_no);
	_layer.style.visibility = "visible";
}

function hidePageNumber_lower(pagedecimal)
{
	_layer = document.getElementById('lower_page_number_display');
	_layer.style.innerHTML="";
	_layer.style.width = "0px";
	_layer.style.height = "0px";
	_layer.style.visibility="hidden";

}
function repositionslider(pagedecimal)
{
	lastpagedecimal = pagedecimal;
	var slider_left = pagedecimal*80;
	slider_left = parseInt(slider_left);
	var slider_right = 80-slider_left;


	_layer = document.getElementById('upper_slider_layer');

	_layer.innerHTML= '<div id = "upper_page_number_display" name = "upper_page_number_display" style="z-index:100;position:absolute;left:0px;top:0px;width:0px;height:0px;background-color:transparent;font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;font-style: normal;font-weight: normal;color: #FFFFFF;"></div><table border="0" width="80"><tr height="11"><td width="'+slider_left+'" style="background-image: url(i/slider_acik.gif);background-repeat: repeat-x;"></td><td width="'+slider_right+'" style="background-image: url(i/slider_koyu.gif);background-repeat: repeat-x;"></td></tr></table>';
	_layer = document.getElementById('lower_slider_layer');

	_layer.innerHTML= '<div id = "lower_page_number_display" name = "lower_page_number_display" style="z-index:100;position:absolute;left:0px;top:0px;width:0px;height:0px;background-color:transparent;font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;font-style: normal;font-weight: normal;color: #FFFFFF;"></div><table border="0" width="80"><tr height="11"><td width="'+slider_left+'" style="background-image: url(i/slider_acik.gif);background-repeat: repeat-x;"></td><td width="'+slider_right+'" style="background-image: url(i/slider_koyu.gif);background-repeat: repeat-x;"></td></tr></table>';

}
function dergiyukle()
{
	var _plugin = _getPlugin('dergi');


	noofpages = js_no_of_pages;
	var pstr = "";
	pstr += "?noofpages="+js_no_of_pages;
	pstr += "&tocpage="+js_toc_page;
	pstr += "&width="+js_tpl_width;
	pstr += "&height="+js_tpl_height;
	pstr += "&smallbase="+url_path+"/";
	//pstr +="&smallbase="+new_url+"/"+d_grup+"/"+dergi_id+"/"+d_yayin_yil+"/"+dergi_yayin_sayi_no+"/KUCUK/";
	//pstr += "&bigbase="+url_path+"/";
	pstr +="&bigbase="+new_url+"/"+d_grup+"/"+dergi_id+"/"+d_yayin_yil+"/"+dergi_yayin_sayi_no+"/BUYUK/";
//	pstr += "&bigbase="+url_path+"/DERGI-JPG/"+dergi_id+"/"+dergi_yayin_sayi_no+"/BUYUK/";
	pstr += "&smallpages=";
	var lastpage=js_total_page_number;
	totalpages=js_no_of_pages;
	if(lastpage <100)
		denelastpage="0"+lastpage;
	else
		denelastpage=lastpage;
	for(var i=1;i<=js_no_of_pages;i++)
	{
			var tmppageno = 0;
			if(i<10)
					tmppageno = "00"+i;
			else if(i<100)
					tmppageno = "0"+i;
			else if(i<1000)
					tmppageno = i;
			if(i!=1)
			{
				pstr += ";"
			}
			if( (tmppageno =="016") && (lastpage !=totalpages) )
			{
			//pstr += i+","+dergi_id+"-"+dergi_yayin_sayi_no+"-"+denelastpage+"-S.jpg";
			//pstr += i+","+d_grup+"-"+dergi_yayin_sayi_no+"-"+denelastpage+"-S.jpg";
			pstr += i+","+x_small+denelastpage;
			}
			else
			{
			pstr += i+","+x_small+tmppageno;
			//pstr += i+","+dergi_id+"-"+dergi_yayin_sayi_no+"-"+tmppageno+"-S.jpg";
			//pstr += i+","+d_grup+"-"+dergi_yayin_sayi_no+"-"+tmppageno+"-S.jpg";
			
			}

	}
	pstr += "&bigpages=";
	for(var i=1;i<=js_no_of_pages;i++)
	{
				var tmppageno = 0;
				if(i<10)
						tmppageno = "00"+i;
				else if(i<100)
						tmppageno = "0"+i;
				else if(i<1000)
						tmppageno = i;
				if(i!=1)
				{
					pstr += ";"
				}
			if( (tmppageno =="016") && (lastpage !=totalpages) )
			{
				lastpage=js_total_page_number;
				//pstr += i+","+dergi_id+"-"+dergi_yayin_sayi_no+"-"+denelastpage+"-L.jpg";
				//pstr += i+","+x_big+denelastpage;
				pstr += i+","+d_grup+"-"+dergi_yayin_sayi_no+"-"+denelastpage+"-L.jpg";
			}
			else
			{
				//pstr += i+","+dergi_id+"-"+dergi_yayin_sayi_no+"-"+tmppageno+"-L.jpg";
				//pstr += i+","+x_big+tmppageno;
				pstr += i+","+d_grup+"-"+dergi_yayin_sayi_no+"-"+tmppageno+"-L.jpg";
			}

	}
	_plugin.SetVariable("/:__jsAction", "start");
	_plugin.SetVariable("/:__jsParams", pstr);
	_plugin.GotoFrame(44);

}

/**************************************************
/*Copyright ©2006 Tüm hakları saklıdır.
MERKEZ GAZETE DERGİ BASIM YAYINCILIK SANAYİ VE TİCARET A.Ş.

	A POSTIT MANAGER - Baris Yazganc
	drag and drop script by  www.youngpup.net
 /**************************************************/
 String.prototype.wordWrap = function(m, b, c){
	var i, j, s, r = this.split("\n");
	if(m > 0) for(i in r){
		for(s = r[i], r[i] = ""; s.length > m;
			j = c ? m : (j = s.substr(0, m).match(/\S*$/)).input.length - j[0].length
			|| j.input.length + (j = s.substr(m).match(/^\S*/)).input.length + j[0].length,
			r[i] += s.substr(0, j) + ((s = s.substr(j)).length ? b : "")
		);
		r[i] += s;
	}
	return r.join("\n");
}
document.onselectstart=new Function ("return false");
var Drag = {

	obj : null,
	isDraggable : true,
	openAll : function()
	{
		if(savedpostit_array.length >0)
		{
			for(var postit_saved=0;postit_saved<savedpostit_array.length;postit_saved++)
			{
				if(document.getElementById(savedpostit_array[postit_saved]) !=null) 
					document.getElementById(savedpostit_array[postit_saved]).style.display="block";
			}
		}
		if (savedpostit > 0)
		{
			for(var saved=0;saved<savedpostit;saved++)
			{
				if(document.getElementById('postit_eski'+saved))
					document.getElementById('postit_eski'+saved).style.display="block";
			}
		}
	},
	closeAll : function()
	{
		if(savedpostit_array.length >0)
		{
			
			for(var postit_saved=0;postit_saved<savedpostit_array.length;postit_saved++)
			{
				if(document.getElementById(savedpostit_array[postit_saved]) !=null) 
					document.getElementById(savedpostit_array[postit_saved]).style.display="none";
			}
		}
		if (savedpostit > 0)
		{
			
			for(var saved=0;saved<savedpostit;saved++)
			{
				if(document.getElementById('postit_eski'+saved))
					document.getElementById('postit_eski'+saved).style.display="none";
			 		
			}
		}
	},
	setVisibility : function(nodeObj,value)
	{
		nodeObj.style.visibility=value;
	},
	clone : function(minX, maxX, minY, maxY,xCoordinate,yCoordinate,destID,realname,initValue)
	{
		var toggle=0;
		document.getElementById("imagelayer").style.zIndex=-1;
		document.getElementById("maplayer").style.zIndex=-2;
		document.getElementById("postitlayer").style.zIndex=150;
		template=document.getElementById('root');
		var node=template.cloneNode(0);
		if(xCoordinate !=null) node.style.left=xCoordinate+"px";
		if(yCoordinate !=null) node.style.top=yCoordinate+"px";
		node.innerHTML = template.innerHTML;
		Drag.setVisibility(node,'visible');
		node.style.zIndex = zIndex+1;
		if (destID ==null)
		{
			node.id='postit'+postitID;
			temp=postitcount;
			postitcount++;
			postit_array[temp]='postit'+postitID;
			temp++;
			current_postit_node=node.id;
			postitID++;
		}
		else
		{
			node.id="postit_eski"+destID;
		}
		var childs = node.childNodes;
		for(var i = 0; i < childs.length; i++)
		{
			if(childs[i].id == 'Bottom')
			{
				var bottomDrag=childs[i];
				bottomDrag.style.cursor="move";
			}
			if(childs[i].id == 'content')
			{
				var contentL=childs[i];
			}
			if(childs[i].id == 'handle')
			{
				var toolbar=childs[i];
				toolbar.ondblclick = function ()
				{
					if(toggle ==0)
					{
						toggle=1;
						contentL.style.display="none";
						bottomDrag.style.display="none";
						node.style.height="20px";
					}
					else
					{
						contentL.style.display="block";
						bottomDrag.style.display="block";
						node.style.height="135px";
						toggle=0;
					}
				};
				toolbar.id="p"+node.id;
				var subnodes=childs[i].childNodes;
				for(var j = 0; j < subnodes.length; j++)
				{
					if (subnodes[j].id =="close")
					{
						var closeLink=subnodes[j];
						if(destID ==null)
						{
							subnodes[j].onclick=function ()
							{
								postitcount--;
								Drag.setVisibility(node,'hidden');
							};
						}
						else
							Drag.setVisibility(subnodes[j],'hidden');
					}
					else if (subnodes[j].id =="edit")
					{
						var editLink=subnodes[j];
						if (destID !=null)
						{
							
							editLink.style.display="inline";
							editLink.onclick=function ()
							{
								saveLink.style.display="inline";
								editLink.style.display="none";
								editMode=1;
								EditCurrentPostit("eski",destID,node.id,null,realname,initValue);
							};
						}
						else
						{
							editLink.onclick=function ()
							{
								if(saveLink.style.display=="none")
								{
								setEditFor('postitlayer','imagelayer');
								noteID=node_string[node.id];
								editLink.style.padding="0px";
								Drag.init(toolbar,node,minX,maxX,minY,maxY);
								Drag.init(bottomDrag,node,minX,maxX,minY,maxY);
								bottomDrag.style.cursor="move";
								saveLink.style.display="inline";
								saveLink.style.padding="0px 0px 0px 10px";
								toolbar.style.cursor="move";
								dataLayer[node.id].style.backgroundColor="#FFF";
								node.style.backgroundColor="#FFF";
								dataLayer[node.id].onkeypress=function ()
								{
								};
								if(toggle)
								{
									contentL.style.display="block";
									bottomDrag.style.display="block";
									node.style.height="135px";
									toggle=0;
								}
								dataLayer[node.id].focus();
								
								draggable=1;
								editMode=1;
								}
								else
								{
									if(toggle)
									{
										contentL.style.display="block";
										bottomDrag.style.display="block";
										node.style.height="135px";
										toggle=0;
									}
								}
								
							};
						}
					}
					else if (subnodes[j].id =="erase")
					{
						var eraseLink=subnodes[j];
						if (destID !=null)
						subnodes[j].onclick=function ()
						{
							deletePostit("eski",destID,node.id,null,realname);
						};
						else
						{
							eraseLink.onclick=function ()
							{
								var ans=confirm("Notu silmek istediğinizden eminisiniz?");
								if(ans)
								{
								deletedCurrentPostitArray[deletedCurrent]=node.id;
								deletedCurrent++;
								loadXMLDoc('postit_sil','postit_sil.php?yayin_id='+dergi_id+'&is_new=y&delete='+node_string[node.id]);
								node.outerHTML="";
								node.innerHTML="";
								Drag.setVisibility(saveLink,'hidden');
								}
							};
						}
					}
					else if (subnodes[j].id =="save")
					{
						var saveLink=subnodes[j];
						if (destID !=null)
						{
							saveLink.onclick=function()
							{
								y=y-20;
								SaveCurrentPostit("eski",destID,realname,x,y);
							};
							data_child = node.childNodes;
		
							for(var count = 0; count < data_child.length; count++)
							{
								if (data_child[count].id =="content")
								{
									var contentLayer=data_child[count];
									contentLayer.innerHTML=initValue;
								}
							}
						}
						else
						{
						saveLink.onclick=function ()
						{
							//y=y-20;
							data_child = node.childNodes;
		
							for(var count = 0; count < data_child.length; count++)
							{
								if (data_child[count].id =="content")
								{
									subelements=data_child[count].childNodes;
									for(var counter = 0; counter < subelements.length; counter++)
									{
										if(subelements[counter].id=="notetext")
										{
											data=subelements[counter].value;
											dataInner=subelements[counter].innerHTML;
											if( data !="")
											{
												if( dergi_varmi ==1)
												{
													node.style.backgroundColor="#fdfdc4";
													subelements[counter].style.backgroundColor="#fdfdc4";

													editLink.style.padding="0px 0px 0px 50px";
													eraseLink.style.display="inline";
													closeLink.style.display="none";
													saveLink.style.display="none";
													data2Postit[node.id]=data;
													dataLayer[node.id]=subelements[counter];
													dataLayer[node.id].onkeypress=function ()
													{
														return false;
													};
													savedpostit_array[savedpostit_count]=node.id;
													savedpostit_count++;
												}
											}
										}
									}
								}
							}
							data=data.replace(/\n/g, "<br>");
							saveInDB(dergi_id,node.id,currentpage,x,y,data,editMode,noteID);
							if(data)
							{
								Drag.stopDrag(toolbar,node);
								Drag.stopDrag(bottomDrag,node);
							}
							bottomDrag.style.cursor="default";
							editMode=0;
							noteID="";
						};
						}
					}
				}
				theHandle = childs[i];
			}
		}
		document.getElementById("postitlayer").appendChild(node);
		this.init(theHandle,node,minX,maxX,minY,maxY);
		this.init(bottomDrag,node,minX,maxX,minY,maxY);
	},
	
	stopDrag:function(o, oRoot)
	{
		o.onmousedown	= "";
		o.root.onDragStart	= "";
		o.root.onDragEnd	= "";
		o.root.onDrag		= "";
	},
	init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
	{
		o.onmousedown	= Drag.start;

		o.hmode			= bSwapHorzRef ? false : true ;
		o.vmode			= bSwapVertRef ? false : true ;

		o.root = oRoot && oRoot != null ? oRoot : o ;

		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";
		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";
		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";
		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

		o.minX	= typeof minX != 'undefined' ? minX : null;
		o.minY	= typeof minY != 'undefined' ? minY : null;
		o.maxX	= typeof maxX != 'undefined' ? maxX : null;
		o.maxY	= typeof maxY != 'undefined' ? maxY : null;

		o.xMapper = fXMapper ? fXMapper : null;
		o.yMapper = fYMapper ? fYMapper : null;

		o.root.onDragStart	= new Function();
		o.root.onDragEnd	= new Function();
		o.root.onDrag		= new Function();
	},

	start : function(e)
	{	
		if (Drag.isDraggable)
		{
			var o = Drag.obj = this;
			e = Drag.fixE(e);
			y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
			x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
			o.root.onDragStart(x, y);
			document.getElementById(o.root.id).style.zIndex=zIndex++;
	
			o.lastMouseX	= e.clientX;
			o.lastMouseY	= e.clientY;
	
			if (o.hmode) {
				if (o.minX != null)	o.minMouseX	= e.clientX - x + o.minX;
				if (o.maxX != null)	o.maxMouseX	= o.minMouseX + o.maxX - o.minX;
			} else {
				if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
				if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
			}
	
			if (o.vmode) {
				if (o.minY != null)	o.minMouseY	= e.clientY - y + o.minY;
				if (o.maxY != null)	o.maxMouseY	= o.minMouseY + o.maxY - o.minY;
			} else {
				if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
				if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
			}
	
			document.onmousemove	= Drag.drag;
			document.onmouseup		= Drag.end;
			return false;
		}
	},

	drag : function(e)
	{
		e = Drag.fixE(e);
		var o = Drag.obj;

		var ey	= e.clientY;
		var ex	= e.clientX;
		
		y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		var nx, ny;

		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));
		Drag.obj.root.className="rootDragging";
		if (o.xMapper)		nx = o.xMapper(y)
		else if (o.yMapper)	ny = o.yMapper(x)
		
		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
		Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
		
		Drag.obj.lastMouseX	= ex;
		Drag.obj.lastMouseY	= ey;

		Drag.obj.root.onDrag(nx, ny);
		return false;
	},
	end : function()
	{
			document.onmousemove = null;
			document.onmouseup   = null;
			Drag.obj.root.className="root";
			Drag.obj.root.onDragEnd(	parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 
										parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
			Drag.obj = null;
	},
	fixE : function(e)
	{
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
	}
};
