// normal site functions



function confirmDeleteIt ()
 {
	if (confirm("Please confirm you wish to delete")) {
	 return true;
	} else {
	 return false;	
	}
 }
 
 
 function confirmRegAdded(aForm){
	 if (aForm.REGNUMBER.value==''){
		 alert ("registration number cannot be blank!");
		return false;	 
	 } else	 if (aForm.sc.value=='0'){
		 alert ("Model cannot be 'All Models', please select a model !");
		return false;	 
	 } else  {
		return true; 
	 }
	 
 }
 // menu change colour of item that is clicked
 
 function changeMenuColour (elementID)
{
  	var elementID = elementID;
  	var MenuItem = document.getElementById(elementID);
	//window.alert (MenuItem.id)
	//MenuItem.style.backgroundColor = "#005294";
	//window.alert (document.getElementById(elementID).style.color

}
 
 //// CAR FUNCTIONS
function LoadTab(TheTab){
	if (TheTab != CurrentTab){
		document.getElementById('usedcar_' + CurrentTab).className='usedcar';
		document.getElementById(CurrentTab).style.display='none';
		document.getElementById('usedcar_' + TheTab).className='usedcar_on';
		document.getElementById(TheTab).style.display='';
		CurrentTab = TheTab;
	}
}
CurrentTab = 'summary';

