function showTab(tab)
{
	if(tab == 'tech')
	{
		document.getElementById('tabNav').style.backgroundImage = "url('"+Image1.src+"')";
		document.getElementById('techLink').style.color='#103d51';	
		document.getElementById('imageLink').style.color='#717273';	
		document.getElementById('diplayMainImage').src = ImageTech.src;	
		document.getElementById('pMainImageLink').style.display = 'none';
		document.getElementById('pMainImageLinkTech').style.display = '';
	}
	else
	{
		document.getElementById('tabNav').style.backgroundImage = "url('images/global/bg_tabImage-trans.png')";
		document.getElementById('imageLink').style.color='#103d51';	
		document.getElementById('techLink').style.color='#717273';	
		document.getElementById('diplayMainImage').src = ImageMain.src;	
		document.getElementById('pMainImageLink').style.display = '';
		document.getElementById('pMainImageLinkTech').style.display = 'none';
	}
}

function checkColour(tab)
{
	var sTest;
	sTest = document.getElementById('tabNav').style.backgroundImage;
	 
	if(tab == 'tech')
	{
		if(sTest.indexOf("bg_tabTech.png") >= 0)
		{
			document.getElementById('techLink').style.color='#103d51';	
		}
		else
		{
			document.getElementById('techLink').style.color='#000000';	
		
		}
	}
	else
	{
		if(sTest.indexOf("bg_tabTech.png") >= 0)
		{
			document.getElementById('imageLink').style.color='#000000';	
		}
		else
		{
			document.getElementById('imageLink').style.color='#103d51';	
		
		}
	}
}

function setColour(tab)
{
	var sTest;
	sTest = document.getElementById('tabNav').style.backgroundImage;

	if(tab == 'tech')
	{
		if(sTest.indexOf("bg_tabTech.png") >= 0)
		{
			document.getElementById('techLink').style.color='#103d51';	
		}
		else
		{
			document.getElementById('techLink').style.color='#717273';
		}		
	}
	else
	{
		if(sTest.indexOf("bg_tabTech.png") >= 0)
		{
			document.getElementById('imageLink').style.color='#717273';	
		}
		else
		{
			document.getElementById('imageLink').style.color='#103d51';
		}		
	}
}

function validate() {

	if (document.getElementById('storeState').value == '') {
        alert('You must select a State');
        document.getElementById('storeState').focus();
        return false;
    }
	if (document.getElementById('storeList').value == '') {
        alert('You must select a Store');
        document.getElementById('storeList').focus();
        return false;
    }
	if (document.getElementById('FirstName').value == '') {
        alert('You must enter your First Name');
        document.getElementById('FirstName').focus();
        return false;
    }
	if (document.getElementById('FirstName').value == '') {
        alert('You must enter your First Name');
        document.getElementById('FirstName').focus();
        return false;
    }
	if (document.getElementById('LastName').value == '') {
        alert('You must enter your Last Name');
        document.getElementById('LastName').focus();
        return false;
    }
	if (document.getElementById('Email').value == '') {
        alert('Please enter your Email Address');
        document.getElementById('Email').focus();
        return false;
    }
	if (document.getElementById('Enquiry').value == '') {
        alert('You have not entered your enquiry');
        document.getElementById('Enquiry').focus();
        return false;
    }
	if (document.getElementById('Profession').value == 'Retailer') {
		if (document.getElementById('RetailerDetail').value == '') {
			alert("Please Specify your Shop");
			document.getElementById('RetailerDetail').focus();
        	return false;
    	}
    }
	if (document.getElementById('Profession').value == 'Other') {
		if (document.getElementById('OtherDetail').value == '') {
			alert("Please Specify your Profession");
			document.getElementById('OtherDetail').focus();
        	return false;
    	}
    }
	return true;
}

function validateWish() {

	if (document.getElementById('storeState').value == '') {
        alert('You must select a State');
        document.getElementById('storeState').focus();
        return false;
    }
	if (document.getElementById('storeList').value == '') {
        alert('You must select a Store');
        document.getElementById('storeList').focus();
        return false;
    }
	if (document.getElementById('FirstName').value == '') {
        alert('You must enter your First Name');
        document.getElementById('FirstName').focus();
        return false;
    }
	if (document.getElementById('FirstName').value == '') {
        alert('You must enter your First Name');
        document.getElementById('FirstName').focus();
        return false;
    }
	if (document.getElementById('LastName').value == '') {
        alert('You must enter your Last Name');
        document.getElementById('LastName').focus();
        return false;
    }
	if (document.getElementById('Email').value == '') {
        alert('Please enter your Email Address');
        document.getElementById('Email').focus();
        return false;
    }
	return true;
}

