//Homepage Functions Set 1
function preloadhomepageimages(base) {
    picture=new Image;
    picture.src="images/heading_seperator_first_off.jpg";
    picture.src="images/heading_seperator_last_on.jpg";
    picture.src="images/heading_seperator_right_on.jpg";
    picture.src="images/heading_seperator_left_on.jpg";
}

function engineeringtabhover() {
    document.getElementById("headerengineering").style.backgroundImage="";
	document.getElementById("headerengineering").style.backgroundColor="#f6f6f6";
	document.getElementById("headerengineering").style.color="#000";
	document.getElementById("headerindustry").style.backgroundColor="";
	document.getElementById("headerindustry").style.color="#fff";
	document.getElementById("headerbrandname").style.backgroundColor="";
	document.getElementById("headerbrandname").style.color="#fff";
	document.getElementById("headercompanies").style.backgroundColor="";
	document.getElementById("headercompanies").style.color="#fff";
	
	document.getElementById("content10").src="images/heading_seperator_first_on.jpg";
	document.getElementById("content11").src="images/heading_seperator_left_on.jpg";
	document.getElementById("content12").src="images/heading_seperator.jpg";
	document.getElementById("content13").src="images/heading_seperator.jpg";
	document.getElementById("content14").src="images/heading_seperator_last_off.jpg";
}
function engineeringover()
{
	document.getElementById("headerengineering").style.textDecoration="underline";
	document.getElementById("headerengineering").style.cursor="pointer";
	engineeringdown();
}
function engineeringout()
{
	document.getElementById("headerengineering").style.textDecoration="";
	document.getElementById("headerengineering").style.cursor="";
}
function engineeringdown()
{
    engineeringtabhover();
    document.getElementById("displayengineering").style.display="block";
    document.getElementById("displayindustry").style.display="none";
    document.getElementById("displaybrandname").style.display="none";
    document.getElementById("displaycompanies").style.display="none";
    curtab1 = 0;
}

function industrytabhover() {
	document.getElementById("headerengineering").style.backgroundImage="url(images/heading_spacer.jpg)";
	document.getElementById("headerengineering").style.color="#fff";
	document.getElementById("headerindustry").style.backgroundColor="#f6f6f6";
	document.getElementById("headerindustry").style.color="#000";
	document.getElementById("headerbrandname").style.backgroundColor="";
	document.getElementById("headerbrandname").style.color="#fff";
	document.getElementById("headercompanies").style.backgroundColor="";
	document.getElementById("headercompanies").style.color="#fff";
	
	document.getElementById("content10").src="images/heading_seperator_first_off.jpg";
	document.getElementById("content11").src="images/heading_seperator_right_on.jpg";
	document.getElementById("content12").src="images/heading_seperator_left_on.jpg";
	document.getElementById("content13").src="images/heading_seperator.jpg";
	document.getElementById("content14").src="images/heading_seperator_last_off.jpg";
}
function industryover()
{
	document.getElementById("headerindustry").style.textDecoration="underline";
	document.getElementById("headerindustry").style.cursor="pointer";
	industrydown();
}
function industryout()
{
	document.getElementById("headerindustry").style.textDecoration="";
	document.getElementById("headerindustry").style.cursor="";
}
function industrydown()
{
    industrytabhover();
    document.getElementById("displayengineering").style.display="none";
    document.getElementById("displayindustry").style.display="block";
    document.getElementById("displaybrandname").style.display="none";
    document.getElementById("displaycompanies").style.display="none";
    curtab1 = 1;
}