// JavaScript Document
 <!--
 //================ cart ========================
	/*
	variables
	*/
	

	// status of the items in the library layers (whether selected or not)
	var SelStatus = new Array();
	// number of library items selected
	var SelTotal = 0;
	var SelRefIdsArray = new Array();
	var SelbtnStusArray = new Array();
	SelbtnStusArray['vw'] 	= false;
	SelbtnStusArray['com']	= false;
	SelbtnStusArray['rm']	= false;
	SelbtnStusArray['rmA']	= true;
	/*
	  @description: adds items to saved library
	  @param: itemID, the ref_id of the item to be saved to the library
	  @see: document.forms.saveItem.
	  @see: add_to_cart.php
	  @returns: true
	*/
	function addToSaved(itemID) {
		document.forms.saveItem.newItem.value=itemID;
		document.forms.saveItem.submit();
		return true;
	}
	/*
	  @description: getHighlightedItems
	  compiles an array of all highlighted elements 
	  @returns: tempArray
	*/
	function getHighlightedItems()
	{
		var tempArray = new Array();
		var delete_items=0;
		for (i=0;i<=SelStatus.length;i++)	
		{
			if (SelStatus[i]) 
			{
					tempArray.push(SelRefIdsArray[i])
			}
		}
		return tempArray;
	}
		/*
	  @description: view item
	  compiles a GET url to view an item by reference number
	  @see: SelRefIdsArray
	  @see: show_car.php 
	*/
	function viewItem ()
	{
		for (i=0;i<=SelStatus.length;i++)	
			{
				if (SelStatus[i])	
				{
					location.href="usedcar.php?r=" + SelRefIdsArray[i];
				}
			}
	}
	/*
	  @description: vicomparedFromSaved
	  compiles a GET url to view an item by reference number
	  @see: SelRefIdsArray
	  @see: show_car.php 
	*/	
	function compareFromSaved ()
	{
		var compare_array= new Array();
		var tempString ='?c=1';
		compare_array = getHighlightedItems();
		for (var i = 0; i<compare_array.length;i++ )
		{
		tempString+= '&c_'+i+'='+compare_array[i];
		}
		location.href='compare.php'+tempString;
	}
	/*
	  @description: build buildDeleteElementsForm
	  compiles a form and populates it with items for deletion
	  @see: buildDeleteElementsForm
	  @param: anArray an array of items for deletion
	  @see document.forms.itemsToDelete
	  @see: add_to_cart.php 
	*/
	function removeFromSaved (clickeFrom,refID)	
	{
		if (clickeFrom=='cart')
		{
			var delete_array= new Array();
			delete_array = getHighlightedItems();
			div=document.getElementById("deleteItemSpan");
			
			var deleteForm = document.deleteItems;
			var  button=document.itemsToDelete.delFromCartBtn;
			for (var i = 0; i<delete_array.length;i++ )
				{
					var newitem ='<input type="hidden" name="delete_' + i+'" ';
					newitem += 'value="'+delete_array[i] + '">';
					newnode=document.createElement("span");
					newnode.innerHTML=newitem;
					div.insertBefore(newnode,button);
				}
				
			
		}	
		else if (clickeFrom=='page')
		{
			div=document.getElementById("deleteItemSpan");
			var deleteForm = document.deleteItems;
			var  button=document.itemsToDelete.delFromCartBtn;
			var newitem ='<input type="hidden" name="delete_' + i+'" ';
				newitem += 'value="'+refID + '">';
				newnode=document.createElement("span");
				newnode.innerHTML=newitem;
				div.insertBefore(newnode,button);
		}
			
			
		document.forms.itemsToDelete.submit();
	}
	/*
	  @description: removes ALL from saved library
	  adds 'delete_all' form element
	  @see: add_to_cart.php
	*/
		function removeAllFromSaved()
	{
			div=document.getElementById("deleteItemSpan");
			var deleteForm = document.deleteItems;
			var  button=document.itemsToDelete.delFromCartBtn;
			var newitem ='<input type="hidden" name="delete_all" value ="delete_all" />';
			newnode=document.createElement("span");
 			newnode.innerHTML=newitem;
 			div.insertBefore(newnode,button);
			document.forms.itemsToDelete.submit();
	}
	/*
	  @description: cosmetic stuff - highlights saved items in the library 
	  on mouseOver
	  @param: anIndex, the index / identifier of the div to be highlighted
	*/
	function highlightanItem(anIndex) {
		if (!SelStatus[anIndex]) 
		{
			document.getElementById('sI_' + anIndex).style.cursor='pointer';
			document.getElementById('sI_' + anIndex).style.border='2px #000000 solid';
		}
	}
	/*
	  @description: cosmetic stuff - un highlights saved items in the library 
	  on mouseOut
	  @param: anIndex, the index / identifier of the div to be highlighted
	*/
	function revertSavedItem(anIndex) 
	{
		if (!SelStatus[anIndex])
		{
				document.getElementById('sI_' + anIndex).style.border='2px solid #13b5ea';
		}
	}
	/*
	  @description: cosmetic stuff - un highlights saved items in the library 
	  on mouseOut
	  @param: anIndex, the index / identifier of the div to be highlighted
	*/
	function highlightSavedItem(box, refID) 
	{
		// reverse status of box
		SelStatus[box] = !SelStatus[box];
		if (SelStatus[box])	
		{
			SelRefIdsArray[box] = refID;
			SelTotal++;
		} else	{
			SelRefIdsArray[box] = null;
			SelTotal--;
		}
		// decide whether  view, compare, remove, remove all items should be active
		SelbtnStusArray['vw'] 	= (SelTotal == 1);
		SelbtnStusArray['com']	= (SelTotal > 1);
		SelbtnStusArray['rm']	= (SelTotal > 0);
		SelbtnStusArray['del']	= true;
	}
	/*
	  @description: assesses different options and directs to correct page
	  @param: button, the button that was clicked
	  @see viewItem();
	  @see removeFromSaved()
	  @see removeAllFromSaved()
	  @see compareFromSaved()
	*/
	function onClickOptions(button) 
	{
		if (SelbtnStusArray[button]) 
		{
			switch (button) {
				// view item
				case 'vw' :
						viewItem();
				break;
				// remove selected items when highlighted in cart
				case 'rm'	:
					if (confirm("Delete selected?")) 
					{
						removeFromSaved('cart', null);
					}
					break;
				// remove all items	
				case 'rmA'	:
					if (confirm("Delete all?")) 
					{
						removeAllFromSaved();											
					}
					break;
				case 'com' :
						compareFromSaved();
					break;
			}
		}
	}
	
	// 
	
	/*
	  @description: cosmetic -- button options for the saved car items 
	  @param: aBtn, the button that was clicked
	*/
	function onMouseOverOptions(aBtn) 
	{
		if (SelbtnStusArray[aBtn]) {
			document.getElementById('sc_' + aBtn).style.cursor			= 'pointer';
			document.getElementById('sc_' + aBtn).style.color 			= '#13b5ea';
			document.getElementById('sc_' + aBtn).style.backgroundColor	= '#ffffff';
			document.getElementById('sc_' + aBtn).style.width ='70px';
		} else {
			document.getElementById('sc_' + aBtn).style.color 			= '#ccc';
			document.getElementById('sc_' + aBtn).style.backgroundColor	= '#FFFFFF';
			document.getElementById('sc_' + aBtn).style.width ='70px';
		}
	}
	/*
	  @description: cosmetic -- button options for the saved car items 
	  @param: aBtn, the button that was clicked
	*/
	function onMouseOutOptions(aBtn) 
	{
		if (SelbtnStusArray[aBtn]) {
			document.getElementById('sc_' + aBtn).style.color 			= '#000000';
			document.getElementById('sc_' + aBtn).style.backgroundColor	= '#FFFFFF';
			document.getElementById('sc_' + aBtn).style.width ='70px';
		} else {
			document.getElementById('sc_' + aBtn).style.color 			= '#000000';
			document.getElementById('sc_' + aBtn).style.backgroundColor	= '#FFFFFF';
			document.getElementById('sc_' + aBtn).style.width ='70px';
		}
	}
	// End hiding --->

