
function showIndexPhone(id)
{
    /*var oContent = oValue = null;
    if ((oContent = document.getElementById("IndexPhone_" + id)) && (oValue =  document.getElementById("IndexPhoneValue_" + id)))
    {
        oContent.innerHTML = oValue.innerHTML;*/     
        
        /*var oCounter = new Image();
        oCounter.src = "./ctr.asp?id=" + id + "&type=2";*/
        //var xmlDoc = dbsRequest("./ctr.asp?id=" + id + "&type=2");
        document.getElementById("ImageTemp").src = "./ctr.asp?id=" + id + "&type=2";
    //}
}

function showIndexMobile(id)
{
   /* var oContent = oValue = null;
    if ((oContent = document.getElementById("IndexMobile_" + id)) && (oValue =  document.getElementById("IndexMobileValue_" + id)))
    {
        oContent.innerHTML = oValue.innerHTML;*/     

        /*var oCounter = new Image();
        oCounter.src = "./ctr.asp?id=" + id + "&type=3";*/
        //var xmlDoc = dbsRequest("./ctr.asp?id=" + id + "&type=3");
        document.getElementById("ImageTemp2").src = "./ctr.asp?id=" + id + "&type=3";
    //}
}

function showIndexFax(id)
{
   /* var oContent = oValue = null;
    if ((oContent = document.getElementById("IndexFax_" + id)) && (oValue =  document.getElementById("IndexFaxValue_" + id)))
    {
        oContent.innerHTML = oValue.innerHTML;  */   

       /* var oCounter = new Image();
        oCounter.src = "./ctr.asp?id=" + id + "&type=4";*/
        //var xmlDoc = dbsRequest("./ctr.asp?id=" + id + "&type=4");
        document.getElementById("ImageTemp").src = "./ctr.asp?id=" + id + "&type=4";
    //}
}


function showIndexContactUs(id)
{
    /*var oContent = oValue = null;
    if ((oContent = document.getElementById("IndexPhone_" + id)) && (oValue =  document.getElementById("IndexPhoneValue_" + id)))
    {
        oContent.innerHTML = oValue.innerHTML;*/     
        
        /*var oCounter = new Image();
        oCounter.src = "./ctr.asp?id=" + id + "&type=1";*/
        //var xmlDoc = dbsRequest("./ctr.asp?id=" + id + "&type=1");
        document.getElementById("ImageTemp").src = "./ctr.asp?id=" + id + "&type=1";
    //}
}

function showIndexMobileContact(id)
{
   /* var oContent = oValue = null;
    if ((oContent = document.getElementById("IndexMobile_" + id)) && (oValue =  document.getElementById("IndexMobileValue_" + id)))
    {
        oContent.innerHTML = oValue.innerHTML;*/     

        /*var oCounter = new Image();
        oCounter.src = "./ctr.asp?id=" + id + "&type=5";*/
//        var xmlDoc = dbsRequest("./ctr.asp?id=" + id + "&type=5");
    //}
}

function showIndexFaxContact(id)
{
   /* var oContent = oValue = null;
    if ((oContent = document.getElementById("IndexFax_" + id)) && (oValue =  document.getElementById("IndexFaxValue_" + id)))
    {
        oContent.innerHTML = oValue.innerHTML;  */   

        /*var oCounter = new Image();
        oCounter.src = "./ctr.asp?id=" + id + "&type=6";*/
//        var xmlDoc = dbsRequest("./ctr.asp?id=" + id + "&type=6");
    //}
}

function showIndexLink(id)
{
    /*
    var oContent = oValue = null;
    if ((oContent = document.getElementById("IndexLink_" + id)) && (oValue =  document.getElementById("IndexLinkValue_" + id)))
    {
        oContent.innerHTML = oValue.innerHTML;     

        var oCounter = new Image();
        oCounter.src = "./ctr.asp?id=" + id + "&type=5";
    }
    */
    //var xmlDoc = dbsRequest("./ctr.asp?id=" + id + "&type=5");
    document.getElementById("ImageTemp").src = "./ctr.asp?id=" + id + "&type=5";
}

function showIndexCupon(id)
{
    //var xmlDoc = dbsRequest("./ctr.asp?id=" + id + "&type=6");
    document.getElementById("ImageTemp").src = "./ctr.asp?id=" + id + "&type=6";
}

function showIndexExtended(id, location_Link)
{
    //var xmlDoc = dbsRequest("./ctr.asp?id=" + id + "&type=7");
    document.getElementById("ImageTemp").src = "./ctr.asp?id=" + id + "&type=7";
    
    window.location = location_Link;
}

function fncChangeGroupA(oSelectGroupA)
{
	var GroupAID = oSelectGroupA.value;
	//alert((GroupAID+'').length);
	if(GroupAID!=null && (GroupAID+'').length>0)
	{
		fncShowFilterASelect(GroupAID,0)	
	}
	else
	{
		fncHideFilterASelect();
	}
}
function fncHideFilterASelect()
{
	var FilterASelect = document.getElementById('SelectedFilterA');
	if(FilterASelect!=null){FilterASelect.disabled=true;}

}