function brandnametabhover() {
	document.getElementById("headerengineering").style.backgroundImage="url(images/heading_spacer.jpg)";
	document.getElementById("headerengineering").style.color="#fff";
	document.getElementById("headerindustry").style.backgroundColor="";
	document.getElementById("headerindustry").style.color="#fff";
	document.getElementById("headerbrandname").style.backgroundColor="#f6f6f6";
	document.getElementById("headerbrandname").style.color="#000";
	document.getElementById("headercompanies").style.backgroundColor="";
	document.getElementById("headercompanies").style.color="#fff";
	
	document.getElementById("content10").src="images/heading_seperator_first_off.jpg";
	document.getElementById("content11").src="images/heading_seperator.jpg";
	document.getElementById("content12").src="images/heading_seperator_right_on.jpg";
	document.getElementById("content13").src="images/heading_seperator_left_on.jpg";
	document.getElementById("content14").src="images/heading_seperator_last_off.jpg";
}
function brandnameover()
{
    brandnamedown();
	document.getElementById("headerbrandname").style.textDecoration="underline";
	document.getElementById("headerbrandname").style.cursor="pointer";
}
function brandnameout()
{
	document.getElementById("headerbrandname").style.textDecoration="";
	document.getElementById("headerbrandname").style.cursor="";
}
function brandnamedown()
{
    brandnametabhover();
	document.getElementById("displayengineering").style.display="none";
	document.getElementById("displayindustry").style.display="none";
	document.getElementById("displaybrandname").style.display="block";
	document.getElementById("displaycompanies").style.display="none";
	curtab1 = 2;
}

function companieshovertab() {
	document.getElementById("headerengineering").style.backgroundImage="url(images/heading_spacer.jpg)";
	document.getElementById("headerengineering").style.color="#fff";
	document.getElementById("headerindustry").style.backgroundColor="";
	document.getElementById("headerindustry").style.color="#fff";
	document.getElementById("headerbrandname").style.backgroundColor="";
	document.getElementById("headerbrandname").style.color="#fff";
	document.getElementById("headercompanies").style.backgroundColor="#f6f6f6";
	document.getElementById("headercompanies").style.color="#000";
	
	document.getElementById("content10").src="images/heading_seperator_first_off.jpg";
	document.getElementById("content11").src="images/heading_seperator.jpg";
	document.getElementById("content12").src="images/heading_seperator.jpg";
	document.getElementById("content13").src="images/heading_seperator_right_on.jpg";
	document.getElementById("content14").src="images/heading_seperator_last_on.jpg";
}
function companiesover()
{  
    companiesdown();
	document.getElementById("headercompanies").style.textDecoration="underline";
	document.getElementById("headercompanies").style.cursor="pointer";
}
function companiesout()
{
	document.getElementById("headercompanies").style.textDecoration="";
	document.getElementById("headercompanies").style.cursor="";
}
function companiesdown()
{
	companieshovertab();
	document.getElementById("displayengineering").style.display="none";
	document.getElementById("displayindustry").style.display="none";
	document.getElementById("displaybrandname").style.display="none";
	document.getElementById("displaycompanies").style.display="block";
	curtab1 = 3;
}

//Homepage Functions Set 2
function pronewstabhover() {
	document.getElementById("headerpronews").style.backgroundImage="";
	document.getElementById("headerpronews").style.backgroundColor="#f6f6f6";
	document.getElementById("headerpronews").style.color="#000";
	document.getElementById("headerpopular").style.backgroundColor="";
	document.getElementById("headerpopular").style.color="#fff";
	
	document.getElementById("content20").src="images/heading_seperator_first_on.jpg";
	document.getElementById("content21").src="images/heading_seperator_left_on.jpg";
	document.getElementById("content22").src="images/heading_seperator_last_off.jpg";
}
function pronewsover()
{
    pronewsdown();
	document.getElementById("headerpronews").style.textDecoration="underline";
	document.getElementById("headerpronews").style.cursor="pointer";
}
function pronewsout()
{
	document.getElementById("headerpronews").style.textDecoration="";
	document.getElementById("headerpronews").style.cursor="";
}
function pronewsdown()
{
    pronewstabhover();
    document.getElementById("displaypronews").style.display="block";
    document.getElementById("displaypopular").style.display="none";
}


function popularhovertab() {
	document.getElementById("headerpronews").style.backgroundImage="url(images/heading_spacer.jpg)";
	document.getElementById("headerpronews").style.color="#fff";	
	document.getElementById("headerpopular").style.backgroundColor="#f6f6f6";
	document.getElementById("headerpopular").style.color="#000";
	
	document.getElementById("content20").src="images/heading_seperator_first_off.jpg";
	document.getElementById("content21").src="images/heading_seperator_right_on.jpg";
	document.getElementById("content22").src="images/heading_seperator_last_on.jpg";
}
function popularover()
{
    populardown();
	document.getElementById("headerpopular").style.textDecoration="underline";
	document.getElementById("headerpopular").style.cursor="pointer";
}
function popularout()
{
	document.getElementById("headerpopular").style.textDecoration="";
	document.getElementById("headerpopular").style.cursor="";
}
function populardown()
{
    popularhovertab();
    document.getElementById("displaypronews").style.display="none";
    document.getElementById("displaypopular").style.display="block";
}

