<!--

function openWindow(theURL,winName,features) 
{
	if (winName.window) winName.focus;
	popupWin = window.open(theURL,winName,features)
	popupWin.focus;
}

function openList(theURL,winName,features) 
{
	if (winName.window) winName.focus;
	popupWin = window.open(theURL,winName,features+',resizable=yes,scrollbars=yes')
	popupWin.focus();
}

function openFirmAssign(theURLCriteria, winName) 
{
	if (winName.window) winName.focus;
	popupWin = window.open('firmaata.asp?'+theURLCriteria, winName, 'height=320,width=380,resizable=yes,scrollbars=yes')
	popupWin.focus();
}

function confirmDelete()
{
	if(confirm("Silmek istediðinizden Emin misiniz?"))
	{
		return true;
	}
	else
	{
		return false;
	}
}
function showMessage(message)
{
	message = trimAll(message)
	var p=window.createPopup()
	var pbody=p.document.body
	pbody.style.backgroundColor="white"
	pbody.style.border="solid black 1px"
	pbody.innerHTML="<font color='#878787'>"+ message +"</font>"
	/*pbody.style.visibility="visible"
	pbody.style.position="absolute"
	pbody.style.left=event.clientX+10
	pbody.style.top=event.clientY*/
	p.show(event.clientX, event.clientY, 120, 80, document.body) // x y w h			
}

