
var popupHandle;

function admin(url) {
height=700;
width=950;
var properties="toolbar=0, location=0, status=yes,resizable=yes,scrollbars=yes,menubar=yes,height=" + height;
properties=properties + ", width=" + width;
popupHandle=window.open(url,"",properties);
}

function lookus(url) {
height=560;
width=790;
var properties="toolbar=0, location=0, status=yes,resizable=yes,scrollbars=yes,menubar=yes,height=" + height;
properties=properties + ", width=" + width;
var leftprop, topprop, screenX, screenY, cursorX, cursorY, padAmt;
screenY=document.body.offsetHeight;
screenX=window.screen.availWidth;
leftvar=(screenX - width) / 2;
rightvar=(screenY - height) / 2;
properties=properties + ", left=" + leftvar;
properties=properties + ", top=" + rightvar;
popupHandle=window.open(url,"",properties);
}
function smallwin(url) {
height=324;
width=290;
var properties="toolbar=0, location=0, height=" + height;
properties=properties + ", width=" + width;
var leftprop, topprop, screenX, screenY, cursorX, cursorY, padAmt;
screenY=document.body.offsetHeight;
screenX=window.screen.availWidth;
leftvar=(screenX - width) / 2;
rightvar=(screenY - height) / 2;
properties=properties + ", left=" + leftvar;
properties=properties + ", top=" + rightvar;
properties=properties+',scrollbars=yes';
popupHandle=window.open(url,"smallwin",properties);
}


function rewin(url,wid,hei) {
height=hei;
width=wid;
var properties="toolbar=0, status=yes,resizable=yes, location=0, height=" + height;
properties=properties + ", width=" + width;
var leftprop, topprop, screenX, screenY, cursorX, cursorY, padAmt;
screenY=document.body.offsetHeight;
screenX=window.screen.availWidth;
leftvar=(screenX - width) / 2;
rightvar=(screenY - height) / 2;
properties=properties + ", left=" + leftvar;
properties=properties + ", top=" + rightvar;
properties=properties+',scrollbars=yes';
popupHandle=window.open(url,"smallwin",properties);
}

function wordCounter(this_field, countfield, maxlimit) {
var fullStr = this_field.value + " ";
var boslukREGEXP = /[\r\n]+/gi;
var cleanedStr = fullStr.replace(boslukREGEXP, " ");
var boslukREGEXP = /[ ]+/gi;
var char_count = cleanedStr.length;
var cleanedStr = cleanedStr.replace(boslukREGEXP, " ");
var splitString = cleanedStr.split(" ");
var word_count = splitString.length -1;
if (fullStr.length <2) {
word_count=0;
}
if (maxlimit >1000 || maxlimit == 160 ){
//160 sms icin
countfield.value=maxlimit - char_count+1;
} else{
countfield.value=maxlimit - word_count;
}
}

function uppercase(obje,str) {
if (document.getElementById("autoupper"))
{
if (!document.getElementById("autoupper").checked) return false;
}
switch (str) {
case "tur":
harf=obje.value.substr(0,1)
if (harf == "i") harf="Ý"
obje.value=harf.toUpperCase()+obje.value.substr(1,obje.value.length)
break;
case "eng":
harf=obje.value.substr(0,1).toUpperCase()
if (harf == "Ý") harf="I"
obje.value=harf+obje.value.substr(1,obje.value.length)
break;
}
}


function allUpper(obje,str) {
if (document.getElementById("autoupper"))
{
if (!document.getElementById("autoupper").checked) return false;
}
obje.value=obje.value.replace(/ {2,}/gi," ")
newstr=obje.value.split(" ")
donusSTR=""
newSTR=""
lowSTR=""
for (var k=0;k<newstr.length;k++) {
lowSTR=""
harf=newstr[k].substr(0,1);
switch (str) {
case "tur":
if (harf == "i") harf="Ý"
harf=harf.toUpperCase()
lowSTR=newstr[k].substr(1,newstr[k].length)
lowSTR=lowSTR.split("I").join("ý")
lowSTR=lowSTR.toLowerCase()

break;
case "eng":
harf=harf.toUpperCase()
if (harf == "Ý") harf="I"
lowSTR=newstr[k].substr(1,newstr[k].length).toLowerCase()
break;
}
donusSTR=donusSTR+" "+harf+lowSTR
}
bulundu=false
for (var k=0;k<donusSTR.length;k++) {
if (donusSTR.substr(k,1)!=" ") {break}
}
if (donusSTR.substr(donusSTR.length-1,1)==" ") donusSTR=donusSTR.substr(0,donusSTR.length-1); 
obje.value=donusSTR.substr(k,donusSTR.length)
}

function copyit(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
therange=tempval.createTextRange()
therange.execCommand("Copy")
}
function pasteit(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
therange=tempval.createTextRange()
therange.execCommand("Paste")
}


function finish()
{
 self.close();
}
function closereload()
{
window.opener.document.myform.submit();
//window.opener.location.reload()
self.close();
}
function closeandload()
{
window.opener.location.reload()
self.close();
}
function clearPreloadPage() { //DOM
if (document.getElementById){
document.getElementById('prepage').style.visibility='hidden';

}else{
if (document.layers){ //NS4
document.prepage.visibility='hidden';
}
else { //IE4
document.all.prepage.style.visibility='hidden';

}
}
}
function show(object) {
var axx=0
  if (document.all[object].style.display=='none') 
  {
    document.all[object].style.display = '';
	 axx=1
  }
   if (document.all[object].style.display=='' && axx==0) 
  {
    document.all[object].style.display= 'none';
  }
}

function hide(object) {
	
  if (document.getElementById) {
    document.getElementById(object).style.visibility = 'hidden';
  }
  else if (document.layers && document.layers[object]) {
    document.layers[object].visibility = 'hidden';
  }
  else if (document.all) {
    document.all[object].style.visibility = 'hidden';
  }
}
