/**
 * @Copyright	1997 - 2010 OnlineTr Ltd.
 * @Author		OnlineTr Ltd <info@onlinetr.com>
 * @Version		1.0
*/
var LoadImgThum = '<div style="width:100px;height:auto;padding-top:30px;" align="center"><img src="/intranet/i/loading_kare.gif" style="width:16px; height:16px;" border="0" alt="yükleniyor..."></div>';


function checkInput(obj, n, min, max, mType, mClass, m, myMsg) {
	var ok = 0;

	if (mType == 'text') {
		if (jQuery.trim($(obj).val()).length == 0 ) { ok++; }
		if (jQuery.trim($(obj).val()).length > max || jQuery.trim($(obj).val()).length < min) { ok++; }
	}

	if (mType == 'num') {
		if (isNaN($(obj).val())) { ok++; }
		if (jQuery.trim($(obj).val()).length == 0 ) { ok++; }
	}

	if (mType == 'email') {
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		var address = $(obj).val();
		if(reg.test(address) == false) { ok++; }
		if (jQuery.trim($(obj).val()).length == 0 ) { ok++; }
	}

	if (ok > 0) {
		$(obj).addClass('borderRed');
		$(obj).focus();
		if ($(obj) != null) { $(m).html(myMsg); }
		return false;
	}
	else {
		$(obj).val(jQuery.trim($(obj).val()));
		$(obj).removeClass('borderRed');
		if (mClass != null) { $(obj).addClass(mClass); }
		if ($(m) != null) { $(m).html(''); }
		return true;
	}        
}



//--------------------------------
// Save functions
//--------------------------------

var ajaxObjects = new Array();
function saveMyTree()
{


jConfirm('Kategori Sıralaması Kaydedilsin mi?', 'Dikkat!', function(r) {
	if (r==true)
	{
		saveString = treeObj.getNodeOrders();
		var ajaxIndex = ajaxObjects.length;
		ajaxObjects[ajaxIndex] = new sack();
//		alert(saveString);
		var url = 'kategoriSiralamaKaydet.asp?saveString=' + saveString;
		ajaxObjects[ajaxIndex].requestFile = url;	// Specifying which file to get
		ajaxObjects[ajaxIndex].onCompletion = function() { saveComplete(ajaxIndex); } ;	// Specify function that will be executed after file has been found
		ajaxObjects[ajaxIndex].runAJAX();		// Execute AJAX function			
	}
});
}

function saveComplete(index)
{
	jAlert('Kategori Sıralaması Kaydedildi', 'Bilgi!');
//	alert(ajaxObjects[index].response);
}


// Call this function if you want to save it by a form.
function saveMyTree_byForm()
{
	document.myForm.elements['saveString'].value = treeObj.getNodeOrders();
}





    function aKConfirm(tt,param, msg, myUrl) {
        if (confirm(tt + ' ' + msg)) {
			if (myUrl!=null)
			{
	            window.open('?'+ myUrl +'&param='+param, '_self');
			}
			else
			{
	            window.open('?param='+param, '_self');
			}
        }
    }



	function changeDynaList( listname, source, key, orig_key, orig_val ) {
		var list = eval( 'document.haber_form.' + listname );

		// empty the list
		for (i in list.options.length) {
			list.options[i] = null;
		}
		i = 1;

		opt = new Option();
		opt.value = '-1';
		opt.text = '---';
		list.options[0] = opt;

		for (x in source) {
			if (source[x][0] == key) {
				opt = new Option();
				opt.value = source[x][1];
				opt.text = source[x][2];

				if ((orig_key == key && orig_val == opt.value) || i == 0) {
					opt.selected = true;
				}
				list.options[i++] = opt;
			}
		}
		list.length = i;
	}


	function perde1(op) {
        document.write('<div id="perde" style="opacity: .'+op+'; -khtml-opacity: .'+op+'; -moz-opacity: .'+op+'; filter:alpha(opacity='+op+'); z-index:99999; margin-left:-10px; position:absolute; margin-top:-' + document.body.clientHeight + 'px; background-color:#000000; height:' + (document.body.clientHeight + 70) + 'px; width:' + (document.body.clientWidth + 20) + 'px;"></div>');
    }



	function GrfDegistir(myVal){
		if (myVal==0) // 1 ay
		{
			tmpGr = 'http://www.platodata.com.tr/images/1A/ZU100_1A.png';
			//'<img src="/intranet/i/loading_kare.gif" style="width:16px; height:16px;" border="0" alt="yükleniyor...">'

		}
		else if (myVal==1) // 1 yıl
		{
			tmpGr = 'http://www.platodata.com.tr/images/1Y/ZU100_1Y.png';
		}
		else // günlük
		{
			tmpGr = 'http://www.platodata.com.tr/images/5/ZU100_5.png';
		}
		$('#borsagrafik').attr('src', tmpGr);
		

		for (ii=0;ii<3;ii++)
		{
			$('#m'+ii).removeClass('selected');
		}
		$('#m'+myVal).addClass('selected');

	}


function openChat(varUrl) {
 var winleft=(screen.width-700)/2;
 var wintop=(screen.height-450)/2;
 window.open(varUrl,'chat','toolbar=0,location=0,status=1,menubar=0,scrollbars=0,resizable=1,width=700,height=450,top='+wintop+',left='+winleft);
}

