function checkRows(textArea){
if (textArea.scrollHeight < 50) {
textArea.rows = 4;
}
else
{
textArea.rows = 16;
}
return;
}


function toggle( targetId ){
  if (document.getElementById){
  		target = document.getElementById( targetId );
  			if (target.style.display == "none"){
  				target.style.display = "";
  			} else {
  				target.style.display = "none";
  			}
  	}
}

function togglehide( targetId ){
  if (document.getElementById){
  		target = document.getElementById( targetId );
		target.style.display = "none";
  }
}

function toggleshow( targetId ){
  if (document.getElementById){
  		target = document.getElementById( targetId );
		target.style.display = "";
  }
}

function toggledisabled( targetId ){
  if (document.getElementById){
  		target = document.getElementById( targetId );
  			if (target.disabled == true){
  				target.disabled=false;
  			} else {
  				target.disabled=true;
  			}
  	}
}

function toggledisabledtrue( targetId ){
  if (document.getElementById){
  		target = document.getElementById( targetId );
		target.disabled=true;

  }
}

function toggledisabledfalse( targetId ){
  if (document.getElementById){
  		target = document.getElementById( targetId );
		target.disabled=false;

  }
}

function nospam(user,domain) {
	locationstring = "mailto:" + user + "@" + domain;
	window.location = locationstring;
}

function openWin(theURL,winName,features) {
  var nom = Math.round(10000 * Math.random());
  window.status = ' ';
  window.open(theURL,'backinaction'+nom,features);
}


var popWin = null    
var winCount = 0 
var winName = "popWin" 

function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){ 
  var d_winLeft = 20  
  var d_winTop = 20   
  winName = "popWin" + winCount++  
  closePopWin()           
  if (openPopWin.arguments.length >= 4)    
    winFeatures = "," + winFeatures 
  else  
    winFeatures = ""  
  if (openPopWin.arguments.length == 6)   
    winFeatures += getLocation(winWidth, winHeight, winLeft, winTop) 
  else 
    winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop) 
  popWin = window.open(winURL, winName, "width=" + winWidth  
           + ",height=" + winHeight + winFeatures) 
  } 

function closePopWin(){     
  if (navigator.appName != "Microsoft Internet Explorer"  
      || parseInt(navigator.appVersion) >=4)  
    if(popWin != null) if(!popWin.closed) popWin.close()  
  } 

function getLocation(winWidth, winHeight, winLeft, winTop){ 
  return "" 
  } 

function getLocation(winWidth, winHeight, winLeft, winTop){ 
  var winLocation = "" 
  if (winLeft < 0) 
    winLeft = screen.width - winWidth + winLeft 
  if (winTop < 0) 
    winTop = screen.height - winHeight + winTop 
  if (winTop == "cen") 
    winTop = (screen.height - winHeight)/2 - 20 
  if (winLeft == "cen") 
    winLeft = (screen.width - winWidth)/2 
  if (winLeft>0 & winTop>0) 
    winLocation =  ",screenX=" + winLeft + ",left=" + winLeft     
                + ",screenY=" + winTop + ",top=" + winTop 
  else 
    winLocation = "" 
  return winLocation 
} 

function giveNumber(iValue) {
var sValue = Math.round(iValue * 100) + "";
var sPart1 = sValue.substr(0, sValue.length-2);
var sPart2 = sValue.substr(sValue.length-2);
return (sPart1 == "" ? "0" : sPart1) + "." + (sPart2 == "0" ? "00" : sPart2);
}



