google_ad_client = "pub-5231732569996138";
google_ad_width = 300;
google_ad_height = 250;
google_ad_format = "300x250_as";
google_ad_channel ="";
google_ad_type = "text";
google_color_border = "00756F";
google_color_bg = "F1EDEE";
google_color_link = "00756F";
google_color_url = "00756F";
google_color_text = "000000";

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function setCookie(name, value, expires, path, domain, secure) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		var expires = expires * 1000 * 60 * 60 * 24;
    	var expires_date = new Date( today.getTime() + (expires) );
    }
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires_date.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function trackLink(link){
	link.href =link.href+'&tid='+getCookie('tid');
	return true;
}

function opentranslatorpopup(uri) {
	transWin=window.open('https://www.secure-translations.com/' + uri,'win','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=500');
	self.name = 'mainWin';
}

function openordersystem(uri) {
	tid = getCookie('tid');
	orderWin=window.open('https://www.secure-translations.com/client/index.php?d=1&'+ uri +'&action=register&tid=' + tid,'orderwin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=500');
	self.name = 'mainWin';
}

function openmyaccount(uri) {
	tid = getCookie('tid');
	orderWin=window.open('https://www.secure-translations.com/client/index.php?d=1&'+ uri +'&action=login&tid=' + tid,'orderwin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=500');
	self.name = 'mainWin';
}

function openlatintranslations() {
	tid = getCookie('tid');
	latinWin=window.open('https://www.secure-translations.com/latin_client/index.php?d=1&tid=' + tid,'orderwin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=500');
	self.name = 'mainWin';
}

function checkTID() {
	if(tidhidden = document.getElementById('tid')) {
		tidhidden.value = getCookie('tid');
	}
}

function subject_changed(obj)
{
	var message_translator_application="Lingo24 welcomes applications from experienced translators. Applicants must: \n - have an internationally recognised translator's qualification (from a body such as the ITI or IOL in the UK, or the American Translators' Association, or their own country's equivalent) \n- have at least five years' professional experience \n- work exclusively into their mother tongue \n- provide at least three professional references \n\nAll applications should be done online, so please do not send any applications by post or through the client message form. \n\nPress OK to launch the New Translator application form.";	
	var message_latin_translations="Lingo24's new streamline \"direct\" service brings Latin translation bang up-to-date. Our user-friendly system offers clients several advantages: \n- it allows direct access to a professional Latin linguist, \n- it speeds up delivery, and \n- it keeps costs down. \n\nPress OK to launch the Latin Translation order system.";

	var selected_value=obj.options[obj.selectedIndex].value;
	
	switch (selected_value)
	{
		case "translatorapplication":
			if (confirm(message_translator_application))
			{
				opentranslatorpopup('recruitment/index.php?divisionid=1');
			}
			//reset the subject to Sales/Enquiry
			obj.selectedIndex=0;			
			break;
			
		case "latin":
			if (confirm(message_latin_translations))
			{
				openlatintranslations();	
			}			
			//reset the subject to Sales/Enquiry
			obj.selectedIndex=0;
			break;
			
	}
}

function form_submit() {
	var mastertext = document.getElementById('masterarea').value;
	var all = document.getElementsByTagName('textarea');
	for(var i=0;i<all.length;i++) {
		all[i].value = mastertext;
	}
	var targetform = document.getElementById('services').value;
	document.getElementById(targetform).submit();
	return false;
}

var cookieSuccess = function(o){ 
  var response = o.responseText;
  setCookie('mr',response,60,'/');

}; 
	 
var cookieFailure = function(o){ 
  //alert(o.responseText);
} 

var cookie_callback = { 
	  success:cookieSuccess, 
	  failure:cookieFailure, 
	  cache:false
};

function do_cookie() {
 
  var cookie_data = getCookie('mr');
  var ref = encodeURIComponent(document.referrer);
  var landing = encodeURIComponent(document.URL);
  var sUrl = 'http://www.lingo24.ch/php/t.php?r='+ref+'&l='+landing+'&d=4';
  if (cookie_data == null) {
    var transaction = YAHOO.util.Connect.asyncRequest('GET', sUrl, cookie_callback, null); 
  }
}