var contentholder


var ElementMaxHeight = function() {
  this.initialize.apply(this, arguments);
}

ElementMaxHeight.prototype = {
  initialize: function(className) {
    this.elements = document.getElementsByClassName(className || 'maxheight');    
    this.textElement = document.createElement('span');
    this.textElement.appendChild(document.createTextNode('A'));
    this.textElement.style.display = 'block';
    this.textElement.style.position = 'absolute';
    this.textElement.style.fontSize = '1em';
    this.textElement.style.top = '-1000px';
    this.textElement.style.left = '-1000px';
    document.body.appendChild(this.textElement);
    this.textElementHeight = document.getDimensions(this.textElement).height;
    var __object = this;
    var __checkFontSize = this.checkFontSize;
    this.checkFontSizeInterval = window.setInterval(function() {return __checkFontSize.apply(__object)}, 500);

    this.expand();

    // Refresh elements height onResize event
    var __expand = this.expand;
    if (window.addEventListener) {
      //window.addEventListener('resize', function(event) {return __expand.apply(__object, [( event || window.event)])}, false);
    } else if (window.attachEvent) {
      //window.attachEvent('onresize', function(event) {return __expand.apply(__object, [( event || window.event)])});
    }
  },

  expand: function() {
    this.reset();
  	for (var i = 0; i < this.elements.length; i++) {  	
      this.elements[i].style.height = document.getDimensions(this.elements[i].parentNode).height + 'px';
  	}
  },

  reset: function() {
    for (var i = 0; i < this.elements.length; i++) {    
      this.elements[i].style.height = 'auto';
    }
  },

  checkFontSize: function() {
  	var height = document.getDimensions(this.textElement).height;
  	if(this.textElementHeight != height) {
  		this.textElementHeight = height;
  		this.expand();
  	}
  }  
}


if (!!document.evaluate) {
  document._getElementsByXPath = function(expression, parentElement) {
    var results = [];
    var query = document.evaluate(expression, parentElement || document,
      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    for (var i = 0, length = query.snapshotLength; i < length; i++)
      results.push(query.snapshotItem(i));
    return results;
  }
}

document.getElementsByClassName = function(className, parentElement) {
  if (!!document.evaluate) {
    var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
    return document._getElementsByXPath(q, parentElement);
  } else {
    var children = (parentElement || document.body).getElementsByTagName('*');
    var elements = [], child;
    for (var i = 0, length = children.length; i < length; i++) {
      child = children[i];
      if (child.className.length != 0 &&
          (child.className == className ||
           child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))) {      
        elements.push(child);
      }
    }
    return elements;
  }
}

document.getDimensions = function (element) {
  var display = element.style.display;
  if (display != 'none' && display != null) { // Safari bug
    return {width: element.offsetWidth, height: element.offsetHeight};
  }

  return {width: originalWidth, height: originalHeight};
}