function updatePrice(addno) {
var separator = '£';
var thisaddform = document.getElementById('buyit_'+addno); 

try { obj = thisaddform.choice1.options[thisaddform.choice1.options.selectedIndex].text;}
catch(e) { obj = null; }
if (obj == null) {
var choice1 = 'hello';
}
else {
var choice1 = thisaddform.choice1.options[thisaddform.choice1.options.selectedIndex].text;
// remove thousands comma seperator from drop down
choice1 = choice1.replace(',','');

}

try { obj = thisaddform.choice2.options[thisaddform.choice2.options.selectedIndex].text;}
catch(e) { obj = null; }
if (obj == null) {
var choice2 = 'hello';
}
else {
var choice2 = thisaddform.choice2.options[thisaddform.choice2.options.selectedIndex].text;
// remove thousands comma seperator from drop down
choice2 = choice2.replace(',','');
}

try { obj = thisaddform.choice3.options[thisaddform.choice3.options.selectedIndex].text;}
catch(e) { obj = null; }
if (obj == null) {
var choice3 = 'hello';
}
else {
var choice3 = thisaddform.choice3.options[thisaddform.choice3.options.selectedIndex].text;
// remove thousands comma seperator from drop down
choice3 = choice3.replace(',','');
}

var stringArray1 = choice1.split(separator);
if (stringArray1[1] == undefined ) { stringArray1[1] = 0 }
var stringArray2 = choice2.split(separator);
if (stringArray2[1] == undefined ) { stringArray2[1] = 0 }
var stringArray3 = choice3.split(separator);
if (stringArray3[1] == undefined ) { stringArray3[1] = 0 }

OrigPrice_1 = thisaddform.unitprice.value;

var CalcPrice = 0;
CalcPrice = (OrigPrice_1 * 1) + (stringArray1[1] *1) + (stringArray2[1] *1) + (stringArray3[1] *1);

try { obj = thisaddform.vat.options[thisaddform.vat.options.selectedIndex].text;}
catch(e) { obj = null; }
if (obj == null) {
var choice3 = 'hello';
}
else {
if (thisaddform.vat.options[thisaddform.vat.options.selectedIndex].text != 'Including VAT') {CalcPrice = CalcPrice / (1+(opsVATrate/100));}
}

document.getElementById('Words_'+addno).innerHTML = giveNumber(eval( CalcPrice ));
}

function funcMovingFlash (product)
{
	var flashwrite = ''
flashwrite = flashwrite + ('<br />\n');
flashwrite = flashwrite + ('<h3>Movement Animation - ' + product + '</h3>\n');
flashwrite = flashwrite + ('<br />\n');
flashwrite = flashwrite + ('<table width="100%" border="0" cellspacing="0" cellpadding="0">\n');
flashwrite = flashwrite + ('<tr>\n');
flashwrite = flashwrite + ('<td align="center" background="../images/site/menu_gradient.jpg" class="greytextnorm" >\n');
//flashwrite = flashwrite + ('<script type="text/javascript" >\n');
//flashwrite = flashwrite + ('<!-- \n');

	var MM_contentVersion = 6;
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
	    }
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
//	flashwrite = flashwrite + ('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	//flashwrite = flashwrite + ('on error resume next \n');
	//flashwrite = flashwrite + ('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	//flashwrite = flashwrite + ('</SCR' + 'IPT\> \n');
}
if ( true ) {
		flashwrite = flashwrite + ('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" \n');
	flashwrite = flashwrite + ('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" \n');
	flashwrite = flashwrite + (' ID="panorama_amersham" WIDTH="340" HEIGHT="272" ALIGN=""> \n');
	flashwrite = flashwrite + (' <PARAM NAME=movie VALUE="../images/flash/'+ product +'.swf"> \n');
	flashwrite = flashwrite + (' <PARAM NAME=quality VALUE=high> \n');
	flashwrite = flashwrite + (' <PARAM NAME=bgcolor VALUE=#FFFFFF> \n'); 
	//flashwrite = flashwrite + (' <EMBED src="../images/flash/'+ product +'.swf" quality=high bgcolor=#FFFFFF  \n');
	//flashwrite = flashwrite + (' swLiveConnect=FALSE WIDTH="340" HEIGHT="272" NAME="panorama_amersham" ALIGN="" \n');
	//flashwrite = flashwrite + (' TYPE="application/x-shockwave-flash " \n');
	//flashwrite = flashwrite + (' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> \n');
	//flashwrite = flashwrite + (' </EMBED> \n');
	flashwrite = flashwrite + (' </OBJECT> \n');
} else{
	flashwrite = flashwrite + ('<br><b>Sorry! This page requires Macromedia Flash...</b><br> \n');
}
//flashwrite = flashwrite + ('//--> \n');
//flashwrite = flashwrite + ('<'+'/script> \n');
flashwrite = flashwrite + ('<noscript> \n');
flashwrite = flashwrite + ('</noscript> \n');
	