function goLogin()
{
	document.getElementById("doLogin").submit();
}
function goForgotten()
{
	document.getElementById("doForgotten").submit();
}
function confirmDeleteType(tID)
{
  	var answer = confirm ("Are you sure you wish to delete this Product Type?")
	if(answer)
	{
		document.location = ("deleteType.php?id="+tID); 
  	}

}
function confirmDeleteBrand(bID)
{
  	var answer = confirm ("Are you sure you wish to delete this Brand?")
	if(answer)
	{
		document.location = ("deleteBrand.php?id="+bID); 
  	}

}
function confirmDeleteRange(rID)
{
  	var answer = confirm ("Are you sure you wish to delete this Range?")
	if(answer)
	{
		document.location = ("deleteRange.php?id="+rID); 
  	}

}
function confirmDeleteStore(sID)
{
  	var answer = confirm ("Are you sure you wish to delete this Store?")
	if(answer)
	{
		document.location = ("deleteStore.php?id="+sID); 
  	}

}
function confirmDeleteProduct(pID)
{
  	var answer = confirm ("Are you sure you wish to delete this Product?")
	if(answer)
	{
		document.location = ("deleteProduct.php?id="+pID); 
  	}

}
function confirmDeleteAdminUser(uID)
{
  	var answer = confirm ("Are you sure you wish to delete this Admin User?")
	if(answer)
	{
		document.location = ("deleteUser.php?id="+uID); 
  	}

}
function validateStore() {

	if (document.getElementById('storeName').value == '') {
        alert('You must enter a Name');
        document.getElementById('storeName').focus();
        return false;
    }
	if (document.getElementById('storeAddress').value == '') {
        alert('You must enter the Address of the store');
        document.getElementById('storeAddress').focus();
        return false;
    }
	if (document.getElementById('storeSuburb').value == '') {
        alert('You must enter the Suburb of the store');
        document.getElementById('storeSuburb').focus();
        return false;
    }
	if (document.getElementById('storeState').value == '') {
        alert('You must select the State of the store');
        document.getElementById('storeState').focus();
        return false;
    }
	if (document.getElementById('storePostcode').value == '') {
        alert('You must enter the Postcode of the store');
        document.getElementById('storePostcode').focus();
        return false;
    }
	if (document.getElementById('storePhone').value == '') {
        alert('You must enter the Phone Number of the store');
        document.getElementById('storePhone').focus();
        return false;
    }
	if (document.getElementById('storeUsername').value == '') {
        alert('You must enter a Username');
        document.getElementById('storeUsername').focus();
        return false;
    }
	if (document.getElementById('storePassword').value == '') {
        alert('You must enter a Password');
        document.getElementById('storePassword').focus();
        return false;
    }
	if (document.getElementById('storePassword2').value == '') {
        alert('You must re-enter the Password');
        document.getElementById('storePassword2').focus();
        return false;
    }
	if (document.getElementById('storePassword').value != document.getElementById('storePassword2').value) {
        alert('The passwords do not match.');
        document.getElementById('storePassword').focus();
        return false;
    }
	return true;
}

function showItem(sItem)
{
	document.getElementById(sItem).style.display = '';
}

function validateAdminUser() {

	if (document.getElementById('Name').value == '') {
        alert('You must enter a Name');
        document.getElementById('Name').focus();
        return false;
    }
	if (document.getElementById('Username').value == '') {
        alert('You must enter a Username');
        document.getElementById('Username').focus();
        return false;
    }
	if (document.getElementById('Password').value == '') {
        alert('You must enter a Password');
        document.getElementById('Password').focus();
        return false;
    }
	if (document.getElementById('Password2').value == '') {
        alert('You must re-enter the Password');
        document.getElementById('Password2').focus();
        return false;
    }
	if (document.getElementById('Password').value != document.getElementById('Password2').value) {
        alert('The passwords do not match.');
        document.getElementById('Password').focus();
        return false;
    }
	return true;
}

function validateAdminUserUpdate() {

	if (document.getElementById('Name').value == '') {
        alert('You must enter a Name');
        document.getElementById('Name').focus();
        return false;
    }
	if (document.getElementById('Username').value == '') {
        alert('You must enter a Username');
        document.getElementById('Username').focus();
        return false;
    }
	if (document.getElementById('newPassword').value != document.getElementById('newPassword2').value) {
        alert('The passwords do not match.');
        document.getElementById('newPassword').focus();
        return false;
    }
	return true;
}

function validateProduct() {

	if (document.getElementById('productName').value == '') {
        alert('You must enter a Name');
        document.getElementById('productName').focus();
        return false;
    }
	if (document.getElementById('productCode').value == '') {
        alert('You must enter a the Product Code');
        document.getElementById('productCode').focus();
        return false;
    }
	if ( (document.getElementById('productType').value == '') && (document.getElementById('newType').value == '') )
	{
        alert('You must enter the Product Type');
        document.getElementById('productType').focus();
        return false;
	}
	if ( (document.getElementById('productBrand').value == '') && (document.getElementById('newBrand').value == '') )
	{
        alert('You must enter the Product Brand');
        document.getElementById('productBrand').focus();
        return false;
	}
	if ( (document.getElementById('productRange').value == '') && (document.getElementById('newRange').value == '') )
	{
        alert('You must enter the Product Range');
        document.getElementById('productRange').focus();
        return false;
	}
	if (document.getElementById('wels').value == '') {
        alert('You must enter the WELS Rating');
        document.getElementById('wels').focus();
        return false;
    }
	if (document.getElementById('retail').value == '') {
        alert('You must enter the Retail Price.');
        document.getElementById('retail').focus();
        return false;
    }
	if (document.getElementById('wholesale').value == '') {
        alert('You must enter the Wholesale Price.');
        document.getElementById('wholesale').focus();
        return false;
    }
	return true;
}

