/*Copyright ©2006 Tüm hakları saklıdır.
MERKEZ GAZETE DERGİ BASIM YAYINCILIK SANAYİ VE TİCARET A.Ş. */
function getArchive(yil,yayin_id,d_tipi)
{
	var query="?yil="+yil+"&y_id="+yayin_id+"&d_tip="+d_tipi;
	var targetDiv=document.getElementById("ArchiveYearContent");
	var selectedLink=document.getElementById(yil+"-"+yayin_id);
	if(targetDiv.style.display =="none")
		targetDiv.style.display="block";
	loadXMLDoc('arsiv','getArchive.php'+query);
}
function processArchive(evt)
{
        if (req.readyState == 4)
        {
                
                if (req.status == 200)
                {
					var response=req.responseText;
					var target=document.getElementById("ArchiveYearContent");
					target.innerHTML=response;
					
				}
		}
}
function loadXMLDoc(object,url)
{
       
        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)
        {
        		if(object=="showpage")
        		{
                	req.onreadystatechange = processChange;
                }
				else if (object =="postit_sil")
				{
					req.onreadystatechange = processPostitSil;
				}
				else if (object =="showmaps")
				{
					req.onreadystatechange = processMaps;
				}
                else if(object=="kaydet")
                {
                	req.onreadystatechange = processKaydet;
                }
				else if(object =="arsiv")
                {
                	req.onreadystatechange = processArchive;
                }
				req.open("GET", url, true);
                req.send(null);
        }
}
function isFlash(inVersion){
 FlashMode = 0;
 if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
  if (navigator.plugins && navigator.plugins["Shockwave Flash"] && (versionIndex = navigator.plugins["Shockwave Flash"].description.indexOf(".")) != - 1) {
   var versionString = navigator.plugins["Shockwave Flash"].description.substring(versionIndex-1, versionIndex);
   versionIndex = parseInt( versionString );
   if ( versionIndex >= inVersion ) {
     FlashMode = 1;
   }
  }
 }
 else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
    && (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0 )) {
  theStr='FlashMode = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+inVersion+'"))) \n';
  document.write('<script language=VBScript\> \n');
  document.write('on error resume next \n');
  document.write(theStr);
  document.write('</script\> \n');
   
 }
 return FlashMode;
}