//================================collapsable layer script========================

//preload image
var collimg = new Image();
collimg.src = "../siteFiles/images/collapse.gif";
var expimg = new Image();
collimg.src = "../siteFiles/images/expand.gif";

function ShowHideLayer(aLayer, aHeight) 
{
	
	var box = document.getElementById(aLayer);	
	//window.alert(box)
	var boxbtn = document.getElementById(aLayer+"btn");

	if(box.style.height != "auto") {
		box.style.height = "auto";
		boxbtn.src = "../siteFiles/images/collapse.gif";
	}
	// otherwise hide it
	else {
		box.style.height = aHeight;
		boxbtn.src = "../siteFiles/images/expand.gif";

	}
}


// hide or "remove" layer 


function removeLayer (aLayer)
{
	var box = document.getElementById(aLayer);	
	box.style.display = 'none';
	deleteElement (aLayer)
}
// delete element from array of comparison products
function deleteElement (anElement)
{
	var anIndex;
	for (var i = 0; i<posArray.length; i++) {
		if (anElement == posArray[i]) {
			anIndex = i;
			posArray.splice(i, 1);
			// move layers up to take place of deleted layer fix for IE
			assessElement( posArray[i-1], true) 
			break;
		}
	}
}
// add element to array of layers which can be moved up or down
var posArray = [];
function addLayerToPosArray (aLayer)
{
	posArray.push (aLayer);
}

// assess which element is clicked
function assessElement(anElement, aDirection) 
{
var anIndex;
	for (var i = 0; i<posArray.length; i++) 
	{
		if (anElement == posArray[i]) 
		{
				anIndex = i;
				
				reshuffleArray(anElement, anIndex, aDirection);
				break;
		}
	}
}
// reshuffle the array
function reshuffleArray(anElement, anIndex, aDirection) {
	var anElmntToMve = anElement;
	var aNewIndex;
	var aBeginArray = [];
	var aEndArray = [];
	var new_array =[];
	// move up
	if (aDirection) {
		if (anIndex != 0) {
			aNewIndex = anIndex-1;
		}  else {
			aNewIndex = null;
		}
	} else {
		aNewIndex = anIndex+1;
	}
	posArray.splice(anIndex, 1);
	aBeginArray = posArray.slice(0, aNewIndex);
	aEndArray = posArray.slice(aNewIndex, posArray.length);
	aBeginArray.push(anElmntToMve);
	new_array = aBeginArray.concat(aEndArray);
	posArray = new_array;
	rePositionPgeElmts ()
}
// get html for new layer
function rePositionPgeElmts ()
{
	var contLayer = document.getElementById('comp_items');
	var tempElHtml="";
	var chngdHtml ="";
	var acontDiv=""
	var tempEl="";

	//contLayer.innerHTML = chngdHtml
for (var i = 0; i<posArray.length; i++) 
	{
		acontDiv = '<div class="displayItemspan" id="'+posArray[i]+'">';
		tempEl = document.getElementById(posArray[i]);
		tempElHtml = acontDiv + tempEl.innerHTML;
		tempElHtml +='</div>'; 
		chngdHtml +=tempElHtml
	}
	contLayer.innerHTML =chngdHtml;	
}
//================================search options populator for USED cars========================
	/*
	  @description: populates sub category [car model] selection box
	  depending on which options in the category [car make] selection box have been
	  selected
	  @param: aCatid, the number corresponding to the category [car make]
	*/
	// array of category ID's - dynamically populated from PHP
				catIds= new Array();
	// array of subcategory ID's - dynamically populated from PHP
				subCatIds = new Array();
	// array of subcategory names's - dynamically populated from PHP
				subCatNames = new Array();
