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_translator_application="Lingo24 only accepts applications from translators via its online recruitment form. Applications sent through this contact form are ignored. Please click 'Ok' to apply now (please note it may take 20 minutes) or 'Cancel' to return to the Lingo24 contact page.";
	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;
}

//contact us form, help link

function display_contactushelp() {
	ddrivetip('You can send us documents for translation from your computer by clicking on the grey \'browse\' button, and selecting the document you wish to upload from your Hard Drive. Don\'t worry: we won\'t start translating until you\'ve agreed to our price offer.',500);
}


function social_bkmark(bsite) {
        var u = encodeURIComponent(window.location.href);
        var t = encodeURIComponent(document.title);
        switch (bsite) {
            case "stumbleupon" : document.write("<a href='http://www.stumbleupon.com/submit?url="+u+"&title="+t+"' title='Post this story to StumbleUpon'>StumbleUpon</a>");break;
            case "reddit": document.write("<a href='http://reddit.com/submit?url="+u+"&title="+t+"' title='Post this story to reddit'>reddit</a>");break;
            case "diggit": document.write("<a href='http://digg.com/submit?url="+u+"&title="+t+"' title='Post this story to Digg'>Digg</a>");break;
            case "sphinn": document.write("<a href='http://sphinn.com/submit?url="+u+"&title="+t+"' title='Post this story to Sphinn'>Sphinn</a>");break;
            case "furl": document.write("<a href='http://www.furl.net/storeIt.jsp?u="+u+"&t="+t+"' title='Post this story to Furl'>Furl</a>");break;
            case "magnolia": document.write("<a href='http://ma.gnolia.com/bookmarklet/add?url="+u+"&title="+t+"' title='Post this story to Magnolia'>Magnolia</a>");break;
            case "google": document.write("<a href='http://www.google.com/bookmarks/mark?op=edit&bkmk="+u+"&title="+t+"' title='Save to Google Bookmarks'>Google Bookmarks</a>");break;
            default:;
        }
    }

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.com/php/t.php?r='+ref+'&l='+landing+'&d=1';
  if (cookie_data == null) {
    var transaction = YAHOO.util.Connect.asyncRequest('GET', sUrl, cookie_callback, null); 
  }
}