function fncShowFilterASelect(GroupAID,selectedFilterAID)
{
	var FilterASelect = document.getElementById('SelectedFilterA');
	var bFoundFilterAToGroupA = false; 
	var nSelectedIndex = 0;
	
	if(FilterASelect!=null)
	{
		
		if(arrFilterA!=null && arrFilterA.length>0)
		{	
			var newCounter = 1;
			
			FilterASelect.options.length = 1;
			var oOption;
			for(var i = 0;i<arrFilterA.length;i++)
			{
				//alert(arrFilterA[i].FilterAGroupID);
				if(''+arrFilterA[i].FilterAGroupID==''+GroupAID)
				{
					
					oOption = new Option();
					oOption.value = arrFilterA[i].FilterAID;
					oOption.text = arrFilterA[i].FilterATitle;
					FilterASelect.options[newCounter] = oOption;
					
					if(selectedFilterAID==arrFilterA[i].FilterAID) nSelectedIndex = newCounter;
					newCounter = newCounter +1;
					bFoundFilterAToGroupA = true;
				}
			}	
			
		}
	}
	//alert(bFoundFilterAToGroupA);
	if(bFoundFilterAToGroupA)
	{
		FilterASelect.selectedIndex = nSelectedIndex;
		FilterASelect.disabled=false;
	}
	else 
	{
		FilterASelect.selectedIndex=0;
		FilterASelect.disabled=true;
	}
}


function replaceClass(row)
{
	if(row!=null)
	{

		var rowOnClass = row.onclass;
		var rowNowClass = row.className;
		if(rowOnClass!=null && rowNowClass!=null)
		{
			var tmpClass = rowNowClass;
			row.className = ''+rowOnClass;
			row.onclass = tmpClass;
		}
	}
}
function fncChangeCategory(nCategoryID, nSubCategoryID, ctlID)
{
	var ctlSubCategory = document.getElementById(ctlID);
	if (ctlSubCategory != null)
	{
		var xmlDoc = dbsRequest("GetSubCategory.asp?Category=" + nCategoryID);
		if (xmlDoc != null)
		{
			ctlSubCategory.options.length = 0;
			if (xmlDoc.hasChildNodes())
			{
				var oSubCategories = xmlDoc.getElementsByTagName("SubCategory"); 
				for (var nSubCategories=0; nSubCategories<oSubCategories.length; nSubCategories++)
				{
					var sSubCategoryID = dbsGetAttributeText(oSubCategories[nSubCategories],0);
					var sSubCategoryTitle = dbsGetAttributeText(oSubCategories[nSubCategories],1);
					var bSelected = (nSubCategoryID.toString() == dbsGetAttributeText(oSubCategories[nSubCategories],0));
					
					var oOption = new Option(sSubCategoryTitle,sSubCategoryID);
					ctlSubCategory.options.length++;
					ctlSubCategory.options[ctlSubCategory.options.length-1] = oOption;
					ctlSubCategory.options[ctlSubCategory.options.length-1].selected = bSelected;
				}
				ctlSubCategory.disabled = false;
			}
			else
			{
				ctlSubCategory.disabled = true;
				var oOption = new Option("none","");
				ctlSubCategory.options.length++;
				ctlSubCategory.options[ctlSubCategory.options.length-1] = oOption;
			}
		}
	}
}

function fncChangeArea(nAreaID, nCityID, ctlID, sCategoryID)
{
	var ctlCity = document.getElementById(ctlID);
	if (ctlCity != null)
	{
		var xmlDoc = dbsRequest(sAppDomain + "/GetCity.asp?Area=" + nAreaID + "&CategoryID=" + sCategoryID);
		if (xmlDoc != null)
		{
			ctlCity.options.length = 0;
			if (xmlDoc.hasChildNodes())
			{
				var oCities = xmlDoc.getElementsByTagName("City"); 
				for (var nCities=0; nCities<oCities.length; nCities++)
				{
					var sCityID = dbsGetAttributeText(oCities[nCities],0);
					var sCityTitle = dbsGetAttributeText(oCities[nCities],1);
					var bSelected = (nCityID.toString() == dbsGetAttributeText(oCities[nCities],0));
					
					var oOption = new Option(sCityTitle,sCityID);
					ctlCity.options.length++;
					ctlCity.options[ctlCity.options.length-1] = oOption;
					ctlCity.options[ctlCity.options.length-1].selected = bSelected;
				}
				ctlCity.disabled = false;
			}
			else
			{
				ctlCity.disabled = true;
				var oOption = new Option("none","");
				ctlCity.options.length++;
				ctlCity.options[ctlCity.options.length-1] = oOption;
			}
		}
	}
}

