function swapImage(id)
{
	y = document.getElementById(id);
	y.style.cursor = 'Hand';
	imgid = id + 'img';
	divid = id + 'div';
	if(id=='1td')
		img = 'homea.jpg';
	else if(id=='tdbar2')
	{
		img = 'servicesa.jpg';
		imgid = '2tdimg';
	}
	else if(id=='3td')
		img = 'resourcesa.jpg';
	else if(id=='4td')
		img = 'pricinga.jpg';
	else if(id=='5td')
		img = 'staffa.jpg';
	else if(id=='6td')
		img = 'specialoffera.jpg';
	else if(id=='7td')
		img = 'aboutusa.jpg';
	else if(id=='8td')
		img = 'contactusa.jpg';

if(id=='tdbar2')
{
	chkmouseover(id);
}
	
	x = document.getElementById(imgid);
	x.src = 'images/' + img;
}

function resImage(id,imgid)
{
	y = document.getElementById(id);
	y.style.cursor = 'Hand';
	imgid = id + 'img';
	if(id=='1td')
		img = 'home.jpg';
	else if(id=='tdbar2')
	{
		img = 'services.jpg';
		imgid = '2tdimg';
	}
	else if(id=='3td')
		img = 'resources.jpg';
	else if(id=='4td')
		img = 'pricing.jpg';
	else if(id=='5td')
		img = 'staff.jpg';
	else if(id=='6td')
		img = 'specialoffer.jpg';
	else if(id=='7td')
		img = 'aboutus.jpg';
	else if(id=='8td')
		img = 'contactus.jpg';

	if(id=='tdbar2')
	chkmouseout(id);
	
	x = document.getElementById(imgid);
	x.src = 'images/' + img;
}
function chkmouseover(passobj)
{
	x = document.getElementById(passobj);
	curX = findPosX(x);
	curY = findPosY(x);

	y = document.getElementById('menubar1div');

	y.style.display = '';

	y.style.top = curY + 27;
	y.style.left = curX - 6;
}

