/*
generic functions for theAA sitewide

*/


function popUpWindow(theURL,winName,features) {
	/* Behaves just like window.open() but ensures visible child windows */
	closePopUpWindow();
	openedWindow = open(theURL,winName,features+",left=0,top=0,screenX=0,screenY=0");
	openedWindow.onunload = confirmClosed;
	onunload = closePopUpWindow;
	windowOpen = true;
	return (openedWindow);
}
function closePopUpWindow(){
	/*  Closes a window's child window */
	if (window.windowOpen){
		openedWindow.close();
		confirmClosed();
	}
}
function confirmClosed(){
	/*  Used to confirm when the child window is closed */
	windowOpen = false;
}

function popUpMap(){
	/*  Pops up a Map in Route Planner */
	popUpWindow('planner_popupmap.html','Map','width=400,height=490,scrollbars=no,');
}

//this pop-up doesn't have left=,screex= etc. for positioning, to allow these to be set from the calling page
function popUpWindow2(theURL,winName,features) {
	window.onunload = closePopUpWindow2;
	closePopUpWindow2();
	window.openedWindow2 = window.open(theURL,winName,features);
	return (window.openedWindow2);
}

function closePopUpWindow2(){
	if (window.openedWindow2 && !window.openedWindow2.closed){
		window.openedWindow2.close();
	}
}

function changeBg(id)
/* used by yourcar/valuation_home for rollovers */
    {if (window.divs) eval("divs."+id+".setBackgroundColor('#ffcc00')")}

 function changeBack(id)
 /* used by yourcar/valuation_home for rollovers */
    {if (window.divs) eval("divs."+id+".setBackgroundColor('#ccccff')")}

 function whatMonth()
	{
		/* used in yourtravel/events
		 get the month and display in the select box */
		var new_date = new Date();
		var the_month = new_date.getMonth();
		document.getMonth.months.selectedIndex= the_month;
	}


function doNothing()
/* called when we want nothing to be done - it'll make sense don't worry */
{}

function goPage(place)
/* called by dropdown that sends a ULR as a value and causes that URL to load */
{
	var item=place.options[place.selectedIndex].value;
	if (item != "nowhere") {
		top.location=item;
	}
}

function notYet()
/*called by links that have not yet been implemented*/
{
	alert('Sorry. This functionality has not yet been implemented.');
}

function closewin(url)
{
    window.close();
}


/* JAVASCRIPT Functions for products and services */
function sideMenuProductService(index,position)
{
var sideMenuName = [
    ["Products & Services","Get a quote","Apply now","Car Loans homepage"],
    ["Products & Services","Get a quote","Apply now"]
];

var sideMenuLink = [

    ["/cbg/productsandservices/productsandservices.jsp",
     "http://www.theaa.com/common/redeyeJumpRedirect.jsp?nextPage=http://www.theaa.com/finance/finance_quote.jsp&nourl=www.theaa.com/linkfrom/CBG_Car_loans/Car-Loans-Get-a-quote",
     "http://www.theaa.com/common/redeyeJumpRedirect.jsp?nextPage=http://www.theaa.com/finance/finance_loan_legal.jsp?loantype=C&carincentive=1&thirdpartycode=CB&nourl=www.theaa.com/linkfrom/CBG_Car_loans/Car-Loans-Apply-now",
      "http://www.theaa.com/common/redeyeJumpRedirect.jsp?nextPage=http://www.theaa.com/finance/finance_info.jsp?loantype=C&carincentive=1&personalincentive=0&thirdpartycode=AA&nourl=www.theaa.com/linkfrom/CBG_Car_loans/Car-Loans-HP"],
    ["/cbg/productsandservices/productsandservices.jsp",
     "http://www.theaa.com/common/redeyeJumpRedirect.jsp?nextPage=https://www.theaa.com/services/insuranceandfinance/motor/index.jsp&nourl=www.theaa.com%2Flinkfrom%2FCBG_Car_insurance%2FAA-ins-Get-a-quote&_pageLabel=page_products_2",
     "http://www.theaa.com/common/redeyeJumpRedirect.jsp?nextPage=https://www.theaa.com/services/insuranceandfinance/motor/index.jsp&nourl=www.theaa.com%2Flinkfrom%2FCBG_Car_insurance%2FAA-ins-Apply-now&_pageLabel=page_products_2"]
    ];

// Calling the side_menu_length function
sideMenuLength(index,position,sideMenuName,sideMenuLink);
}

