var LIMIT=200;var CTRL="source";var DELTA=0;var m_clipboard=null;var alertBOX="<div id=warning>Attention!</div><div align='right' class='textareaON' style='width:297px;height:26px;'><img src='../gt-img/close.gif' style='cursor:pointer;padding:3px;' onClick='GEBI(\"divalert\").style.display=\"none\";' alt='Close'></div>";okBTN="<div align='center'><br><br><div align='center'><input type='button' class='ok' onClick='GEBI(\"divalert\").style.display=\"none\";' title='OK' value='OK'></div><br></div>";var dmn="http://"+location.host+"/";
function actONOFF(ob){if(ob.id=='source'){ob.className='textareaON';GEBI('target').className='textareaOFF';GEBI('toolbar').style.marginTop='0px';CTRL="source";}else{ob.className='textareaON';GEBI('source').className='textareaOFF';if(navigator.appName=="Microsoft Internet Explorer"){ GEBI('toolbar').style.marginTop=(273-DELTA)+'px'; }else GEBI('toolbar').style.marginTop='263px';CTRL="target";}
LTR_RTL();}
var webmasterBOX="<div id=warning>For&nbsp;Webmasters</div><div align='right' class=webmasterON><img src='http://get-translation.com/gt-img/close.gif' style='cursor:pointer;padding:3px;' onClick='GEBI(\"webmaster\").style.display=\"none\";' alt='Close'></div>";
function GEBI(ob){return(document.getElementById(ob));}
function doEx(cmd){var textCtrl=GEBI(CTRL);if(browser.ie&&!browser.mac&&!browser.opera){textCtrl.createTextRange().execCommand(cmd);}else{switch(cmd){case"Copy":copyPasteMsg();m_clipboard=textCtrl.value;break;case"Paste":copyPasteMsg();textCtrl.focus();if(m_clipboard)textCtrl.value=m_clipboard;break;case"Delete":textCtrl.focus();textCtrl.value="";break;case"Cut":textCtrl.focus();m_clipboard=textCtrl.value;textCtrl.value="";break;}}
LIM();}
function copyPasteMsg(){var ob=GEBI('divalert');if(navigator.userAgent.indexOf("MSIE")==-1){ob.style.display="block";ob.innerHTML=alertBOX+"<div class='text'><br>Your browser does not allow access to your computer's clipboard. Instead, please use Ctrl-C for Copy, Ctrl-X for Cut and Ctrl-V for Paste, or use Edit menu above the browser toolbar.<br>"+okBTN;}}
function Font(){var source=GEBI('source');var target=GEBI('target');var back=GEBI('back');if(source.style.fontSize=='20px'||source.style.fontSize==''){source.style.fontSize='26px';target.style.fontSize='26px';back.style.fontSize='26px';}else{source.style.fontSize='20px';target.style.fontSize='20px';back.style.fontSize='20px';}}
function Browser(){var userAgent=navigator.userAgent.toLowerCase();this.major=parseInt(navigator.appVersion);this.version=parseFloat(navigator.appVersion);if(userAgent.indexOf("safari")>=0){this.sfr=true;}
else if(userAgent.indexOf("opera")>=0){this.opera=true;}
else if(userAgent.indexOf("msie")>=0){this.ie=true;}
else if(userAgent.indexOf("mozilla")>=0){this.ns=true;this.ns4=(this.version>=4&&this.version<5);}
this.win=(userAgent.indexOf("win")>=0);this.mac=(userAgent.indexOf("mac")>=0);this.unix=(userAgent.indexOf("x11")>=0);this.lineSep=(this.mac?'\r':'\n');this.ie6SP2=(userAgent.indexOf("sv1")!=-1)}
var browser=new Browser();
function INIT(l1,l2,l,dl){if(navigator.userAgent.indexOf("MSIE")==-1){w_="468px";h_="117px";y_="6px";y2_="3px";}
else{w_="466px";h_="116px";y_="2px";y2_="1px";DELTA=dl;}
if(navigator.userAgent.indexOf("Chrome")>-1){w_="464px";h_="114px";}
GEBI('source').style.width=w_;GEBI('source').style.height=h_;GEBI('source').focus();GEBI('target').style.width=w_;GEBI('target').style.height=h_;GEBI('back').style.width=w_;GEBI('back').style.height=h_;GEBI('autoback').style.marginTop=y_;GEBI('autodetect').style.marginTop=y2_;if(GEBI('autoback').checked==true)GEBI('l7').style.display='block';else GEBI('l7').style.display='none';CookieFilter(l1,l2,l);LTR_RTL();
//StartBans();
}
function getCookie(name)
{var cookies=document.cookie.split(";");for(i=0;i<cookies.length;i++){if(cookies[i].indexOf(name+"=")!=-1){return cookies[i].substr(cookies[i].indexOf(name+"=")+name.length+1,cookies[i].length);}}
return"";}
function setCookie(name,value)
{var dt=new Date((new Date()).getTime()+24000*3600000);setCookieEx(name,value,dt)
return;}
function setCookieEx(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+
((expires)?"; expires="+expires.toGMTString():"")+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"")+
((secure)?"; secure":"");document.cookie=curCookie;}
function doReverse(){var temp1;temp2=GEBI('to').value;GEBI('to').value=GEBI('from').value;GEBI('from').value=temp2;setTITLE();}
function LTR_RTL(){if(GEBI('from').value=="ar"||GEBI('from').value=="iw"||GEBI('from').value=="fa"||GEBI('from').value=="yi")
GEBI('source').dir="rtl";else GEBI('source').dir="ltr";if(GEBI('to').value=="ar"||GEBI('to').value=="iw"||GEBI('to').value=="fa"||GEBI('to').value=="yi")
GEBI('target').dir="rtl";else GEBI('target').dir="ltr";if(GEBI('autoback').checked==true)GEBI('back').dir=GEBI('source').dir;}
function ONOFFback(ob){var st="none";if(ob.checked==true)st="block";GEBI('l7').style.display=st;}
function accent(ctrl,pos,chr){var ctrl1,ctrl2
GEBI('source').focus();if(pos==ctrl.length){ctrl=ctrl+chr;}else{ctrl1=ctrl.substr(0,pos);ctrl2=ctrl.substr(pos,ctrl.length);ctrl=ctrl1+chr+ctrl2;}
LIM();return ctrl;}
function AC(obj){if(navigator.appName=="Microsoft Internet Explorer"){GEBI('source').focus();document.selection.createRange().text=GEBI(obj).options[GEBI(obj).selectedIndex].value;}else{GEBI('source').value=accent(GEBI('source').value,GEBI('source').selectionStart,GEBI(obj).options[GEBI(obj).selectedIndex].value);}
GEBI(obj).options[0].selected=true;LIM();}
function LIM(){if(GEBI('source').value.length>LIMIT){ob=GEBI('divalert');ob.style.display="block";ob.innerHTML=alertBOX+"<div class='text'><br>The translation limit is reached. The text will be trimmed.<br>"+okBTN;;GEBI('source').value=GEBI('source').value.substr(0,LIMIT);GEBI('limsize').style.color='red'
GEBI('limsize').style.fontWeight='bold'}
GEBI('limsize').innerHTML=LIMIT-GEBI('source').value.length;}
function CookieFilter(l1,l2,l){if(l==""){if(getCookie("from")==""&&getCookie("to")==""){GEBI('from').value=l1;setCookie("from",l1);GEBI('to').value=l2;setCookie("to",l2);}else{GEBI('from').value=getCookie("from");GEBI('to').value=getCookie("to");}}else{GEBI('from').value=l1;setCookieEx("from",GEBI('from').value);GEBI('to').value=l2;setCookieEx("to",GEBI('to').value);}}
function setTITLE(){var from_=GEBI('from').options[GEBI('from').selectedIndex].text;var to_=GEBI('to').options[GEBI('to').selectedIndex].text;if(GEBI("ttl"))GEBI("ttl").innerHTML=from_+" to "+to_+" Translation";LTR_RTL();}
function GoogleDetect(){if(GEBI('from').value==GEBI('to').value){SameLangsAlert();return false;}
if(GEBI('source').value=="")NoTextAlert();else{var frame2=GEBI('gdetect');if(frame2)frame2.parentNode.removeChild(frame2);if(!GEBI("gdetect")){var die=document.createElement("iframe");die.src=dmn+"gt-includes/autodetect.php";die.name="gdetect";die.id="gdetect";die.width="0px";die.height="0px";die.frameBorder="0";GEBI('gd_container').appendChild(die);}}}
function ONOFFauto(){setCookieEx("autodetect",GEBI('autodetect'),checked);}
function translate(targetctrl){var src=GEBI('source').value;src=alltrim(src);if(src.length>LIMIT){LIM();return false;}
if(GEBI('source').value=="")NoTextAlert();else{if(targetctrl==""||targetctrl=="undefined")targetctrl='target';var div=document.createElement('div');div.innerHTML='<iframe height="0" width="0" frameborder="0" style="visibility:hidden"></iframe>';document.body.appendChild(div);if(targetctrl!="back"){GEBI('target').value="";GEBI('back').value="";GEBI('ind1').style.display='block';GEBI('ind1').innerHTML='<img src="'+dmn+'gt-img/indicator.gif" width=43 height=11>';}
if(GEBI('autoback').checked==true){GEBI('ind2').style.display='block';GEBI('ind2').innerHTML='<img src="'+dmn+'gt-img/indicator.gif" width=43 height=11>';}
var iframe=div.firstChild;var iframeDocument=iframe.contentDocument||iframe.contentWindow.document;iframeDocument.open();iframeDocument.close();var form=iframeDocument.createElement('form');iframeDocument.body.appendChild(form);form.setAttribute('action',dmn+'gt-includes/google.php');form.setAttribute('method','POST');var field1=iframeDocument.createElement('input');field1.setAttribute('type','hidden');field1.setAttribute('name','src');if(targetctrl=="target")field1.setAttribute('value',GEBI('source').value);else field1.setAttribute('value',GEBI('target').value);var field2=iframeDocument.createElement('input');field2.setAttribute('type','hidden');field2.setAttribute('name','dir');if(targetctrl=="target")field2.setAttribute('value',GEBI('from').value+"/"+GEBI('to').value);else field2.setAttribute('value',GEBI('to').value+"/"+GEBI('from').value);var field3=iframeDocument.createElement('input');field3.setAttribute('type','hidden');field3.setAttribute('name','ctrl');field3.setAttribute('value',targetctrl);form.appendChild(field1);form.appendChild(field2);form.appendChild(field3);form.submit();}
window.onload=function(){GEBI('button').onclick=function(){submit({'x':'Some Value','y':'Another Value','z':new Date().getTime()});}}
return true;}
function SameLangsAlert(){var ob=GEBI('divalert');ob.style.display="block";ob.innerHTML=alertBOX+"<div class='text'><br>Original and target languages must be different"+okBTN;}
function NoTextAlert(){var ob=GEBI('divalert');ob.style.display="block";ob.innerHTML=alertBOX+"<div class='text'><br>Please enter text for translation"+okBTN;}
function alltrim(str){return str.replace(/^\s+|\s+$/g,'');}
function check(){if(document.f.q.value==""){alert('Please type a query!');return false;}
else document.f.submit();}
function b468_60(){var frame2=GEBI('468x60');if(frame2)frame2.parentNode.removeChild(frame2);if(!GEBI("468x60")){var die=document.createElement("iframe");die.src="http://get-translation.com/gt-includes/468x60.php";die.name="468x60";die.id="468x60";die.width="468px";die.height="60px";die.scrolling="no";die.frameBorder="0";GEBI('b468_60').appendChild(die);}}
function b300_250(){var frame4=GEBI('300x250');if(frame4)frame4.parentNode.removeChild(frame4);if(!GEBI("300x250")){var die=document.createElement("iframe");die.src="http://get-translation.com/gt-includes/300x250.php";die.name="300x250";die.id="300x250";die.width="300px";die.height="250px";die.scrolling="no";die.position="absolute";die.frameBorder="0";GEBI('b300_250').appendChild(die);}}
function StartBans(){setTimeout('b468_60();b300_250();',300);}  
function ClipBoard(ob) 
{
 ob.focus();
 ob.select();

 if(checkBrowser() == true){
	Copied = ob.createTextRange();
	Copied.execCommand("Copy");
 } else	alert("To copy the HTML code to your clipboard - press 'Ctrl' + 'C'");
}

function checkBrowser()
{
var agt=navigator.userAgent.toLowerCase();
var isMac=(agt.indexOf("mac")!=-1);
  if (document.all) {
    var sVer=navigator.appVersion;
    var i=sVer.indexOf('MSIE');
    if (i >0)  return true;
    else       return false;
  }
}
function webmaster(skin){
  var frame2 = GEBI('forwebmaster');
  if(frame2)	frame2.parentNode.removeChild(frame2);
    GEBI('webmaster').innerHTML="";
    if(!GEBI("forwebmaster")){
    var die = document.createElement("iframe");
    die.src = dmn+"webmaster.php?skin="+skin;
    die.name = "forwebmaster";
    die.id="forwebmaster";
    die.width="700px";
    die.height="630px";
    die.frameBorder="0";    
    die.scrolling="no";    
    GEBI('webmaster').appendChild(die);
    GEBI('webmaster').innerHTML=webmasterBOX+GEBI('webmaster').innerHTML;
    GEBI('webmaster').style.display="block";
   }
}