//Main Navigation Dropdown
function dropdowndown()
{
	document.getElementById("dropdown").style.display="block";
}

function dropdownout()
{
	document.getElementById("dropdown").style.display="none";
}

//Advertisers Functions
function displayadvert(root,advertimage,name)
{
	if (document.getElementById(name).style.display == "block" || document.getElementById(name).style.display == "") {
		document.getElementById(name).style.display="none";
		document.getElementById(advertimage).src=root+"/images/header_arrow_down.jpg";
	} else {
		document.getElementById(name).style.display = "block";
		document.getElementById(advertimage).src=root+"/images/header_arrow_up.jpg";
	}
}

//Upgrade Manager Functions
function displayupgrade1()
{
	if( document.getElementById("upgrademanager1").style.display == "block"){
		
		document.getElementById("upgrademanager1").style.display="none";
		document.getElementById("upgrademanager1main").style.display="block";
		document.getElementById("upgrade1image").src="images/header_arrow_down.jpg";
		
	} else {
		
		document.getElementById("upgrademanager1").style.display="block";
		document.getElementById("upgrademanager1main").style.display="none";
		document.getElementById("upgrade1image").src="images/header_arrow_up.jpg";
		
	}
}
function displayupgrade2()
{
	if( document.getElementById("upgrademanager2").style.display == "block"){
		
		document.getElementById("upgrademanager2").style.display="none";
		document.getElementById("upgrade2image").src="images/header_arrow_down.jpg";
		
	} else {
		
		document.getElementById("upgrademanager2").style.display="block";
		document.getElementById("upgrade2image").src="images/header_arrow_up.jpg";
		
	}
}
function displayupgrade3()
{
	if( document.getElementById("upgrademanager3").style.display == "block"){
		
		document.getElementById("upgrademanager3").style.display="none";
		document.getElementById("upgrade3image").src="images/header_arrow_down.jpg";
		
	} else {
		
		document.getElementById("upgrademanager3").style.display="block";
		document.getElementById("upgrade3image").src="images/header_arrow_up.jpg";
		
	}
}

//Search Functions
function displayrefinesearch()
{
	if( document.getElementById("refineyoursearch").style.display == "block"){
		
		document.getElementById("refineyoursearch").style.display="none";
		document.getElementById("refinesearch1image").src="images/header_arrow_down.jpg";
		
	} else {
		
		document.getElementById("refineyoursearch").style.display="block";
		document.getElementById("refinesearch1image").src="images/header_arrow_up.jpg";
		
	}
}
function displayrefineproducts()
{
	if( document.getElementById("refineproducts").style.display == "block"){
		
		document.getElementById("refineproducts").style.display="none";
		document.getElementById("refineproductsimage").src="images/add_icon.gif";
		
	} else {
		
		document.getElementById("refineproducts").style.display="block";
		document.getElementById("refineproductsimage").src="images/remove_icon.gif";
		
	}
}
function displayrefinebrandnames()
{
	if( document.getElementById("refinebrandnames").style.display == "block"){
		
		document.getElementById("refinebrandnames").style.display="none";
		document.getElementById("refinebrandnamesimage").src="images/add_icon.gif";
		
	} else {
		
		document.getElementById("refinebrandnames").style.display="block";
		document.getElementById("refinebrandnamesimage").src="images/remove_icon.gif";
		
	}
}
function displayrefinecountry()
{
	if( document.getElementById("refinecountry").style.display == "block"){
		
		document.getElementById("refinecountry").style.display="none";
		document.getElementById("refinecountryimage").src="images/add_icon.gif";
		
	} else {
		
		document.getElementById("refinecountry").style.display="block";
		document.getElementById("refinecountryimage").src="images/remove_icon.gif";
		
	}
}
function displayrefineindustry()
{
	if( document.getElementById("refineindustry").style.display == "block"){
		
		document.getElementById("refineindustry").style.display="none";
		document.getElementById("refineindustryimage").src="images/add_icon.gif";
		
	} else {
		
		document.getElementById("refineindustry").style.display="block";
		document.getElementById("refineindustryimage").src="images/remove_icon.gif";
		
	}
}