function sideMenuLength(index,position,sideMenuName,sideMenuLink)
{
	//Finding the length of array is to be displayed
	arrLength = sideMenuName[index].length;

	//Calling the function for printing the side menu contents
	sideMenuPrint(index,arrLength,sideMenuLink,sideMenuName);
}

	//To print the side menu contents
function sideMenuPrint(index,length,sideMenuLink,sideMenuName)
{
	var j=0;
    document.write("<div class=\"thirtypixel\">&nbsp;");
    document.write("</DIV>");
    document.write("<div class=\"sidebar\">")
    while(j<length)
	{
        document.write("<DIV class=contentbutton>");
        document.write("<strong><a href = "+"\""+sideMenuLink[index][j] + "\">"+sideMenuName[index][j]+"</a></strong><br>");
        j++;
        document.write("</DIV>");
	}
    document.write("</DIV>");
}


/* JS Functions for Just Good Advice */
var backname;
var backlink;
var imagename;
function side_menu()
{	
    var args=side_menu.arguments;
    	
	var index = args[0];
	var position = args[1];

	  if(args.length>1)
		{	
				   backname=args[2];
				   backlink=args[3];
                   imagename=args[4];
        }
    
    var side_menu_name = [
    ["Just Good Advice Home","Which colour?","Emissions","Which fuel?","Cars and lifestyle","Number plates","Car safety","Security"],
    ["Just Good Advice Home","Choosing an insurer","Company cars","Depreciation","Finance","Insurance groups",
	"Running costs","Road tax"],
    ["Just Good Advice Home","Buying new","Buying used"],
    ["Just Good Advice Home","Tips for buying new","Car buying victims","DIY Inspection","Imports","Test-drive tips",
	"Used-car checklist","Tips for buying used"],
    ["Just Good Advice Home","Buyer's contract","Seller's contract","Your legal rights"],
    ["Just Good Advice Home","Be prepared","Prices and adverts"],
    ["Just Good Advice Home","Little black book"],
    ["Accessibility","Assumptions","About Us","Privacy","Information providers","About this site",
	"<strong>Close this window</strong>"],
    ["Accessibility","Assumptions","About Us","Privacy","Information providers","About this site","<strong>"+backname+"</strong>"],
	["Just Good Advice Home","Little black book"],
    /* Added Array for Back to Search to Just Good Advice. */
    ["Which colour?","Emissions","Which fuel?","Cars and lifestyle","Number plates","Car safety","Security","<strong>"+backname+"</strong>"],
    ["Choosing an insurer","Company cars","Depreciation","Finance","Insurance groups","Running costs","Road tax","<strong>"+backname+"</strong>"],
	["Buying new","Buying used","<strong>"+backname+"</strong>"],
    ["Tips for buying new","Car buying victims","DIY Inspection","Imports","Test-drive tips",
	"Used-car checklist","Tips for buying used","<strong>"+backname+"</strong>"],
	["Buyer's contract","Seller's contract","Your legal rights","<strong>"+backname+"</strong>"],
	["Be prepared","Prices and adverts","<strong>"+backname+"</strong>"],
	["Little black book","<strong>"+backname+"</strong>"],
    /* Added Array for footer link  to Just Good Advice. */
    ["Which colour?","Emissions","Which fuel?","Cars and lifestyle","Number plates","Car safety","Security","<strong>"+backname+"</strong>"],
    ["Choosing an insurer","Company cars","Depreciation","Finance","Insurance groups","Running costs","Road tax","<strong>"+backname+"</strong>"],
	["Buying new","Buying used","<strong>"+backname+"</strong>"],
    ["Tips for buying new","Car buying victims","DIY Inspection","Imports","Test-drive tips",
	"Used-car checklist","Tips for buying used","<strong>"+backname+"</strong>"],
	["Buyer's contract","Seller's contract","Your legal rights","<strong>"+backname+"</strong>"],
	["Be prepared","Prices and adverts","<strong>"+backname+"</strong>"],
	["Little black book","<strong>"+backname+"</strong>"]
    ];

    var side_menu_link = [
    ["/cbg/goodadvice/goodadvice.jsp",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=0&menu2=1&fileName=colour",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=0&menu2=2&fileName=emissions",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=0&menu2=3&fileName=fuel",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=0&menu2=4&fileName=lifestyle",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=0&menu2=5&fileName=number_plates",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=0&menu2=6&fileName=safety",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=0&menu2=7&fileName=security"],
    ["/cbg/goodadvice/goodadvice.jsp",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=1&menu2=1&fileName=insurance_small_print",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=1&menu2=2&fileName=company_cars",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=1&menu2=3&fileName=depreciation",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=1&menu2=4&fileName=finance",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=1&menu2=5&fileName=insurance_groups",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=1&menu2=6&fileName=running_costs",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=1&menu2=7&fileName=road_tax"],
    ["/cbg/goodadvice/goodadvice.jsp",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=2&menu2=1&fileName=where_to_buy_new",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=2&menu2=2&fileName=where_to_buy_used"],
    ["/cbg/goodadvice/goodadvice.jsp",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=3&menu2=1&fileName=buying_new",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=3&menu2=2&fileName=car_buying_horror_stories",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=3&menu2=3&fileName=diy_inspection",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=3&menu2=4&fileName=imports",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=3&menu2=5&fileName=test_drive_tips",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=3&menu2=6&fileName=used_car_checklist",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=3&menu2=7&fileName=buying_used_cars"],
    ["/cbg/goodadvice/goodadvice.jsp",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=4&menu2=1&fileName=buyers_contract",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=4&menu2=2&fileName=sellers_contract",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=4&menu2=3&fileName=your_rights"],
    ["/cbg/goodadvice/goodadvice.jsp",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=5&menu2=1&fileName=selling_tips",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=5&menu2=2&fileName=selling_your_car"],
    ["/cbg/goodadvice/goodadvice.jsp",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=6&menu2=1&fileName=selling_your_car"],
    [eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=7&menu2=0&fileName=accessibility&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=7&menu2=1&fileName=glasses_exclusions&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=7&menu2=2&fileName=about_the_aa&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=7&menu2=3&fileName=privacy&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=7&menu2=4&fileName=glasses_tc&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=7&menu2=5&fileName=about_this_site&menu3='+backname+'"'),
	"javascript:window.close()"],
    [eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=8&menu2=0&fileName=accessibility&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=8&menu2=1&fileName=glasses_exclusions&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=8&menu2=2&fileName=about_the_aa&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=8&menu2=3&fileName=privacy&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=8&menu2=4&fileName=glasses_tc&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=8&menu2=5&fileName=about_this_site&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
    backlink],
	// Added this Array for Useful contact page of Just Good Advice 
	["/cbg/goodadvice/goodadvice.jsp",
	"/cbg/goodadvice/commongoodadvice.jsp?menu1=9&menu2=1&fileName=useful_contacts"],
            // Added Array for Back to Search to Just Good Advice.
	[eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=10&menu2=0&fileName=colour&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=10&menu2=1&fileName=emissions&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=10&menu2=2&fileName=fuel&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=10&menu2=3&fileName=lifestyle&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=10&menu2=4&fileName=number_plates&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=10&menu2=5&fileName=safety&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=10&menu2=6&fileName=security&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	backlink],
	[eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=11&menu2=0&fileName=insurance_small_print&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=11&menu2=1&fileName=company_cars&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=11&menu2=2&fileName=depreciation&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=11&menu2=3&fileName=finance&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=11&menu2=4&fileName=insurance_groups&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=11&menu2=5&fileName=running_costs&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=11&menu2=6&fileName=road_tax&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	backlink],
	[eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=12&menu2=0&fileName=where_to_buy_new&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=12&menu2=1&fileName=where_to_buy_used&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	backlink],
	[eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=13&menu2=0&fileName=buying_new&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=13&menu2=1&fileName=car_buying_horror_stories&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=13&menu2=2&fileName=diy_inspection&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=13&menu2=3&fileName=imports&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=13&menu2=4&fileName=test_drive_tips&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=13&menu2=5&fileName=used_car_checklist&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=13&menu2=6&fileName=buying_used_cars&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	backlink],
	[eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=14&menu2=0&fileName=buyers_contract&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=14&menu2=1&fileName=sellers_contract&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=14&menu2=2&fileName=your_rights&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	backlink],
	[eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=15&menu2=0&fileName=selling_tips&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=15&menu2=1&fileName=selling_your_car&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	backlink],
	[eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=16&menu2=0&fileName=useful_contacts&menu3='+backname+'&menu4='+encodeURIComponent(backlink)+'&menu5='+imagename+'"'),
	backlink],
    // Added Array for footer link  to Just Good Advice.
	[eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=17&menu2=0&fileName=colour&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=17&menu2=1&fileName=emissions&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=17&menu2=2&fileName=fuel&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=17&menu2=3&fileName=lifestyle&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=17&menu2=4&fileName=number_plates&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=17&menu2=5&fileName=safety&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=17&menu2=6&fileName=security&menu3='+backname+'"'),
	"javascript:window.close()"],
	[eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=18&menu2=0&fileName=insurance_small_print&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=18&menu2=1&fileName=company_cars&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=18&menu2=2&fileName=depreciation&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=18&menu2=3&fileName=finance&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=18&menu2=4&fileName=insurance_groups&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=18&menu2=5&fileName=running_costs&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=18&menu2=6&fileName=road_tax&menu3='+backname+'"'),
	"javascript:window.close()"],
	[eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=19&menu2=0&fileName=where_to_buy_new&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=19&menu2=1&fileName=where_to_buy_used&menu3='+backname+'"'),
	"javascript:window.close()"],
	[eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=20&menu2=0&fileName=buying_new&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=20&menu2=1&fileName=car_buying_horror_stories&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=20&menu2=2&fileName=diy_inspection&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=20&menu2=3&fileName=imports&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=20&menu2=4&fileName=test_drive_tips&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=20&menu2=5&fileName=used_car_checklist&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=20&menu2=6&fileName=buying_used_cars&menu3='+backname+'"'),
	"javascript:window.close()"],
	[eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=21&menu2=0&fileName=buyers_contract&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=21&menu2=1&fileName=sellers_contract&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=21&menu2=2&fileName=your_rights&menu3='+backname+'"'),
	"javascript:window.close()"],
	[eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=22&menu2=0&fileName=selling_tips&menu3='+backname+'"'),
	eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=22&menu2=1&fileName=selling_your_car&menu3='+backname+'"'),
	"javascript:window.close()"],
	[eval('"/cbg/goodadvice/commongoodadvice.jsp?menu1=23&menu2=0&fileName=useful_contacts&menu3='+backname+'"'),
	"javascript:window.close()"]
];


// Calling the side_menu_length function
side_menu_length(index,position,side_menu_name,side_menu_link);
}

function side_menu_length(index,position,side_menu_name,side_menu_link)
{
	//Finding the length of array is to be displayed
	arr_length = side_menu_name[index].length;

	//Finding the message is to be displayed "black"
	msg_black = side_menu_name[index][position];

	//Calling the function for printing the side menu contents
	side_menu_print(index,arr_length,side_menu_link,side_menu_name,msg_black);
}

	//To print the side menu contents
function side_menu_print(index,length,side_menu_link,side_menu_name,msg_black)
{
	var j=0;
                document.write("<div class=\"thirtypixel\">&nbsp;");
                document.write("</DIV>");
                document.write("<div class=\"sidebar\">")




    while(j<length)
	{
                document.write("<DIV class=contentbutton>");

        if(msg_black == side_menu_name[index][j])
			{
				document.write("<strong>"+side_menu_name[index][j]+"</strong>");
				j++;

            }
			else
			{
				document.write("<a href = "+"\""+side_menu_link[index][j] + "\">"+side_menu_name[index][j]+"</a><br>");
				j++;
			}

                document.write("</DIV>");
	}
                document.write("<br></div>")

}




