﻿function SearchParamsChangeVisibility(obj)
{	
	if(obj.style.display == "block") {
		obj.style.display = "none";
		document.getElementById('searchparamshref').innerHTML = 'Изменить параметры поиска';
	} 
	else {
		obj.style.display = "block";
		document.getElementById('searchparamshref').innerHTML = 'Спрятать параметры поиска';
	}
}

function SearchParamsChangeVisibility(visibleControlName, invisibleLinkName)
{	
    if (document.getElementById('fastsearchparams') != null)
        document.getElementById('fastsearchparams').style.display = "none";
    if (document.getElementById('searchparams') != null)
        document.getElementById('searchparams').style.display = "none";
    if (document.getElementById(visibleControlName) != null)
        document.getElementById(visibleControlName).style.display = "block";
    
    if (document.getElementById('fastsearchparamshref') != null)
    if (document.getElementById('fastsearchparamshref') != null)
        document.getElementById('fastsearchparamshref').style.display = "inline";
    if (document.getElementById('searchparamshref') != null)
        document.getElementById('searchparamshref').style.display = "inline";
    if (document.getElementById('hidesearchparamshref') != null)    
        document.getElementById('hidesearchparamshref').style.display = "inline";
    if (document.getElementById(invisibleLinkName) != null)
        document.getElementById(invisibleLinkName).style.display = "none";
}

// ============= BEGIN : palette work =====================
function showPalette(evt) {
	evt = evt || window.event;
	evt.cancelBubble = true;
	
	var bodyWidth = (window.innerWidth) ? window.innerWidth : window.document.body.clientWidth;
	document.getElementById("forSelectColor").src = "colorPalette.html";
	document.getElementById("forSelectColor").style.left = (bodyWidth - 350) / 2;
	document.getElementById("forSelectColor").style.width = 200;
	document.getElementById("forSelectColor").style.height = 250;
	document.getElementById("forSelectColor").style.display = "";
}

function hidePalette() {
	document.getElementById("forSelectColor").style.display = "none";
}

function setCarColor(color) {
	document.getElementById("target_td").innerHTML = "<img src='/images/0.gif' width=18 height=18 style='background-color: " + color + ";' style='float:left;margin-RIGHT: 5px;'><a onclick=\"showPalette(event);return false;\" href=\"\">Изменить</a>";
	if (color && color.length) document.getElementById("colour").value = color;
}
// ============= END : palette work =======================