function chkmouseout(passobj)
{
	y = document.getElementById('menubar1div');

	y.style.display = 'none';
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function chMenuStyle(thisid)
{
	thisid.style.cursor = 'Hand';
	thisid.style.background = '#027ABB';

}
function reMenuStyle(thisid)
{
	thisid.style.cursor = '';
	thisid.style.background = '#BA0000';
}
function highTable(thisid)
{
	thisid.style.border = '#000000 solid 1px';
}
function resTable(thisid)
{
	thisid.style.border = 'dashed 1px #666666';
}

function showMenu(comId)
{
	x = document.getElementById(comId);
	x.className = 'mItemOver ' + comId +'Over';
	if(comId == 'memDiv' || comId == 'trainDiv')
	{
		chkmouseover(comId);
		//alert(document.forms.length);
		for(i=0;i<document.forms.length;i++)
		{
			var theForm = document.forms[0];
			//alert(theForm.elements.length);
			for(p=0;p<theForm.elements.length;p++)
			{
				//alert(theForm.elements[p].type);
				if(theForm.elements[p].type == 'select-one')
				theForm.elements[p].style.display = 'none';
			}
		}
	}
	return true;
}

function chkLogin(frm)
{
	if(!notEmpty(frm.UserName,"User Name"))
	return false;
	if(!notEmpty(frm.Pwd,"Password"))
	return false;
	else
	return true;
}

function hideMenu(comId)
{
	x = document.getElementById(comId);
	x.className = comId;
	if(comId == 'memDiv' || comId == 'trainDiv')
	{
		chkmouseout(comId);
		//alert(document.forms.length);
		for(i=0;i<document.forms.length;i++)
		{
			var theForm = document.forms[0];
			for(p=0;p<theForm.elements.length;p++)
			{
				if(theForm.elements[p].type == 'select-one')
				theForm.elements[p].style.display = '';
			}
		}
	}
	return true;
}


function chkAddMember(frm,isEdit)
{
	if(!notEmpty(frm.txtName,"Name"))
	return false;
	if(!notEmpty(frm.txtPosition,"Position"))
	return false;
	/* if(!notSelected(frm.txtStrengths,"Strengths"))
	return false;
	if(!notSelected(frm.txtEstimatedRate,"Estimated Rate"))
	return false;
	if(!notSelected(frm.txtNotes,"Note"))
	return false;*/
	if(!notSelected(frm.slAvailability,"Availability"))
	return false;
	if(!notSelected(frm.slStatus,"Status"))
	return false;
	else
	return true;
}

function chkAddTrainingSession(frm,isEdit)
{
	if(!notEmpty(frm.txtSession,"Training Session Name"))
	return false;
	/* if(!notSelected(frm.txtStrengths,"Strengths"))
	return false;
	if(!notSelected(frm.txtEstimatedRate,"Estimated Rate"))
	return false;
	if(!notSelected(frm.txtNotes,"Note"))
	return false;*/
	if(!notSelected(frm.slStatus,"Status"))
	return false;
	else
	return true;
}

function chkQuickSearchFront(frm)
{
	if(!frm.txtQckSearch.value && !frm.slCarType.value)
	{
		alert('Please select atleast one option!');
		return false;
	}
	else
	return true;
}

function chkQuickSearchTwo(frm)
{
	if(!notSelected(frm.slOpt,"Option"))
		return false;
	if(!notEmpty(frm.keyword,"Search Keyword"))
		return false;
	else
		return true;
}

function notChecked(obj,msg)
{
	var passObj = obj;
	var passMsg = msg;
	if(passObj.checked == false)
	{
		alert(msg);
		passObj.focus();
		return false;
	}
	return true;
}

function notEmptyFocus(obj,msg)
{
	var passObj = obj;
	var passMsg = msg;
	if(!passObj.value)
	{
		alert('Please enter a value for ' + msg + ' Field !!');
		return false;
	}
	return true;
}

function notEmpty(obj,msg)
{
	var passObj = obj;
	var passMsg = msg;
	if(!passObj.value)
	{
		alert('Please enter a value for ' + msg + ' Field !!');
		passObj.focus();
		return false;
	}
	return true;
}

function notCurrency(obj,msg)
{
	var passObj = obj.value;
	var passMsg = msg;
	var checkOK = "1234567890.";
	var matched = 0;
	for (p = 0;  p < passObj.length;  p++)
	{
		matched = 0;
		for (j = 0;  j < checkOK.length;  j++)
		{
			if(passObj.charAt(p) == checkOK.charAt(j))
			{
			matched = 1;
			break;
			}
		}
		if(matched==0)
		{
			alert("Please enter a valid " + msg);
			obj.focus();
			return false;
		}
	}
	return true;
}

function notNumber(obj,msg)
{
	var passObj = obj.value;
	var passMsg = msg;
	var checkOK = "1234567890";
	var matched = 0;
	for (p = 0;  p < passObj.length;  p++)
	{
		matched = 0;
		for (j = 0;  j < checkOK.length;  j++)
		{
			if(passObj.charAt(p) == checkOK.charAt(j))
			{
			matched = 1;
			break;
			}
		}
		if(matched==0)
		{
			alert("Please enter a valid " + msg);
			obj.focus();
			return false;
		}
	}
	return true;
}

function notPosNumber(obj,msg)
{
	var passObj = obj.value;
	var passMsg = msg;
	var checkOK = "1234567890";
	var matched = 0;
	for (p = 0;  p < passObj.length;  p++)
	{
		matched = 0;
		for (j = 0;  j < checkOK.length;  j++)
		{
			if(passObj.charAt(p) == checkOK.charAt(j))
			{
			matched = 1;
			break;
			}
		}
		if(matched==0)
		{
			alert("Please enter a valid " + msg);
			obj.focus();
			return false;
		}
	}
	if(passObj <= 0)
	{
			alert("Please enter a valid " + msg);
			obj.focus();
			return false;
	}
	return true;
}

function notPhone(obj,msg)
{
	var passObj = obj.value;
	var passMsg = msg;
	var checkOK = "1234567890-()+ ";
	var matched = 0;
	for (p = 0;  p < passObj.length;  p++)
	{
		matched = 0;
		for (j = 0;  j < checkOK.length;  j++)
		{
			if(passObj.charAt(p) == checkOK.charAt(j))
			{
			matched = 1;
			break;
			}
		}
		if(matched==0)
		{
			alert("Please enter a valid " + msg);
			obj.focus();
			return false;
		}
	}
	return true;
}

function notCompare(obj,secobj,msg)
{
	var passObj = obj;
	var passObjSec = secobj;
	var passMsg = msg;
	if(passObj.value != passObjSec.value)
	{
		alert(msg);
		passObjSec.focus();
		return false;
	}
	return true;
}
function notSelected(obj,msg)
{
	var passObj = obj;
	var passMsg = msg;
	if(!passObj.value)
	{
		alert('Please select a value for ' + msg + ' Field !!');
		passObj.focus();
		return false;
	}
	return true;
}


function noFileSelected(obj,msg)
{
	var passObj = obj;
	var passMsg = msg;
	if(!passObj.value)
	{
		alert('Please select ' + msg + ' !!');
		passObj.focus();
		return false;
	}
	return true;
}

function notRadioSelected(obj,msg)
{
	var passObj = obj;
	var passMsg = msg;
	var noOfEle = obj.length;
	var found = 0;
	
	for(i=0;i<noOfEle;i++)
	{
		if(obj[i].checked == true)
		{
			found = 1;
			break;
		}
	}
	if(found==0)
	{
		alert('Please select an option for ' + msg);
		return false;
	}
	return true;
}

////////////////////////////////////////////////////////////////////
// XML functions and AJAX things
////////////////////////////////////////////////////////////////////
var xmlHttp

function ldLargeImg(glrId)
{
	x = document.getElementById(glrId);
	x.style.display = '';
	
	
	return true;
}

function GetXmlHttpObject()
{ 
	var objXMLHttp=null;
	if(window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest();
	}
	else if(window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}

function fillGalleryDetails() 
{
	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		document.getElementById("lyrGallery").innerHTML = xmlHttp.responseText;
	}
} 

////////////////////////////////////////////////////////////////////
// menu functions
////////////////////////////////////////////////////////////////////
/*
function chkmouseover(passobj)
{
	x = document.getElementById(passobj);
	curX = findPosX(x);
	curY = findPosY(x);

	y = document.getElementById('menu' + passobj);

	y.style.display = '';

	if(navigator.appName == 'Microsoft Internet Explorer')
	{
		y.style.top = curY + 21;
		y.style.left = curX - 1;
	}
	else
	{
		y.style.top = curY + 25;
		y.style.left = curX + 0;
	}
}

function chkmouseout(passobj)
{
	y = document.getElementById('menu' + passobj);

	y.style.display = 'none';
}
*/
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function screenWidth()
{
	if (self.innerWidth)
	{
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		frameWidth = document.documentElement.clientWidth;
		frameHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	}
	return frameWidth;
}

function screenHeight()
{
	if (self.innerWidth)
	{
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		frameWidth = document.documentElement.clientWidth;
		frameHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	}
	return frameHeight;
}

function showImage()
{
	setTimeout("showImageFinal()", 500);
}

function showImageFinal(comid)
{
	x = document.getElementById("notshown");
	x.src = "../images/mainbackground.jpg";
	return true;
}

    function update(date,course,times,loc)
{

var value=document.getElementById(course).value;
if(value=="MYOB Basic")
{
    document.getElementById(date).value='<?php echo $value; ?>';
    document.getElementById(times).value='<?php echo $btime; ?>';
    document.getElementById(loc).value='<?php echo $bloc; ?>';
}
else if(value=="MYOB Intermediate")
{


    document.getElementById(date).value='<?php echo $idate; ?>';
    document.getElementById(times).value='<?php echo $itime; ?>';
    document.getElementById(loc).value='<?php echo $iloc; ?>';
}
else if(value=="MYOB Advanced")
{


    document.getElementById(date).value='<?php echo $adate; ?>';
    document.getElementById(times).value='<?php echo $atime; ?>';
    document.getElementById(loc).value='<?php echo $aloc; ?>';
}

else if(value=="Advanced Excel")
{


    document.getElementById(date).value='<?php echo $edate; ?>';
    document.getElementById(times).value='<?php echo $etime; ?>';
    document.getElementById(loc).value='<?php echo $eloc; ?>';
}

else if(value=="Job Seeking")
{


    document.getElementById(date).value='<?php echo $jdate; ?>';
    document.getElementById(times).value='<?php echo $jtime; ?>';
    document.getElementById(loc).value='<?php echo $jloc; ?>';
}


else if(value=="QuickBooks")
{


    document.getElementById(date).value='<?php echo $qdate; ?>';
    document.getElementById(times).value='<?php echo $qtime; ?>';
    document.getElementById(loc).value='<?php echo $qloc; ?>';
}
}

