﻿//<!--
        function Mlen(field, maxlen) {
        if (field.value.length > maxlen) {
            field.value = field.value.substring(0, maxlen);
            alert('You can only enter ' + maxlen.toString() + ' characters in this field.'); }
        }
        function openPopUp(lnk, wname, title, w, h){
            splashWin = open('', wname, "height=" + h + ",width=" + w + ",fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=1,center=1");
            splashWin.blur();   // Hide while updating
            splashWin.moveTo(screen.width/2- w/2,screen.height/2- h/2);
            splashWin.location=lnk;
            splashWin.focus();
        }
        function UpdateList(lst, newval, newid) {
            newoption = new Option(newval, newid, false, true);
            lst.options[lst.length] = newoption;
        }
        
        function VerifyDelete() { return (confirm('Selected record(s) will be deleted.  Would you like to continue?')) }
        function VerifyPurge() { return (confirm('Selected record(s) will be purged.  Would you like to continue?'))}

        //burda biraz yapılacak iş var
            function SelectListItems() {
            for (i = 0; i < document.frmEdit.lstIhracat.length; i++)
               document.frmEdit.lstIhracat.options[i].selected = true;
            for (i = 0; i < document.frmEdit.lstIthalat.length; i++)
                document.frmEdit.lstIthalat.options[i].selected = true;
            for (i = 0; i < document.frmEdit.lstFirmCats.length; i++)
                document.frmEdit.lstFirmCats.options[i].selected = true;
            }

        function AddItem(lstFrom, lstTo) {
            var boxLength = lstTo.length;
            var selectedItem = lstFrom.selectedIndex;
            if (selectedItem == -1) 
                alert('Please select an item from the list first.!');
            else {
            var selectedText = lstFrom.options[selectedItem].text;
            var selectedValue = lstFrom.options[selectedItem].value;
            var i;
            var isNew = true;
            
            for (i = 0; i < boxLength && isNew == true; i++)
            isNew = (lstTo.options[i].value != selectedValue);
                
            if (isNew) {
            newoption = new Option(selectedText, selectedValue, false, false);
            lstTo.options[boxLength] = newoption;
            };
            lstFrom.selectedIndex=-1;
            }
            } 
        function RemoveItem(lst) {
            arrSelected = new Array();
            var count = 0;
            for (i = 0; i < lst.length; i++) {
            if (lst.options[i].selected) arrSelected[count] = lst.options[i].value;
            count++;
            };
            var x;
            for (i = 0; i < lst.length; i++)
            for (x = 0; x < arrSelected.length; x++)
            if (lst.options[i].value == arrSelected[x])
                lst.options[i] = null;
            }
			
		function toggleSection(str) {
			var tbl = document.getElementById(str);
			var ok = document.getElementById('img' + str);
			
			try {
				if (tbl.style.display != "none") {
					tbl.style.display = "none"; 
					ok.src= "/admin/images/plus.gif";
				} else {
					tbl.style.display = "block"; 
					ok.src= "/admin/images/minus.gif";
				}
			} catch (er){alert(er.description);}
		}
        
		function MyPrint(){
			splashWin = window.open ("/print.asp","print","height=450,width=500,scrollbars=no,resizable=yes,status=no,menubar=no,toolbar=no,location=no,directories=0,fullscreen=0,center=1");
			splashWin.moveTo(screen.width/2-225,screen.height/2-250);
		}             
		function MyEmail(){
			splashWin = window.open ("/email.asp","print","height=450,width=500,scrollbars=no,resizable=yes,status=no,menubar=no,toolbar=no,location=no,directories=0,fullscreen=0,center=1");
			splashWin.moveTo(screen.width/2-225,screen.height/2-250);
		}             
		function ExportToExcel(){
			var html = '';
			if (document.getElementById('divCompanyHeader') != null) 
				html = html + '<div align=center style="font-size:18pt;font-family:tahoma,verdana"><b>' + document.getElementById('divCompanyHeader').innerHTML + '</b></div><br><br>';
				//html = html + '<div align=center style="font-size:18pt;font-family:tahoma,verdana"><b>' + window.opener.document.getElementById('divHeader').innerHTML + '</b></div><br><br>';
			if (document.getElementById('divHeader') != null) 
				html = html + '<div align=center style="font-size:12pt;font-family:tahoma,verdana"><b>' + document.getElementById('divHeader').innerHTML + '</b></div><br><br>';
				//html = html + '<div align=center style="font-size:18pt;font-family:tahoma,verdana"><b>' + window.opener.document.getElementById('divHeader').innerHTML + '</b></div><br><br>';
			if (document.getElementById('divContent') != null) 
				html = html + '<div align=center style="font-size:12pt;font-family:tahoma,verdana"><b>' + document.getElementById('divContent').innerHTML + '</b></div><br><br>';
			document.frmExport.txtExcelExport.value = html;
			document.frmExport.submit();
		}             
// -->	