function productsdddown()
{
	document.getElementById("productsdd").style.display="block";
}
function productsddout()
{
	document.getElementById("productsdd").style.display="none";
}

function langdown()
{
	document.getElementById("langdd").style.display="block";
}
function langout()
{
	document.getElementById("langdd").style.display="none";
}

function brandnamesdddown()
{
	document.getElementById("brandnamesdd").style.display="block";
}
function brandnamesddout()
{
	document.getElementById("brandnamesdd").style.display="none";
}

function countrydddown()
{
	document.getElementById("countrydd").style.display="block";
}
function countryddout()
{
	document.getElementById("countrydd").style.display="none";
}

function industrydddown()
{
	document.getElementById("industrydd").style.display="block";
}
function industryddout()
{
	document.getElementById("industrydd").style.display="none";
}

//Listing Functions
function editdisplay()
{
	document.getElementById("contentedit").style.display="block";
}
function edithide()
{
	document.getElementById("contentedit").style.display="none";
}
//Remove search text
function highlight(txt,sterm) {
    if (txt.value == sterm) {
        txt.value = "";
    } else {
        txt.select();
    }
}

function changesubmitmethod(newmethod,newaction) {
    var frm;
    if (document.getElementById) if (!frm) frm = document.getElementById('aspnetForm');
    if (!frm) { frm = document.aspnetForm; }
    if (document.getElementById('__VIEWSTATE')) {
        (document.getElementById('__VIEWSTATE')).parentNode.innerHTML = "";
    }
    if (document.getElementById('__VSTATE')) {
        (document.getElementById('__VSTATE')).parentNode.innerHTML = "";
    }
    if (document.getElementById('__EVENTTARGET')) {
        (document.getElementById('__EVENTTARGET')).parentNode.innerHTML = "";
    }
    if (document.getElementById('__EVENTARGUMENT')) {
        (document.getElementById('__EVENTARGUMENT')).parentNode.innerHTML = "";
    }
    if (document.getElementById('__EVENTVALIDATION')) {
        (document.getElementById('__EVENTVALIDATION')).parentNode.innerHTML = "";
    }
    frm.method = newmethod;
    frm.action = newaction;
}

function hide(id) {
    document.getElementById(id).style.visibility = "hidden";
    document.getElementById(id).style.display = "none";
}
function display(id) {
    document.getElementById(id).style.visibility = "visible";
    document.getElementById(id).style.display = "block";
}
/*Colour picker*/
function listingcolorset(color,txtid) {
    document.getElementById('listingnavigation').originalcolor = document.getElementById('listingnavigation').style.backgroundColor;
    document.getElementById('listingnav').originalcolor = document.getElementById('listingnav').style.backgroundColor;
    document.getElementById(txtid).originalcolor = document.getElementById(txtid).value;
    document.getElementById('listingnavigation').style.backgroundColor = color;
    document.getElementById('listingnav').style.backgroundColor = color;
    document.getElementById(txtid).value = color;
}
function listingcolorrevert(txtid) {
    document.getElementById('listingnavigation').style.backgroundColor = document.getElementById('listingnavigation').originalcolor;
    document.getElementById('listingnav').style.backgroundColor = document.getElementById('listingnav').originalcolor;
    document.getElementById(txtid).value = document.getElementById(txtid).originalcolor;
}
function listingcolorsetforpost(txtid) {
    //Keep color when clicked
    document.getElementById('listingnavigation').originalcolor = document.getElementById('listingnavigation').style.backgroundColor;
    document.getElementById('listingnav').originalcolor = document.getElementById('listingnav').style.backgroundColor;
    document.getElementById(txtid).originalcolor = document.getElementById(txtid).value;
}
function removecheck(idchk) {
    var chk = document.getElementById(idchk);
    chk.checked = false;
}