function BuildSearchSubMenuItems(aFormName, aCatid) {
					
					//window.alert (aFormName);
					//document[aFormName].f.value="search by registration";
					// get catid value of currently selected category
				   	var w = document.forms[aFormName].c.selectedIndex;
					aCatid =document.forms[aFormName].c.options[w].value;
					
					// define sub category picker
					var sc = document.forms[aFormName].sc;
					// reset all values to 0
					for (i = 0; i < sc.options.length; i++) {
						sc.options[i] = null;
					}
					while (sc.options.length > 0) {
						sc.options[0] = null;
					}
					var x = 0;
						document.forms[aFormName].sc.options[x] = new Option("- All models -","0");
					x ++;
					// variable to position new sub categories
					for (var i=0;i<catIds.length;i++){
						if (catIds[i]==aCatid){
						// stick in new sub categories
					
								document.forms[aFormName].sc.options[x] = new Option(subCatNames[i],subCatIds[i]);
								x ++;
						}
					}
			 }
		 
	/*
	  @description: populates category [car make] array from php loop
	  @param: anID, the number corresponding to the category [car make]
	*/	
function addToCatIDArray (anID)
{
	catIds.push (anID);
}
	/*
	  @description: populates sub category [car model] array from php loop
	  @param: anID, the number corresponding to the sub category [car model]
	*/	
function addToSubCatIDArray (anID)
{
	subCatIds.push (anID);
}
	/*
	  @description: populates sub category name [car model] array from php loop
	  @param: anName, the displayed name corresponding to the sub category [car model]
	*/	
function addToSubCatNamesArray (anName)
{
	subCatNames.push (anName);
}

















//================================search options populator for NEW cars ========================
	/*
	  @description: populates sub category [car model] selection box
	  depending on which options in the category [car make] selection box have been
	  selected
	  @param: aCatid, the number corresponding to the category [car make]
	*/
	// array of category ID's - dynamically populated from PHP
				catIdsNewCars= new Array();
	// array of subcategory ID's - dynamically populated from PHP
				subCatIdsNewCars = new Array();
	// array of subcategory names's - dynamically populated from PHP
				subCatNamesNewCars = new Array();
		function BuildNewCarsModelsMenu(aCatid) {
	
					// get catid value of currently selected category
				   	var w = document.forms["new_make_model"].c.selectedIndex;
					aCatid =document.forms["new_make_model"].c.options[w].value;
			
					// define sub category picker
					var sc = document.forms["new_make_model"].sc;
					// reset all values to 0
					for (i = 0; i < sc.options.length; i++) {
						sc.options[i] = null;
					}
					while (sc.options.length > 0) {
						sc.options[0] = null;
					}
					var x = 0;
						//document.forms["new_make_model"].sc.options[x] = new Option("- All models -","0");
					//x ++;
					// variable to position new sub categories
					for (var i=0;i<catIdsNewCars.length;i++){
						if (catIdsNewCars[i]==aCatid){
						// stick in new sub categories
								document.forms["new_make_model"].sc.options[x] = new Option(subCatNamesNewCars[i],subCatIdsNewCars[i]);
								x ++;
						}
					}
			 }
			 
			 
			 

	/*
	  @description: populates category [car make] array from php loop
	  @param: anID, the number corresponding to the category [car make]
	*/	
function addToCatIDArrayNewCars (anID)
{
	catIdsNewCars.push (anID);
}
	/*
	  @description: populates sub category [car model] array from php loop
	  @param: anID, the number corresponding to the sub category [car model]
	*/	
function addToSubCatIDArrayNewCars (anID)
{
	subCatIdsNewCars.push (anID);
}
	/*
	  @description: populates sub category name [car model] array from php loop
	  @param: anName, the displayed name corresponding to the sub category [car model]
	*/	
function addToSubCatNamesArrayNewCars (anName)
{
	subCatNamesNewCars.push (anName);
}











