//
// Text-resize javascript, let your users resize your text 
//
// by John Mueller, http://johnmu.com/
// Reuse and modification allowed provided above attribution remains intact.
// no link necessary :-)
//
// v1.0 - 2007-July-22 
//


var ts_sizeSmall=80;  // adjust this for the SMALL size in percent
var ts_sizeLarge=130; //    "                LARGE
var ts_styleElement="#wrapper"; // the ID of the content DIV that you want to resize

function ts_setCookie (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 ts_getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1) return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1) cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function showReadabilityMenu (myTitle) {
	document.write('' + myTitle + '&nbsp;<span style="font-size:'+ts_sizeSmall+'%">');
	if (ts_fontsize!=ts_sizeSmall) 
    	document.write('<a href="#" onclick="changeFontSize('+ts_sizeSmall+');return false;" title="Display smaller text">A</a>');
    else document.write('A');
	document.write('</span>&nbsp;<span>');
	if (ts_fontsize!=100) 
    	document.write('<a href="#" onclick="changeFontSize(100);return false;" title="Display normal text size">A</a>');
    else document.write('A');
	document.write('</span>&nbsp;<span  style="font-size:'+ts_sizeLarge+'%">');
	if (ts_fontsize!=ts_sizeLarge) 
    	document.write('<a href="#" onclick="changeFontSize('+ts_sizeLarge+');return false;" title="Display larger text size">A</a>');
    else document.write('A');
	document.write('');
}

function changeFontSize (fontsize) {
    var untilDate = new Date();
    untilDate.setTime( untilDate.getTime() + 365 * 24 * 60 * 60 * 1000); // valid for 1 year
    ts_setCookie('ts_fontsize', fontsize, untilDate, '/');
    self.location.href = self.location.href;
}

var ts_fontsize = ts_getCookie('ts_fontsize');
if (!ts_fontsize) var ts_fontsize = 100;

document.write('<style type="text/css">' + ts_styleElement + '{font-size:'+ts_fontsize+'%;}<\/style>');

// done!
// eat pizza
function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = jQuery(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}
jQuery.noConflict();
jQuery(document).ready(function() {
	equalHeight(jQuery("div.equalHeight"));
});

//Mail Page
function mailpage()
{
mail_str = "mailto:?subject=" + document.title;
mail_str += "&body=Hi, I thought you'd like this: " + document.title;
mail_str += ". You can view it at, " + location.href;
location.href = mail_str;
}
//end

function loadFonts(){
sIFR.replace(Klavika, {
      selector: '.tabs-content h3',
      css: [
      '.sIFR-root { font-size:20px; color:#877dbb; margin-left:0; margin-right:0; margin-top:0; margin-bottom:0; padding:0; float: left; display: block; }',
      'em { font-style:italic; }',
      'strong { font-weight:bold; color:#333333; }'
      ],
	  fitExactly: true,
      wmode: 'transparent',
	  tuneHeight: -5
});
}



function submitregform(){
	
	var cstName = jQuery("#cstName").val();
	var cstDOB = jQuery("#cstDOB").val();
	var cstTel = jQuery("#cstTel").val();
	var cstEmail = jQuery("#cstEmail").val();
	var cstComment = jQuery("#cstComment").val();
	
	var encodedName = encodeURIComponent(cstName); 
	var encodedDOB = encodeURIComponent(cstDOB);
	var encodedTel = encodeURIComponent(cstTel);
	var encodedEmail = encodeURIComponent(cstEmail); 
	var encodedComment = encodeURIComponent(cstComment); 
	
	var dataString = 'cstName='+ encodedName + '&cstDOB='+ encodedDOB + '&cstEmail='+ encodedEmail + '&cstTel='+ encodedTel + '&cstComment='+ encodedComment + '';

	
	jQuery.ajax({
		type:"POST",
		url: "../includes/incAjaxContactForm.asp",
		dataType: "application/x-www-form-urlencoded",
		data: dataString,
		async: false,
		success: function(){
			jQuery("#waiting").fadeIn(400);
			
			window.setTimeout(function() {
			 jQuery("#regForm").hide();
			jQuery("#thanks").fadeIn(400);
			
			}, 2000);
			
			
	}
	
	})
}

function PageQuery(q) {
if(q.length > 1) this.q = q.substring(1, q.length);
else this.q = null;
this.keyValuePairs = new Array();
if(q) {
for(var i=0; i < this.q.split("&").length; i++) {
this.keyValuePairs[i] = this.q.split("&")[i];
}
}
this.getKeyValuePairs = function() { return this.keyValuePairs; }
this.getValue = function(s) {
for(var j=0; j < this.keyValuePairs.length; j++) {
if(this.keyValuePairs[j].split("=")[0] == s)
return this.keyValuePairs[j].split("=")[1];
}
return false;
}
this.getParameters = function() {
var a = new Array(this.getLength());
for(var j=0; j < this.keyValuePairs.length; j++) {
a[j] = this.keyValuePairs[j].split("=")[0];
}
return a;
}
this.getLength = function() { return this.keyValuePairs.length; }
}
function queryString(key){
var page = new PageQuery(window.location.search);
return unescape(page.getValue(key));
}
function displayItem(key){
if(queryString(key)=='false')
{
document.write("you didn't enter a ?name=value querystring item.");
}else{
document.write(queryString(key));
}
if (queryString("hl")=="zh-CN" || queryString("hl")=="ja" || queryString("hl")=="ru" || queryString("hl")=="ar"){
    sIFR.domains = ['www.henley-cov.ac.uk', 'www.henley-cov.ac.uk'];
} else {
if (queryString("langpair")=="en|zh-CN" || queryString("langpair")=="en|ja" || queryString("langpair")=="en|ru" || queryString("langpair")=="en|ar"){
    sIFR.domains = ['www.henley-cov.ac.uk', 'www.henley-cov.ac.uk'];
}
}
}
