
function popupac(en, boy, sayfa, diger) {
	var intLeft, intTop;
	intLeft=(screen.width-en)/2;
	intTop=(screen.height-boy)/2;
	window.open(sayfa, "", "width="+en+",height="+boy+","+diger+",left="+intLeft+",top="+intTop);
}

function _GHarita(argmt, baslik, yazi)
{
	popupac(760, 627, '_GHarita.php?arg='+argmt+'&baslik='+encodeURI(baslik)+'&yazi='+encodeURI(yazi), '');	
}

// -----------------------------------------------------------------------------

function showImg(path, title, winName)
{
	window.open('showImg.htm?i='+encodeURI(path)+'&amp;title='+encodeURI(title),winName,'toolbar=no,status=yes,location=no,menubar=no,width=200,height=100,left=150,top=5');
}

function urunPop(aEl, id)
{
    window.open($(aEl).readAttribute('href'), 'urun_'+id, 'toolbar=no,width=700,height=390,left=150,top=150');
    return false;
}

/*document.observe('dom:loaded', function() {

});*/

function headedTab(sHdrSel, cContentSel, sContentId, fromEl)
{
	$$(cContentSel).each(function(s){
		s.setStyle({'display':'none'});
	});
	$(sContentId).setStyle({'display':'block'});
	$$(sHdrSel).each(function(s){
		s.removeClassName('active');
	});
	fromEl.addClassName('active');
	return false;
}

// -----------------------------------------------------------------------------

function fReq(virgullu)
{
	var names = virgullu.split(",");
	var elArr;
	var el;
	for (i=0;i<names.length;i++)
	{
		elArr = document.getElementsByName(names[i]);
		el = elArr[0];
		var ck=true;
		if (el.type=='radio')
		{
			ck = false;
			for (j=0;j<elArr.length;j++)
				if (elArr[j].checked) ck = true;
		}
		if (el.value=='' || !ck)
		{
			alert(FREQ1+el.title+FREQ2);
			el.focus();
			return false;
		}
	}
	return true;
}

// -----------------------------------------------------------------------------

function anketSoruCb(containerElem, enFazlaSecim)
{
	var cbEls = $(containerElem).select('input[type="checkbox"]');
	var ulasildi = false;
	var seciliSayisi = 0;
	cbEls.each(function(s, i){
		if (s.checked) {
			seciliSayisi++;
		}
	});
	if (seciliSayisi >= enFazlaSecim) {
		cbEls.each(function(s, i){
			if (!s.checked) {
				s.disable();
			}
		});
	} else {
		cbEls.each(function(s, i){
			if (s.disabled) {
				s.enable();
			}
		});
	}
	if (seciliSayisi > enFazlaSecim) {
		return false;
	} else {
		return true;
	}	
	//alert(seciliSayisi);
	//alert(containerElem + ' : ' + enFazlaSecim);
}

function anketKontrol(containerElem)
{
	var inps = $(containerElem).select('input[type="checkbox"], input[type="radio"]');
	var bulundu = false;
	inps.each(function(s, i){
		if ((s.type == 'radio' || s.type == 'checkbox') && s.checked) {
			bulundu = true;
		}
	});
	if (!bulundu) {
		alert('Lütfen en az bir adet seçenek seçiniz.');
	}
	return bulundu;
}

// -----------------------------------------------------------------------------

function tbDef(sId, defTxt)
{
	var el = $(sId);
	Event.observe(el, 'focus', function() {
		if ($F(el) == defTxt) {
			el.value = '';
		}
	});
	Event.observe(el, 'blur', function() {
		if ($F(el) == '') {
			el.value = defTxt;
		}
	});
}