/*
Loan form calculator - calculates new deposit and down amount from change of values
*/
function calculatePercent (){
	var newPercent = 0;
	total_amount = document.getElementById ('information').sale_price.value;
	if (total_amount==0){
		document.getElementById ('information').down_amount.value = 0;
		document.getElementById ('information').part_ex.value = 0;
		window.alert("please type in a loan amount");	
	} else  {
		down_percent = document.getElementById ('information').down_percent.value;
		down_amount = document.getElementById ('information').down_amount.value;
		part_ex = document.getElementById ('information').part_ex.value;
		down_amount=Number(down_amount);
		part_ex=Number(part_ex);
		down_amount = down_amount+part_ex;
		newPercent = down_amount/total_amount * 100;
		document.getElementById ('information').down_percent.value = newPercent;
	}
	
}
function calculateAmount (){
	
	
	var newDownAmount = 0;
	total_amount = document.getElementById ('information').sale_price.value;


		down_percent = document.getElementById ('information').down_percent.value;
		down_amount = document.getElementById ('information').down_amount.value;
		part_ex = document.getElementById ('information').part_ex.value;
		
		down_amount=Number(down_amount);
		part_ex=Number(part_ex);
		down_amount = down_amount+part_ex;
	

		newDownAmount = total_amount * down_percent/100;
		document.getElementById ('information').down_amount.value = newDownAmount;
	
}
// FORM VALIDATION OR INSERT PRODUCT
	function submitNewCarForm(carForm) {
			// make sure they enter a title
			if (carForm.title.value == "") {	
			// cannot be empty
				carForm.title.select();
				window.alert ("Please enter a title");	
				return false;
			}
			
			// make sure they enter a reg
			if (carForm.ref_id.value == "") {
				carForm.ref_id.select();
				window.alert ("Please enter a registration number");
				return false;
			}
			 for (var i=0; i<carForm.ref_id.value.length; i++) {
//spaces don't count as "existence"
			if (carForm.ref_id.value.charAt(i) == " ") {
				window.alert ("Please do not use spaces in the registration number");
				return false;
				}
			}
			// make sure they enter a mileage
			var Mileage = carForm.mileage.value;
			if (Mileage == "") {
				carForm.mileage.select();
				window.alert ("Please enter mileage");
				return false;
			}
			// make sure the mileage is numerical
				if (!isNum(Mileage))
				{	
					carForm.mileage.select();
					window.alert ("Mileage must be a numerical value");
					return false;
			}
			// make sure they enter a  colour
		if (carForm.colour.value == "") {	
				carForm.colour.select();
				window.alert ("Please enter the cars colour");
				return false;
			}						
			// make sure they enter a  price
			var Price = carForm.price.value;
				if (Price == "") {	
					carForm.price.select();
					window.alert ("Please enter price");
					return false;
				}
			
			// make sure the mileage is numerical
			if (!isNum(Price)) {
				carForm.price.select();
				window.alert ("Price must be a numerical value");
				return false;			
			}
				// make sure they enter a description
			if (carForm.description.value == "") {	
				carForm.description.select();
				window.alert ("Please enter a description");
				return false;
			}
			// If we made it to here, everything's valid, so return true
		return true
	}
// FORM VALIDATION FOR LOCATIONS
function submitLocationForm(carForm) {
			// make sure they enter a title
			//loc_name
			//loc_tel
			if (carForm.loc_name.value == "") {	
			// cannot be empty
				carForm.loc_name.select();
				window.alert ("Please enter a Location name");	
				return false;
			}
			if (carForm.loc_tel.value == "") {	
			// cannot be empty
				carForm.loc_tel.select();
				window.alert ("Please enter a Location telephone number");	
				return false;
			}
			
}
// FORM VALIDATION FOR MAKES
function submitMakeForm(carForm) {
			// make sure they enter a title
			if (carForm.make_name.value == "") {	
			// cannot be empty
				carForm.make_name.select();
				window.alert ("Please enter a Make");	
				return false;
			}
			
}
// FORM VALIDATION FOR MODELS
function submitModelForm(carForm) {
			// make sure they enter a title
			if (carForm.subcatname.value == "") {	
			// cannot be empty
				carForm.subcatname.select();
				window.alert ("Please enter a Model name");	
				return false;
			}
			
}

// FOR ALL OTHER FORMS

