/* javascript "click" */
function go(u) {
  window.location=u; return false;
};

/* un-hide, hide */
function uh(id) {
  document.getElementById(id).style.display = "";
};

function h(id) { 
  document.getElementById(id).style.display = "none";
};


/* show item */
function showItem(item)	{
  document.getElementById(item).style.display='block';
};

/* hide item */
function hideItem(item) {
  document.getElementById(item).style.display='none';
};

/* toggle items */
function toggleItem(item) {
  if ((document.getElementById(item).style.display=='none') ||
      (document.getElementById(item).style.display=='')) {
    document.getElementById(item).style.display='block';
  } else {
    document.getElementById(item).style.display='none';
  }
};

/*switch items */
var currentItem="item1";

function switchItem(which) {
  switchItem2(currentItem, which);
  currentItem=which;
};

/* hide one item, show another */
function switchItem2(toHide,toShow) {
  hideItem(toHide);
  showItem(toShow);
};

/* event listener to close service dropdown */
document.onclick=function(event){
  if(document.getElementById('servicelist').style.display=="block"){
    hideItem('servicelist');
  }
};

/* Turkish chars */

function typeLetter(theLetter){
    insertCharacter($("word"),theLetter);
}

function typeLetter2(theLetter){
   insertCharacter($("word2"),theLetter);
}
function typeLetter3(theLetter,inputTextRow){
   inputTextId = "word"+inputTextRow;
   
   insertCharacter($(inputTextId),theLetter);
}

function insertCharacter(mF, mV) {
	if (document.selection) {
	var t;mF.focus();
	sel=document.selection.createRange();t=sel.text.lenght;sel.text=mV;
	if (mV.length==0){sel.moveStart('character',mV.length);
	sel.moveEnd('character',mV.length);
	}else {
	sel.moveStart('character',-mV.length+t);
	}sel.select();
	}else if (mF.selectionStart || mF.selectionStart=='0'){
	var sP=mF.selectionStart;
	var eP=mF.selectionEnd;
	mF.value=mF.value.substring(0,sP)+mV+mF.value.substring(eP,mF.value.length);
	mF.selectionStart=sP+mV.length;
	mF.selectionEnd=sP+mV.length;
	mF.focus();
	}else{
	mF.value+=mV;}
}


var $;
if (!$ && document.getElementById) {
$ = function() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string') {
element = document.getElementById(element);
}
if (arguments.length == 1) {
return element;
}
elements.push(element);
}
return elements;
}
}
else if (!$ && document.all) {
$ = function() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string') {
element = document.all[element];
}
if (arguments.length == 1) {
return element;
}
elements.push(element);
}
return elements;
}
}
