function trim(str)
{
	return str.replace(/^\s+|\s+$/g,'');
}

function takeYear(theDate) {
	x = theDate.getYear();
	var y = x % 100;
	y += (y < 38) ? 2000 : 1900;
	return y;
}



function numaraYapma(textBox)
{
	while (textBox.value.length > 0 && isNaN(textBox.value)) {
		textBox.value = textBox.value.substring(0, textBox.value.length - 1)
	}	
	textBox.value = trim(textBox.value);
}

function secBirak(grpStr, button) {
 var form, el, e, f = 0;
 var unbuttoned = (button.value.substring(0,2).toLowerCase() == 'un');
 while (form = document.forms[f++]) {
   e = 0;
   while (el = form.elements[e++])
   if (el.type == 'checkbox' && el.name.indexOf(grpStr) != -1)
      el.checked = !unbuttoned;
 }
 button.value = unbuttoned ? button.value.substring(2) : 'un' + button.value;
}

function isEmpty(formElement, message) {
	formElement.value = trim(formElement.value);
	
	_isEmpty = false;
	if (formElement.value == '') {
		_isEmpty = true;
		alert(message);
		formElement.focus();
	}
	
	return _isEmpty;
}

function setSelect(listElement, listValue)
{
	for (i=0; i < listElement.options.length; i++) {
		if (listElement.options[i].value == listValue)	{
			listElement.selectedIndex = i;
		}
	}	
}

function acPencereyi(sayfa,gen,uz,x,y) {
	x = (640 - gen)/2, y = (480 - uz)/2;

    if (screen) {
        y = (screen.availHeight - uz)/2;
        x = (screen.availWidth - gen)/2;
    }

    pencerem = window.open(sayfa,'windowRef','width=' + gen + ',height=' + uz +',scrollbars=1,status=0,top='+ y +',left='+ x +',screenX='+ x +',screenY='+ y);
    if (!pencerem.opener) pencerem.opener = self;
}

function fiyt() {;}

function gostertBunu(e){
	if (e.style.display=='none'){
			e.style.display='block';
			}
		else {
			e.style.display='none';
			}
		}
	
/* Win IE 5.5 & 6 için png düzeltmesi */
function correctPNG() 
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}
function change() {
    var color1 = '#ccffff';
    var color2 = '#dd00ff';
    if (document.layers)
        window.document.layers[i].bgColor = color1;
    else if (document.all)
        window.document.all[i].style.background = color2;
}


///////addelement ////////////
function addElement() {
  var ni = document.getElementById('myDiv');
  var numi = document.getElementById('theValue');
  var num = (document.getElementById('theValue').value -1)+ 2;
  numi.value = num;
  var newdiv = document.createElement('div');
  var divIdName = 'my'+num+'Div';
  newdiv.setAttribute('id',divIdName);
  newdiv.innerHTML = '<input type="file" name="resim'+num+'" id="resim'+num+'"> <a href="javascript:fiyt()" onclick="removeElement(\''+divIdName+'\')">Kaldır</a>';
  ni.appendChild(newdiv);
}
function removeElement(divNum) {
  var d = document.getElementById('myDiv');
  var olddiv = document.getElementById(divNum);
  d.removeChild(olddiv);
}