function submitFeedbackForm(aForm) {
			// make sure they enter a title
			if (aForm.name.value == "") {	
			// cannot be empty
				aForm.name.select();
				window.alert ("Please enter your name");	
				return false;
			}
			
			if (aForm.email.value == "") {	
			// cannot be empty
				aForm.email.select();
				window.alert ("Please enter your email address");	
				return false;
			}
		
		
			// cannot be empty
			if(aForm.id=="feedback"){
			if (aForm.comments.value==""){
				aForm.comments.select();
				window.alert ("Please enter your comments");	
				return false;
			
			}
			}
				
			if(aForm.id=="contact"){
			if (aForm.enquiry.value==""){
				aForm.enquiry.select();
				window.alert ("Please enter your enquiry");	
				return false;
			
			}
			}
				
		return true;		
}


// CHECK IF VALUE IS A NUMBER
	function isNum(passedVal) {					// Is this a number?
			if (passedVal == "") {
				return false;
			}
			for (i=0; i<passedVal.length; i++) {
				if (passedVal.charAt(i) < "0") {
					return false;
				}
				if (passedVal.charAt(i) > "9") {
					return false;
				}
			}
			return true;
		}


//--menu >
function montre(id) {
	
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById("smenu"+i)) 
		{
		
		document.getElementById("smenu"+i).style.display="none";
		}
	}
	if (d) 
	{
	d.style.display="block";
	}
}
//window.onload=montre;
 // timout 
 
 var menuCollapse;
function setMenuTimeOut (){
	menuCollapse = setTimeout(" montre();",500);
}
function clearMenuTimeOut()
{
	clearTimeout(menuCollapse);	
}

function rotateFinanceBanners ()
{
		    RandomText = new Array('<object width="685" height="424" data="flash/easyfinance_1.swf" type="application/x-shockwave-flash"> <param name="movie" value="flash/easyfinance_1.swf" /><param name="wmode" value="transparent" /></object>',
								   '<object width="685" height="424" data="flash/easyfinance_2.swf" type="application/x-shockwave-flash"> <param name="movie" value="flash/easyfinance_2.swf" /> <param name="wmode" value="transparent" /></object>', 
								   '<object width="685" height="424" data="flash/easyfinance_3.swf" type="application/x-shockwave-flash"> <param name="movie" value="flash/easyfinance_3.swf" /> <param name="wmode" value="transparent" /></object>');
		   
          return (RandomText[Math.round(Math.random() * (RandomText.length - 1))]);
           
	
}

// rotates finance banners
function rotateOfferBanners ()
{
		    RandomText = new Array('<div id="rotateFlashOffCont"><object width="740" height="140" data="flash/hotDeal_1.swf" type="application/x-shockwave-flash"> <param name="movie" value="flash/hotDeal_1.swf" /><param name="wmode" value="transparent" /></object></div>',
								   '<div id="rotateFlashOffCont"><object width="740" height="140" data="flash/hotDeal_2.swf" type="application/x-shockwave-flash"> <param name="movie" value="flash/hotDeal_2.swf" /> <param name="wmode" value="transparent" /></object></div>', 
								   '<div id="rotateFlashOffCont"><object width="740" height="140" data="flash/hotDeal_3.swf" type="application/x-shockwave-flash"> <param name="movie" value="flash/hotDeal_3.swf" /> <param name="wmode" value="transparent" /></object></div>',
								   '<div id="rotateFlashOffCont"><object width="740" height="140" data="flash/hotDeal_4.swf" type="application/x-shockwave-flash"> <param name="movie" value="flash/hotDeal_4.swf" /> <param name="wmode" value="transparent" /></object></div>',
								   '<div id="rotateFlashOffCont"><object width="740" height="140" data="flash/hotDeal_5.swf" type="application/x-shockwave-flash"> <param name="movie" value="flash/hotDeal_5.swf" /> <param name="wmode" value="transparent" /></object></div>',
								   '<div id="rotateFlashOffCont"><object width="740" height="140" data="flash/hotDeal_6.swf" type="application/x-shockwave-flash"> <param name="movie" value="flash/hotDeal_6.swf" /> <param name="wmode" value="transparent" /></object></div>'
								   );
		   
          return (RandomText[Math.round(Math.random() * (RandomText.length - 1))]);
           
	
}

// auto fit used car iframe to content 
function calcHeight()
{
	
//find the height of the internal page
var the_height= document.getElementById('myiframe').contentWindow.document.body.scrollHeight;

//change the height of the iframe
document.getElementById('myiframe').height=the_height;
}



-->