function trimAll(sString)
{
	while (sString.substring(0,1) == ' ')
	{
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}
	
function show(layerId) 
{
	if (document.all) 
	{
		document.all[layerId].style.visibility="visible";
	}
	else if (document.layers) 
	{
		document.layers[layerId].visibility="show";
	}
	else 
	{
		document.getElementById(layerId).style.visibility="visible";
	}
}

function hide(layerId) 
{
	if (document.all) 
	{
		document.all[layerId].style.visibility="hidden";
	}
	else if (document.layers) 
	{
		document.layers[layerId].visibility="hide";
	}
	else 
	{
		document.getElementById(layerId).style.visibility="hidden";
	}
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
	{
		curtop += obj.y;
	}
	return curtop;
}
function findPosX(obj)
 {
    	var curleft = 0;
    	if(obj.offsetParent)
    	{
        	while(1) 
        	{
          		curleft += obj.offsetLeft;
          		if(!obj.offsetParent)
            			break;
            		
          		obj = obj.offsetParent;
        	}
        }
    	else if(obj.x)
    	{
        	curleft += obj.x;
    	}
    	return curleft;
  }
  
function getMouseX(E) 
{
    	return	event.clientX + document.body.scrollLeft;
}

function getMouseY(E) 
{
  	return event.clientY + document.body.scrollTop;
}

function showObject(elementId)
{
  	 document.getElementById(elementId).style.visibility = "visible";
} 
function hideObject(elementId) 
{
	 document.getElementById(elementId).style.visibility = "hidden";
}

	// Eventin kodunu doner
	function getKeyCode(e)
	{
		if (window.event)
	   		return window.event.keyCode;
		else if (e)
	   		return e.which;
		else
	   		return null;
	}
	// Eventin ana objesini doner
	function getSrcElement(e)
	{
		if (e.target) 
			targ = e.target;
		else if (e.srcElement) 
			targ = e.srcElement;
		if (targ.nodeType == 3) // defeat Safari bug
			targ = targ.parentNode;
	
		return targ;
	}
	
	function checkEmail(emailStr) 
	{
		// checks if the e-mail address is valid
		var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
		var matchArray = emailStr.match(emailPat);
		if (matchArray == null) 
		{
			//alert("Your email address seems incorrect.  Please try again (check the '@' and '.'s in the email address)");
			return false;
		}
		// make sure the IP address domain is valid
		var IPArray = matchArray[2].match(/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/);
		if (IPArray != null) 
		{
			for (var i=1;i<=4;i++) 
			{
				if (IPArray[i]>255) 
				{
					alert("Destination IP address is invalid!")
					return false;
	      			}
	   		}
		}
		return true;
	}

	function checkEmail(emailStr) 
	{
		var EmailOk  = true
		var AtSym    = emailStr.indexOf('@')
		var Period   = emailStr.lastIndexOf('.')
		var Space    = emailStr.indexOf(' ')
		var Length   = emailStr.length - 1   // Array is from 0 to length-1
		
		if ((AtSym < 1) ||                     // '@' cannot be in first position
		    (Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
		    (Period == Length ) ||             // Must be atleast one valid char after '.'
		    (Space  != -1))                    // No empty spaces permitted
		   {  
		      EmailOk = false
		   }
		return EmailOk
	}
	
	function isEmailValid(elementId)
	{
		var EmailOk  = true
		var Temp     = document.getElementById(elementId);//document.forms[FormName].elements[ElemName]
		var AtSym    = Temp.value.indexOf('@')
		var Period   = Temp.value.lastIndexOf('.')
		var Space    = Temp.value.indexOf(' ')
		var Length   = Temp.value.length - 1   // Array is from 0 to length-1
		
		if ((AtSym < 1) ||                     // '@' cannot be in first position
		    (Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
		    (Period == Length ) ||             // Must be atleast one valid char after '.'
		    (Space  != -1))                    // No empty spaces permitted
		   {  
		      EmailOk = false
		     // alert('Lütfen geçerli bir E-Posta adresi girin!')
		      Temp.focus()
		   }
		return EmailOk
	}

function isText(event)
{
	var ValidChars = "abcçdefgðhiýjklmnoöpqrsþtuüvwyzABCÇDEFGHIÝJKLMNOÖPQRSÞTUÜVXYZ ";
	var IsText=true;
	var char;
	keyCode = getKeyCode(event);
	if(keyCode != 8 && keyCode != 0) // 8-Backspace 9-Tab
	{
		sText = String.fromCharCode(keyCode);
		for (i = 0; i < sText.length && IsText == true; i++) 
		{ 
			Char = sText.charAt(i); 
		      	if (ValidChars.indexOf(Char) == -1) 
			{
				IsText = false;
			}
		}
	}
   	return IsText;   
}   
function isNumeric(event, isDecimal)
{
	var ValidChars = "0123456789";
	if(isDecimal && getSrcElement(event).value.indexOf('.')==-1)
	{
		ValidChars += ".";
	}
	var IsNumber=true;
	var char;
	keyCode = getKeyCode(event);
	if(keyCode != 8 && keyCode != 0) // 8-Backspace 9-Tab
	{
		sText = String.fromCharCode(keyCode);
		for (i = 0; i < sText.length && IsNumber == true; i++) 
		{ 
			Char = sText.charAt(i); 
		      	if (ValidChars.indexOf(Char) == -1) 
			{
				IsNumber = false;
			}
		}
	}
   	return IsNumber;   
}

function isDate(event, dateSeperator)
{
	var ValidChars = "0123456789"+dateSeperator;
	var IsNumber=true;
	var char;
	keyCode = getKeyCode(event);
	if(keyCode != 8 && keyCode != 0) // 8-Backspace 9-Tab
	{
		sText = String.fromCharCode(keyCode);
		for (i = 0; i < sText.length && IsNumber == true; i++) 
		{ 
			Char = sText.charAt(i); 
		      	if (ValidChars.indexOf(Char) == -1) 
			{
				IsNumber = false;
			}
		}
	}
   	return IsNumber;   
}

function isTelephone(event)
{
	var ValidChars = "0123456789+() ";
	var IsTelephone=true;
	var char;
	keyCode = getKeyCode(event);
	if(keyCode != 8 && keyCode != 0) // 8-Backspace 9-Tab
	{
		sText = String.fromCharCode(keyCode);
		for (i = 0; i < sText.length && IsTelephone == true; i++) 
		{ 
			Char = sText.charAt(i); 
		      	if (ValidChars.indexOf(Char) == -1) 
			{
				IsTelephone = false;
			}
		}
	}
   	return IsTelephone;   
}   
	
function isTime(event)
{
	var ValidChars = "0123456789:";
	var IsTime=true;
	var char;
	keyCode = getKeyCode(event);
	if(keyCode != 8 && keyCode != 0) // 8-Backspace 9-Tab
	{
		sText = String.fromCharCode(keyCode);
		alert(sText);
		for (i = 0; i < sText.length && IsTime == true; i++) 
		{ 
			Char = sText.charAt(i); 
		      	if (ValidChars.indexOf(Char) == -1) 
			{
				IsTime = false;
			}
		}
	}
   	return IsTime;   
}

function remove(s, t) 
{
  /*
  **  Remove all occurrences of a token in a string
  **    s  string to be processed
  **    t  token to be removed
  **  returns new string
  */
  	i = s.indexOf(t);
  	r = "";
  	if (i == -1) 
  		return s;
  	r += s.substring(0,i) + remove(s.substring(i + t.length), t);
  	return r;
  }
  
  function getSelectedRadioValue(radioElement)
  {
  	for (i=0;i<radioElement.length;i++)
	{
	      if (radioElement[i].checked)
	      {
	             return radioElement[i].value;
	      }
	}  	
	return null;
  }
  
function getPureURL(strURL) 
{
	if (strURL.indexOf('?') < 0)
	{
		return strURL;
	}
	else
	{
		return strURL.substring(0, strURL.indexOf('?'));
	}
}

function setChecked(field, chType) 
{
	if(field.length!=undefined)
	{
		for (i=1; i < field.length+1; i++)
		{
			field[i-1].checked = (chType=="1");
		}
	}
	else
	{
		field.checked=(chType=="1");
	}
	
}
		
function setCheckedAll(field) 
{
	if(field.length!=undefined)
	{
		for (i=1; i < field.length+1; i++)
		{
			field[i-1].checked = true;
		}
	}
	else
	{
		field.checked=true;
	}
}

function setUnCheckedAll(field) 
{
	if(field.length!=undefined)
	{
		for (i=1; i < field.length+1; i++)
		{
			field[i-1].checked = false;
		}
	}
	else
	{
		field.checked=false;
	}
}


	// Add the selected items from the source to destination list
	function addSrcToDestList(srcListId, destListId) 
	{
		srcList = document.getElementById(srcListId);
		destList = document.getElementById(destListId);
		//destList = window.document.forms[0].destList;
		//srcList = window.document.forms[0].srcList; 
		var len = destList.length;
		for(var i = 0; i < srcList.length; i++) 
		{
			if ((srcList.options[i] != null) && (srcList.options[i].selected)) 
			{
				//Check if this value already exist in the destList or not
				//if not then add it otherwise do not add it.
				var found = false;
				for(var count = 0; count < len; count++) 
				{
					if (destList.options[count] != null) 
					{
						if (srcList.options[i].text == destList.options[count].text) 
						{
							found = true;
							break;
	      					}
	   				}
				}
				if (found != true) 
				{
					destList.options[len] = new Option(srcList.options[i].text,srcList.options[i].value); 
					len++;
				}
	      		}
	   	}
	}
	
	
	// Deletes from the destination list.
	function deleteFromDestList(destListId)
	{
		destList = document.getElementById(destListId);
		//var destList  = window.document.forms[0].destList;
		var len = destList.options.length;
		for(var i = (len-1); i >= 0; i--) 
		{
			if ((destList.options[i] != null) && (destList.options[i].selected == true)) 
			{
				destList.options[i] = null;
	      		}
	   	}
	}
	
	function setSelectedAll(srcListId) 
	{
		srcList = document.getElementById(srcListId);
		for(var i = 0; i < srcList.length; i++) 
		{
			if (srcList.options[i] != null && srcList.options[i].value!='NULL' && srcList.options[i].value!='') 
			{
				srcList.options[i].selected=true;
			}
			else
			{
				srcList.options[i].selected=false;
			}
		}	
	}
	function hasOptions(obj) 
	{
		if (obj!=null && obj.options!=null) 
		{ 
			return true; 
		}
		return false;
	}
	
	function sortSelect(objId) 
	{
		obj = document.getElementById(objId);
		var o = new Array();
		if (!hasOptions(obj)) 
		{ 
			return; 
		}
		for (var i=0; i<obj.options.length; i++) 
		{
			o[o.length] = new Option( obj.options[i].text, obj.options[i].value, obj.options[i].defaultSelected, obj.options[i].selected) ;
		}
		if (o.length==0) 
		{ 
			return; 
		}
		o = o.sort(function(a,b) { 
				if ((a.text+"") < (b.text+"")) { return -1; }
				if ((a.text+"") > (b.text+"")) { return 1; }
				return 0;
				} 
			);

		for (var i=0; i<o.length; i++) 
		{
			obj.options[i] = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
		}
	}

function isSqlSafe(event)
{
	var inValidChars = '"()<>=;-|&+%_?';
	var IsSafe=true;
	var char;
	keyCode = getKeyCode(event);
	if(keyCode != 8 && keyCode != 0) // 8-Backspace 9-Tab
	{
		sText = String.fromCharCode(keyCode);
		for (i = 0; i < sText.length; i++) 
		{ 
			Char = sText.charAt(i); 
		    if (inValidChars.indexOf(Char) != -1) 
			{
				return false;
			}
		}
	}
   	return true;   
}   
-->