flashwrite = flashwrite + ('</td> \n');
flashwrite = flashwrite + ('</tr> \n');
flashwrite = flashwrite + ('</table> \n');


document.getElementById('moving_flash').innerHTML = flashwrite;

document.location.hash="anc_moving_flash";
}



function funcMovingFlashNaos (product,width,height,div_name)
{
	var flashwrite = ''
flashwrite = flashwrite + ('<br />\n');
flashwrite = flashwrite + ('<h3>Movement Animation - ' + product + '</h3>\n');
flashwrite = flashwrite + ('<br />\n');
flashwrite = flashwrite + ('<table width="100%" border="0" cellspacing="0" cellpadding="0">\n');
flashwrite = flashwrite + ('<tr>\n');
flashwrite = flashwrite + ('<td align="center" background="../images/site/menu_gradient.jpg" class="greytextnorm" >\n');
//flashwrite = flashwrite + ('<script type="text/javascript" >\n');
//flashwrite = flashwrite + ('<!-- \n');

	var MM_contentVersion = 6;
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
	    }
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
//	flashwrite = flashwrite + ('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	//flashwrite = flashwrite + ('on error resume next \n');
	//flashwrite = flashwrite + ('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	//flashwrite = flashwrite + ('</SCR' + 'IPT\> \n');
}
if ( true ) {
		flashwrite = flashwrite + ('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" \n');
	flashwrite = flashwrite + ('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" \n');
	flashwrite = flashwrite + (' ID="panorama_amersham" WIDTH="' + width + '" HEIGHT="' + height + '" ALIGN=""> \n');
	flashwrite = flashwrite + (' <PARAM NAME=movie VALUE="../images/flash/'+ product +'.swf"> \n');
	flashwrite = flashwrite + (' <PARAM NAME=quality VALUE=high> \n');
	flashwrite = flashwrite + (' <PARAM NAME=loop VALUE=true> \n');
	flashwrite = flashwrite + (' <PARAM NAME=bgcolor VALUE=#FFFFFF> \n'); 
	flashwrite = flashwrite + (' <EMBED src="../images/flash/'+ product +'.swf" quality=high bgcolor=#FFFFFF  \n');
	flashwrite = flashwrite + (' swLiveConnect=FALSE WIDTH="' + width + '" HEIGHT="' + height + '" NAME="panorama_amersham" ALIGN="" \n');
	flashwrite = flashwrite + (' TYPE="application/x-shockwave-flash " \n');
	flashwrite = flashwrite + (' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> \n');
	flashwrite = flashwrite + (' </EMBED> \n');
	flashwrite = flashwrite + (' </OBJECT> \n');
} else{
	flashwrite = flashwrite + ('<br><b>Sorry! This page requires Macromedia Flash...</b><br> \n');
}
//flashwrite = flashwrite + ('//--> \n');
//flashwrite = flashwrite + ('<'+'/script> \n');
flashwrite = flashwrite + ('<noscript> \n');
flashwrite = flashwrite + ('</noscript> \n');
	
flashwrite = flashwrite + ('</td> \n');
flashwrite = flashwrite + ('</tr> \n');
flashwrite = flashwrite + ('</table> \n');


document.getElementById('div_'+div_name).innerHTML = flashwrite;

document.location.hash='anc_'+div_name;
}


function onTTbuyload() {
if (doneTTtraining == "yes") {
var ttform = document.getElementById('buyit_1');
ttform.cartaction.value = "add";
ttform.submit2.value = "Add to Basket";
ttform.action = "/?action=tripptrappbuy"; 
document.getElementById('doneTTtrainingSPAN').innerHTML = '<div class="greenDivBox"><strong>Thank you for completing the Tripp Trapp Training!</strong><br />If you require further Tripp Trapps, you can now just add to basket here.</div>';
}
if (baskethasTT == "yes") {
	document.getElementById('FreeCushion').style.display = "block";}
}

