
// Copyright 2005 Pixiesoft (www.pixiesoft.com). All Rights Reserved to Pixiesoft. 
// Do not copy and/or share and/or change and/or give and/or show and/or distribute without a written permission from Pixiesoft.



function CloseAllCombos(){
	showhide(0,document.all["innermenu_searchField"]);
	showhide(0,document.all["innermenu_searchArea"]);
	showhide(0,document.all["innermenu_searchCity"]);
	showhide(0,document.all["innermenu_searchBelongsTo"]);

}


function HideCombo(obj,btnName){
	if (obj.id!="innermenu_" + btnName) {if (document.all["innermenu_" + btnName]) document.all["innermenu_" + btnName].style.visibility="hidden"};
}

function showhide(state,obj){
	if (!obj) {return}
	var cacheobj=obj.style;
	if (state==0){
		if (cacheobj.visibility!="hidden") {cacheobj.visibility="hidden"} else {};}
	else{
		if (cacheobj.visibility=="hidden"){			
			HideCombo(obj,"searchField");
			HideCombo(obj,"searchArea");
			HideCombo(obj,"searchCity");
			HideCombo(obj,"searchBelongsTo");

			cacheobj.visibility="visible";			
			}
		else{
			cacheobj.visibility="hidden"
			}
		}
}

function GetCombo(name,width,currentValue,defaultValue,array,elmStyle){
	var currentValueName='';
	var temp='<img height=14 src="/images/SelectionBoxButton' + (name=='searchCity' || name=='searchBelongsTo'?'2':'3') + '.gif"';
	temp+=' style="cursor:default"></td></tr></table>';
	temp+='<div id="innermenu_' + name + '" style="position:absolute;z-index:9999;left:0;top:18;height:250px;width:250px;border:1px solid black;background-color:white;overflow-y:auto;visibility:hidden;direction:ltr"><table cellpadding=0 cellspacing=0 width="100%" height="100%" dir=rtl><tr>';
	temp+= '<td valign="top"><table width="100%" cellpadding="1" cellspacing="0" style="color:black;font-size:12px;">';

	temp += '<tr><td align="center" bgcolor="#f2f2f2" style="cursor:default;border:1px solid #f2f2f2;border-bottom:1px solid black" onMouseOver="this.style.border=\'1px solid black\';this.style.backgroundColor=\'#EEEEEE\'" onMouseOut="this.style.border=\'1px solid #f2f2f2\';this.style.backgroundColor=\'f2f2f2\';this.style.borderBottom=\'1px solid black\'" onClick="document.all(\'' + name + '_\').innerHTML=\'<nobr>';
	temp += defaultValue;
	temp+='<\/nobr>\';document.all(\''  + name + '\').value=\'';
	temp+='remove';
	temp+='\';" unselectable="on" onselectstart="return false;" oncontextmenu="return false;">';
	temp+=defaultValue;
	temp+='</td></tr>'; 

	for (var x in array) {
		temp += '<tr><td ';
		temp += 'style="';
		temp+='cursor:default;border:1px solid #f2f2f2;' + elmStyle + '" onMouseOver="this.style.border=\'1px solid black\';this.style.backgroundColor=\'#EEEEEE\'" onMouseOut="this.style.border=\'1px solid #f2f2f2\';this.style.backgroundColor=\'white\'" onClick="document.all(\'' + name + '_\').innerHTML=unescape(\'<nobr>' + escape(x) + '<\/nobr>';
		temp+='\');document.all(\'' + name + '\').value=unescape(\'' + escape(array[x]);
		temp+='\');" unselectable="on" onselectstart="return false;" oncontextmenu="return false;">';
		temp+=x;
		temp+='</td></tr>'; 
		if (currentValue && array[x]==currentValue) {currentValueName=x}
	}

	if (currentValueName=='') currentValueName=defaultValue
	temp='<input type=hidden name="' + name + '" id="' + name + '" value="' + currentValue + '"><div style="background-color:white;position:relative;z-index:9999;width:' + width + 'px;height:14px;border:1px solid silver;padding:1px;margin-left:2px;margin-right:2px" onMouseOver="this.style.border=\'1px solid gray\'" onMouseOut="this.style.border=\'1px solid silver\'" onClick="if (!document.all[\'' + name + '_\'].disabled) {showhide(1,document.all[\'innermenu_' + name + '\']);event.cancelBubble=true}"><table width="100%" cellpadding=0 cellspacing=0 style="tableLayout:fixed"><tr><td nowarp><span style="width:100%;height:14px;font-family:Arial;font-size:12px;overflow:hidden;cursor:default;" unselectable="on" onselectstart="return false;" oncontextmenu="return false;" id="' + name + '_"><nobr>' + currentValueName + '</nobr></span></td><td align=right width="11">'+temp;
	temp+='</table></div></td></tr></table></div>';

	return temp
}


