// Preload Script
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages(ary) {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<ary.length; i+=2) {
			document[ary[i]].src = ary[i+1];
		}
	}
}

var activeMenu = 0;
function setActiveMenu(menu)
{
	activeMenu = menu;
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		Menu_Home_over = newImage("images/home_on.gif");
		Menu_ListWithUs_over = newImage("images/listwithus_on.gif");
		Menu_AboutUs_over = newImage("images/aboutus_on.gif");
		Menu_ContactUs_over = newImage("images/contactus_on.gif");
		Menu_Articles_over = newImage("images/articles_on.gif");
		Menu_BabyGear_over = newImage("images/babygear_on.gif");
		Menu_InformationCentre_over = newImage("images/informationresourcecentre_on.gif");

		SubMenu_BabyGear_over = newImage("images/babygearsub_on.gif");
		SubMenu_PlayGroup_over = newImage("images/playgroupssub_on.gif");
		SubMenu_DiscussionGroup_over = newImage("images/discussiongroupssub_on.gif");
		SubMenu_Events_over = newImage("images/eventssub_on.gif");
		SubMenu_Mompreneur_over = newImage("images/mompreneursub_on.gif");
		SubMenu_Childcare_over = newImage("images/childcaresub_on.gif");
				
		preloadFlag = true;
		
		// set the active menu
		setRollover(activeMenu, true);
	}
}
var allImages = new Array(34);

allImages[0] = new Array('Menu_Home', 'images/home_on.gif');
allImages[1] = new Array('Menu_Home', 'images/home_off.gif');
allImages[2] = new Array('Menu_ListWithUs', 'images/listwithus_on.gif');
allImages[3] = new Array('Menu_ListWithUs', 'images/listwithus_off.gif'); 
allImages[4] = new Array('Menu_AboutUs', 'images/aboutus_on.gif');		
allImages[5] = new Array('Menu_AboutUs', 'images/aboutus_off.gif');	
allImages[6] = new Array('Menu_ContactUs', 'images/contactus_on.gif');	
allImages[7] = new Array('Menu_ContactUs', 'images/contactus_off.gif');	
allImages[8] = new Array('Menu_Articles', 'images/articles_on.gif');
allImages[9] = new Array('Menu_Articles', 'images/articles_off.gif');	
allImages[10] = new Array('Menu_BabyGear', 'images/babygear_on.gif');
allImages[11] = new Array('Menu_BabyGear', 'images/babygear_off.gif');
allImages[12] = new Array('Menu_InformationCentre', 'images/informationresourcecentre_on.gif');
allImages[13] = new Array('Menu_InformationCentre', 'images/informationresourcecentre_off.gif');
allImages[14] = new Array('', '');
allImages[15] = new Array('', '');
allImages[16] = new Array('', '');
allImages[17] = new Array('', '');
allImages[18] = new Array('', '');
allImages[19] = new Array('', '');

allImages[20] = new Array('SubMenu_BabyGear', 'images/babygearsub_on.gif');
allImages[21] = new Array('SubMenu_BabyGear', 'images/babygearsub_off.gif');
allImages[22] = new Array('SubMenu_PlayGroup', 'images/playgroupssub_on.gif');
allImages[23] = new Array('SubMenu_PlayGroup', 'images/playgroupssub_off.gif'); 
allImages[24] = new Array('SubMenu_DiscussionGroup', 'images/discussiongroupssub_on.gif');		
allImages[25] = new Array('SubMenu_DiscussionGroup', 'images/discussiongroupssub_off.gif');	
allImages[26] = new Array('SubMenu_Events', 'images/eventssub_on.gif');	
allImages[27] = new Array('SubMenu_Events', 'images/eventssub_off.gif');	
allImages[28] = new Array('SubMenu_Mompreneur', 'images/mompreneursub_on.gif');
allImages[29] = new Array('SubMenu_Mompreneur', 'images/mompreneursub_off.gif');	
allImages[30] = new Array('SubMenu_Childcare', 'images/childcaresub_on.gif');
allImages[31] = new Array('SubMenu_Childcare', 'images/childcaresub_off.gif');
allImages[32] = new Array('', '');
allImages[33] = new Array('', '');


