
var popupHandle;

function admin(url) {
height=700;
width=900;
var properties="toolbar=0, location=0,resizable=1,status=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;
properties=properties+',scrollbars=yes';
popupHandle=window.open(url,"",properties);
}

function lookus(url) {
height=580;
width=790;
var properties="toolbar=0, location=0, status=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;
properties=properties+',scrollbars=yes';
popupHandle=window.open(url,"",properties);
}
function small(url) {
height=300;
width=220;
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,"",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){
countfield.value=maxlimit - char_count+1;
} else{
countfield.value=maxlimit - word_count;
}
}

function wordCheck4(this_field_name,myLang,countfield, maxlimit,r) {
	
var fullStr="";

if(r==1){
	for (j=1;j<5;j++){//alert(eval('this_field_name + myLang +j'));
		fullStr=fullStr+document.getElementById(this_field_name + myLang +j).value+" ";
	}
} else {
	fullStr=fullStr+document.getElementById(this_field_name + myLang +1).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 ){
	if(r){
		for (j=1;j<5;j++){
			document.getElementById(countfield + myLang +j).value =maxlimit - char_count+1;
		}
	} else {
		document.getElementById(countfield + myLang +1).value =maxlimit - char_count+1;	
	}
} else{
	if(r){
		for (j=1;j<5;j++){
			document.getElementById(countfield + myLang +j).value=maxlimit - word_count;
		}
	} else {
		document.getElementById(countfield + myLang +1).value=maxlimit - word_count;
	}
	//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(/-/gi," ")
obje.value=obje.value.replace(/ {2,}/gi," ")
obje.value=obje.value.replace(/  /gi," ")
obje.value=obje.value.replace(/  /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';

}
}
}