function insertFlash(i_minVersion, i_path, i_name, i_width, i_height, i_bgcolor, i_fb,i_link,i_fblink, transparent) {
  document.write(' <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
  document.write(' codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0/default.htm"');
  document.write(' ID="' + i_name + '" width="' + i_width + '" height="' + i_height + '">');
  document.write(' <param name=movie value="' + i_path +'"> ');
  document.write(' <param name=quality value=high> ');
  document.write(' <param name=menu value=false> ');
  document.write(' <param name=bgcolor value=#' + i_bgcolor + '> ');
  if(transparent)
  document.write(' <param name=wmode value=transparent> ');
  document.write(' <embed src="' + i_path +'"');
  if(transparent)
  document.write(' wmode=transparent ');
  document.write(' name=' + i_name + ' swLiveConnect="true" width="' + i_width + '" height="' + i_height + '"');
  document.write(' quality="high" menu="false" bgcolor="#' + i_bgcolor + '"');
  document.write(' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/download.cgi@P1_Prod_Version=ShockwaveFlash.htm">');
  document.write('</embed>');
  document.write('</object>');
}

var isNav, isIE;

if (parseInt(navigator.appVersion) >= 4) {
	if (navigator.appName == "Netscape")
		isNav = true;
	else 
		isIE = true;
}

function AddOption(SelectBox,Text,Value,index){
	var oOption = document.createElement("OPTION");
	oOption.text=Text;
	oOption.value=Value;
	SelectBox.options.add(oOption,index);
}

function FillSeries(lst,start,end){
	var menu_lst = document.getElementById('lst') ;
	
	for (var i=start;i<=end;i++) {
		var op=document.createElement("OPTION");
		var i2=(i<10)?'0'+i:''+i;
		op.text=op.value=i2;
		lst.options.add(op);
	}
}

function FillSeries_div(lst,start,end){
	var menu_lst = document.getElementById('lst') ;
	for (var i=start;i<=end;i++) {
		var op=document.createElement("OPTION");
		var i2=(i<10)?'0'+i:''+i;
		op.text=op.value=i2;
		menu_lst.options.add(op);
	}
}

function FillDays(lst){
	
	FillSeries(lst,1,31);
}

function FillMonths(lst){
	FillSeries(lst,1,12);
}

function FillYears(lst,year1,year2) {
	
	for (var i=year1;i<=year2;i++) {
		var op=document.createElement("OPTION");
		op.value=op.text=i;
		lst.options.add(op);
	}
}

function fnChkClick(sID){
	if(document.getElementById(sID).checked){
		document.getElementById("trFatura").style.display="block";
	}else{
		document.getElementById("trFatura").style.display="none";
	}
}

function  fnrdClick(sName){
	if (document.getElementsByName(sName)[0].checked) {
		document.getElementById("trSirket").style.display = "none";
		document.getElementById("trBaskasi").style.display = "block";
	}
	else {
		document.getElementById("trSirket").style.display = "block";
		document.getElementById("trBaskasi").style.display = "none";
	}
}

var isIE = document.all ? true : false;
var submitcount=0;

function Gonder( thisForm )
{
	if (submitcount == 0)
	{
		submitcount++;
		
		if (KontrolEt(thisForm))
		{
			if (isIE) 
			{
				document.all.expfield.outerHTML = '<font id=expfield class=kirmizi_uyari> Bilgileriniz yollanıyor.Lütfen bekleyiniz... </font>';
			}
			document.forms["order"].submit();
			return true;
		}
		else
		{
			submitcount = 0;
			return false;
		}
	}
	else
	{
		if (isIE) 
		{
			document.all.expfield.outerHTML = '<font id=expfield face=Verdana size=2 color=#800000> Bilgileriniz sisteme ulaşmak üzere. Lütfen bekleyiniz... </font>';
		}
	}
}

function imgBorderPoints(wid, hgt, colorNW, colorNE, colorSW, colorSE) 
{
	if (colorNE == null) colorNE = colorNW;
	if (colorSW == null) colorSW = colorNW;
	if (colorSE == null) colorSE = colorNW;

	var img = "<img width=\"1\" height=\"1\" border=\"0\" alt=\"\" src=\"/i/1pix.gif\">";
	//img = "";

	document.write(
		'<div style="position: absolute; left: 0px; top: 0px; width: 1px; height: 1px; z-index: 100; background-color: ' + colorNW + '">' + img + '</div>' +
		'<div style="position: absolute; left: 0px; top: ' + (hgt - 1) + 'px; width: 1px; height: 1px; z-index: 100; background-color: ' + colorSW + '">' + img + '</div>' +
		'<div style="position: absolute; left: ' + (wid - 1) + 'px; top: 0px; width: 1px; height: 1px; z-index: 100; background-color: ' + colorNE + '">' + img + '</div>' +
		'<div style="position: absolute; left: ' + (wid - 1) + 'px; top: ' + (hgt - 1) + 'px; width: 1px; height: 1px; z-index: 100; background-color: ' + colorSE + '">' + img + '</div>'
	);

	document.write(
		'<div style="position: absolute; left: 0px; top: 0px; width: 1px; height: 1px; z-index: 100; background-color: ' + colorNW + '">' + img + '</div>' +
		'<div style="position: absolute; left: 0px; bottom: 0px; width: 1px; height: 1px; z-index: 100; background-color: ' + colorSW + '">' + img + '</div>' +
		'<div style="position: absolute; right: 0px; top: 0px; width: 1px; height: 1px; z-index: 100; background-color: ' + colorNE + '">' + img + '</div>' +
		'<div style="position: absolute; right: 0px; bottom: 0px; width: 1px; height: 1px; z-index: 100; background-color: ' + colorSE + '">' + img + '</div>'
	);
}


function validateLogin() {
	var form = __getForm();
	
	var message = "";

	
	if (form.user.value == "") {
		message = message + "\n" + '* Kullanıcı Adı giriniz:';
	}

	if (form.password.value == "") {
		message = message + "\n" + '* Şifre giriniz:';
	}

	if (message !== '') {
		alert('Aşağıda belirtilen eksikleri tamamlayıp tekrar deneyin;\n' + message + '\n\n');
	} else {
		__doPostBack("login");
	}
}

function loginKeyPress(evt) {
	var keyValue;

	if (isNav)
		keyValue = evt.which;
	else
		keyValue = window.event.keyCode;

	if (keyValue == 13) {
		validateLogin();
	}
}

function RpopUp( URL, W, H, L, T ) {
	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 PopUpFixed( URL, name, W, H, L, T ) {
	var wnd = window.open(URL, name, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=' + W + ',height=' + H + ',left='+L+',top='+T);
	wnd.focus();
}

function strICompare(str1, str2) {
	if (str1.toLocaleUpperCase) {
		str1 = str1.toLocaleUpperCase();
		str2 = str2.toLocaleUpperCase();
	} else {
		str1 = str1.toUpperCase();
		str2 = str2.toUpperCase();
	}
		
	if (str1 < str2)
		return -1;
	else if (str1 > str2)
		return 1;
	else
		return 0;
}