function setRollover(menuItem, over)
{
	if (over == true)
	{
		changeImages(allImages[activeMenu*2 + 1]);
		changeImages(allImages[menuItem*2]);
	}
	else
	{
		if (menuItem != activeMenu)
		{
			changeImages(allImages[menuItem*2 + 1]);
			changeImages(allImages[activeMenu*2]);
		}
	}
	
}
// End Preload Script


function jump(fe) {
	var opt_key = fe.selectedIndex;
	var id = fe.options[opt_key].value;
	var uri_val = "showcategory.php?maincat=" + id;
	window.open(uri_val,'_top');
	return true;
}

function jump1(fe) {
	var opt_key = fe.selectedIndex;
	var id = fe.options[opt_key].value;
	var uri_val = "/content/index.php?option=com_content&id=24&Itemid=26&view=article&maincat=" + id;
	window.open(uri_val,'_top');
	return true;
}

function searchList(fe) {
	var element = document.getElementById(fe);
	var id = element.value;
	if (id == null || id.length == 0) {
		alert("You must enter a search string");
		return;
	}
	var uri_val = "listingsaz.shtml?search=" + id;
	window.open(uri_val,'_top');
	return true;
}

function searchList1(fe) {
	var element = document.getElementById(fe);
	var id = element.value;
	if (id == null || id.length == 0) {
		alert("You must enter a search string");
		return;
	}
	var uri_val = "listingsaz.shtml?search=" + id;
	window.open(uri_val,'_top');
	return true;
}

function searchList2(fe) {
	var element = document.getElementById(fe);
	var id = element.value;
	if (id == null || id.length == 0) {
		alert("You must enter a search string");
		return;
	}
	var uri_val = "index.php?option=com_content&view=article&id=31&Itemid=26&search=" + id;
	window.open(uri_val,'_top');
	return true;
}

function searchMompreneurList(fe) {
	var element = document.getElementById(fe);
	var id = element.value;
	if (id == null || id.length == 0) {
		alert("You must enter a search string");
		return;
	}
	var uri_val = "listingsaz.shtml?mompreneur=true&search=" + id;
	window.open(uri_val,'_top');
	return true;
}


function popIt(url, theWidth, theHeight, windowName) 
	{
	if (windowName == null)
		windowName = "myWindow";
    // the variable name represents the open window
    // the first argument is the page you are displaying in the popup
    // the second argument is the name of the window for future operations
    // you can modify/delete some of the remaining arguments as you wish
    // they represent the features of the popup window
    // N.B. --- put the following on one line!!!
	openWin = window.open(url,windowName,"top=0,left=0,width=" + theWidth + ",height=" + theHeight + ",buttons=no,scrollbars=yes,location=no,menubar=no,resizable=yes,status=no,directories=no,toolbar=no");
		// the following line sets the focus to the open window, i.e. brings it to the front
	}

function SubmitForm(form)
{			
	form.submit();
}

function WriteDate()
{
	var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	var montharray=new Array("Jan","Feb","March","April","May","June","July","August","Sept","Oct","Nov","Dec");
	var mydate=new Date();
	var year=mydate.getYear();
	// year<2000, pad it with "19"
	if (year<2000)
	{
		year=1900+year;
	}
	var day=mydate.getDay();
	var month=mydate.getMonth();
	var daym=mydate.getDate();
	
	//if the current date is less than 10, pad it.
	if (daym<10)
	{
		daym="0"+daym;
	}
	//write out the final results
	document.write("<span class=\"date\">" + montharray[month] + " " + daym + ", " + year + " </span>");
}

function loadInParent(url, closeSelf){
	self.opener.location = url;
	if(closeSelf) self.close();
}

function openWin(wName, wWidth, wHeight, wResize)
{

var features = 'scrollbars=1,status=1,left=20, top=20, resizable=' + ((wResize) ? 1 : 0) + ((wWidth) ? ',width=' + wWidth : '') + ((wHeight) ? ',height=' + wHeight : '');
popWin = window.open('', wName, features);
if(popWin.focus) { popWin.focus(); }
return true;
}