function MM_swapImgRestore() 
{ //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() 
{ //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("##")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
      
function MM_swapImage() 
{ //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function LoadPage1()
{

InsertPage("page1.html", "contentholder");

}

function LoadPage2()
{
	
InsertPage("page2.html", "contentholder");
	
}

function SetPage2()
{
	
	if(window.FlashObject) window.document["FlashObject"].SetVariable("myObject.tab", "2");
	if(document.FlashObject) document.FlashObject.SetVariable("myObject.tab", "2");
	InsertPage("page2.html", "contentholder");

}

function SetPage3()
{
	
	if(window.FlashObject) window.document["FlashObject"].SetVariable("myObject.tab", "3");
	if(document.FlashObject) document.FlashObject.SetVariable("myObject.tab", "3");
	 InsertPage("page3.html", "contentholder");

}



function LoadPage3()
{

    InsertPage("page3.html", "contentholder");
	
}

function getMovie(movieName) 
{
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName];
    } else {
        return document[movieName];
    }
}

function LoadPage4()
{
	
InsertPage("page4.html", "contentholder");
	
}

function LoadPage5()
{
	
InsertPage("page5.html", "contentholder");
	
}

function LoadReferalPage()
{
	
InsertPage("referal.aspx", "contentholder");
	
}


function clearform()
{

InsertPage("referal.aspx", "contentholder");
	
}



function Loadserviceadvice()
{

InsertPage("serviceAdvice.aspx", "contentholder");
	
}

function Loadservicecashflow()
{

InsertPage("serviceCashFlow.aspx", "contentholder");

}


function Loadservicecashflow()
{

InsertPage("serviceCashFlow.aspx", "contentholder");

}

function Loadserviceappeals()
{

InsertPage("serviceappeals.aspx", "contentholder");

}


function Loadservicemanagementaccounts()
{

InsertPage("servicemanagementaccounts.aspx", "contentholder");

}

function Loadserviceaccounts()
{

InsertPage("serviceaccounts.aspx", "contentholder");
domax;
}

function Loadserviceforensicaccountancy()
{

InsertPage("serviceforensicaccountancy.aspx", "contentholder");

}

function Loadservicevatreturns()
{

InsertPage("servicevatreturns.aspx", "contentholder");

}


function Loadservicevatreturns()
{

InsertPage("servicevatreturns.aspx", "contentholder");

}

function Loadservicetaxreturns()
{

InsertPage("servicetaxreturns.aspx", "contentholder");

}

function Loadserviceinstalmentfacilities()
{

InsertPage("serviceinstalmentfacilities.aspx", "contentholder");

}

function Loadserviceirvatenquiries()
{

InsertPage("serviceirvatenquiries.aspx", "contentholder");

}

function Loadservicefreepostmailing()
{

InsertPage("servicefreepostmailing.aspx", "contentholder");

}

function Loadserviceirvatinspections()
{

InsertPage("serviceirvatinspections.aspx", "contentholder");

}

function Loadservicepayepayroll()
{

InsertPage("servicepayepayroll.aspx", "contentholder");

}

function Loadtaxincome()
{

InsertPage("taxincome.aspx", "contentholder");

}


function Loadtaxcorp()
{

InsertPage("taxcorporate.aspx", "contentholder");

}

function Loadtaxvat()
{

InsertPage("taxvat.aspx", "contentholder");

}

function Loadtaxcar()
{

InsertPage("taxcar.aspx", "contentholder");

}


function Loadtaxni()
{

InsertPage("taxni.aspx", "contentholder");

}

function Loadterms()
{

InsertPage("terms.aspx", "contentholder");

}


var contentholder
var xmlHttp

function InsertPage(strPage, strDIV)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
 
 contentholder=strDIV;
  
var url=strPage;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}


function contact()
{

var dv = create_request_string(contactform)

dv = "replycontact.aspx?" + dv


var url=dv


InsertPage(url, "contactholder");

}

function referal()
{



var rs = create_request_string(referform)

rs = "replyreferal.aspx?" + rs



var url=rs



InsertPage(url, "contactholder");



}

function stateChanged(strDIV) 
{ 

if (xmlHttp.readyState==4)
{ 

var dv = document.getElementById(contentholder)

dv.innerHTML=xmlHttp.responseText;

DoMax();

}
}




function DoMax() 
{ 
new ElementMaxHeight();
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}


function create_request_string(theForm) 
{ 
var reqStr = ""; 

for(i=0; i < theForm.elements.length; i++) 
{ 
isFormObject = false; 

switch (theForm.elements[i].tagName) 
{ 
case "INPUT": 

switch (theForm.elements[i].type) 
{ 
case "text": 
case "hidden": 
reqStr += theForm.elements[i].name + "=" + encodeURIComponent(theForm.elements[i].value); 
isFormObject = true; 
break; 

case "checkbox": 
if (theForm.elements[i].checked) 
{ 
reqStr += theForm.elements[i].name + "=" + theForm.elements[i].value; 
}else{ 
reqStr += theForm.elements[i].name + "="; 
} 
isFormObject = true; 
break; 

case "radio": 
if (theForm.elements[i].checked) 
{ 
reqStr += theForm.elements[i].name + "=" + theForm.elements[i].value; 
isFormObject = true; 
} 
} 
break; 

case "TEXTAREA": 

reqStr += theForm.elements[i].name + "=" + encodeURIComponent(theForm.elements[i].value); 
isFormObject = true; 
break; 

case "SELECT": 
var sel = theForm.elements[i]; 
reqStr += sel.name + "=" + sel.options[sel.selectedIndex].value; 
isFormObject = true; 
break; 
} 

if ((isFormObject) && ((i+1)!= theForm.elements.length)) 
{ 
reqStr += "&"; 
} 

} 

return reqStr; 
} 

function getFlashMovieObject(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName];
    }
    else {
      if(document[movieName].length != undefined){
          return document[movieName][1];
      }
        return document[movieName];
    }
}