// JavaScript Document

var titles = {'about_eip/approach/home': 'Approach | More | About EIP | Patent and Trade Mark Attorneys','about_eip/approach': 'Approach | About EIP | Patent and Trade Mark Attorneys','about_eip/contact/bath': 'Bath | Contact | About EIP | Patent and Trade Mark Attorneys','about_eip/contact/cardiff': 'Cardiff | Contact | About EIP | Patent and Trade Mark Attorneys','about_eip/contact': 'Contact | About EIP | Patent and Trade Mark Attorneys','about_eip/contact/london': 'London | Contact | About EIP | Patent and Trade Mark Attorneys','about_eip/expertise/home': 'Expertise | More | About EIP | Patent and Trade Mark Attorneys','about_eip/expertise': 'Expertise | About EIP | Patent and Trade Mark Attorneys','about_eip/expertise/uk': 'Uk | Expertise | About EIP | Patent and Trade Mark Attorneys','about_eip/expertise/uk_business': 'Uk Business | Expertise | About EIP | Patent and Trade Mark Attorneys','about_eip/expertise/uk_software': 'Uk Software | Expertise | About EIP | Patent and Trade Mark Attorneys','about_eip/expertise/world': 'World | Expertise | About EIP | Patent and Trade Mark Attorneys','about_eip/people/alan_st_george': 'Alan St George | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/alice_mastrovito': 'Alice Mastrovito | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/chris_price': 'Chris Price | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/derk_visser': 'Derk Visser | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/elaine_de_beer': 'Elaine De Beer | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/elizabeth_guy': 'Elizabeth Guy | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/heather_mcCann': 'Heather McCann | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/home': 'People | More | About EIP | Patent and Trade Mark Attorneys','about_eip/people': 'People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/jerome_spaargaren': 'Jerome Spaargaren | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/jonathan_clarke': 'Jonathan Clarke | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/matt_lawman': 'Matt Lawman | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/matthew_blaseby': 'Matthew Blaseby | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/neil_forsyth': 'Neil Forsyth | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/paula_flutter': 'Paula Flutter | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/richard_pratt': 'Richard Pratt | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/robert_squibbs': 'Robert Squibbs | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/robin_rickard': 'Robin Rickard | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/sam_town': 'Sam Town | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/stephen_scott': 'Stephen Scott | People | About EIP | Patent and Trade Mark Attorneys','about_eip/people/sunny_bansal': 'Sunny Bansal | People | About EIP | Patent and Trade Mark Attorneys','about_eip/testimonials/home': 'Testimonials | More | About EIP | Patent and Trade Mark Attorneys','about_eip/testimonials': 'Testimonials | About EIP | Patent and Trade Mark Attorneys','careers_at_eip/attorneys_and_associates/home': 'Attorneys and Associates | More | Careers At Eip | Patent and Trade Mark Attorneys','careers_at_eip/attorneys_and_associates': 'Attorneys and Associates | Careers At Eip | Patent and Trade Mark Attorneys','careers_at_eip/new_to_the_ip_profession/home': 'New To The Ip Profession | More | Careers At Eip | Patent and Trade Mark Attorneys','careers_at_eip/new_to_the_ip_profession': 'New To The Ip Profession | Careers At Eip | Patent and Trade Mark Attorneys','careers_at_eip/support_staff': 'Support Staff | Careers At Eip | Patent and Trade Mark Attorneys','chinese/special_chinese/home': '中文 | 公司简介 | More | Patent and Trade Mark Attorneys','chinese/special_chinese': '中文 | 公司简介 | Patent and Trade Mark Attorneys','chinese/special_chinese_contact': '中文 | 联系方式 | Patent and Trade Mark Attorneys','information_for_foreign_attorneys/experience': 'Experience | Information For Foreign Attorneys | EIP | Patent and Trade Mark Attorneys','information_for_foreign_attorneys/international_contact': 'International Contact | Information For Foreign Attorneys | EIP | Patent and Trade Mark Attorneys','information_for_foreign_attorneys/philosophy/home': 'Philosophy | More | Information For Foreign Attorneys | EIP | Patent and Trade Mark Attorneys','information_for_foreign_attorneys/philosophy': 'Philosophy | Information For Foreign Attorneys | EIP | Patent and Trade Mark Attorneys','information_for_foreign_attorneys/services/home': 'Services | More | Information For Foreign Attorneys | EIP | Patent and Trade Mark Attorneys','information_for_foreign_attorneys/services': 'Services | Information For Foreign Attorneys | EIP | Patent and Trade Mark Attorneys','japanese/special_japanese/home': '日本語 | 事務所概要 | More | Patent and Trade Mark Attorneys','japanese/special_japanese': '日本語 | 事務所概要 | Patent and Trade Mark Attorneys','japanese/special_japanese_contact': '日本語 | 連絡先 | Patent and Trade Mark Attorneys','korean/special_korean/home': '한국어 | 회사소개 | More | Patent and Trade Mark Attorneys','korean/special_korean': '한국어 | 회사소개 | Patent and Trade Mark Attorneys','korean/special_korean_contact': '한국어 | 연락처 | Patent and Trade Mark Attorneys'};

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options = $.extend({}, options); // clone object since it's unexpected behavior if the expired property were changed
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // NOTE Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

function showHTML(){
	$.cookie('showHTML', 1, { path: '/' })
	var c = $.cookie('showHTML');
	if(c != 1){
		alert("You must enable Cookies in your browser to view the HTML");
		return false;
	}

	var l = window.location.href.toString();
	var a = l.split('#')[1];
	var b = l.split('/')[2];
	window.location.href = "http://" + b + a;

	return false;
}

function showFlash(args){
	$.cookie('showHTML', 0, { path: '/' });
	var c = $.cookie('showHTML');
//			if(c != 0) alert("You must enable Cookies in your browser to view the HTML");
	var l = window.location.href.toString();
	var b = l.split('/')[2];
	if(args.length > 0){
		window.location.href = "http://" + b + "/" + args; 	
	}else{
		window.location.reload(true);
	}
	return false;			
}

function printHTML(args){

	var l = window.location.href.toString();	
	if(args && args.length > 0){
		var b = l.split('/')[2];
		var url = "http://" + b + "/" + args + "?print=1"; 	
	}else{
		var a = l.split('#')[1];
		var b = l.split('/')[2];
		var url = "http://" + b + (a ? a : '/') + "?print=1";
	}
		
	popUp(url);
}

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,width=600,height=400');");
}

function printPage(){
	window.print();
	window.close();
}

function showTrigger(toggle,args){
	if(!hasFlash()) return;
	if(toggle){
		document.write('<a href="#"  onclick="return showFlash(\''+args+'\');">Show full site</a>');		
	}else{
		document.write('<a href="#" onclick="return showHTML();">Show simple site</a>');
	}
}

function hasFlash(){
	var version = swfobject.getFlashPlayerVersion();
	return (version.major  >= 8);	
}

function getTitle($page){
	if($page.substr(0,1) == "/") $page = $page.substr(1);
	return titles[$page];
}
	
	