//==============================================================================
wiresJS.ReloadPage = function (url, command)
{
    var res = "";     
    $ ("#loccountry, #loclanguage, #loccurrency").each (function () {
	var index = this.selectedIndex; 
	var value = this.options[index].value;
	
	res += "&" + this.name + "=" + value;
	if (this.name == "loccountry")
	    res += "&udf_I_locindex=" + index;
    });
    
    if (res == "")
	return false;

    res = url + res;
    window.location.href = res;
    
    return false; 
}

//==============================================================================
wiresJS.change_parameters = function (obj)
{
    var form = $("form")[0];
    
    if (obj.name == "loccurrency") {
	form.loccurrency.value = obj.options[obj.selectedIndex].value;
    }
    else if (obj.name == "loccountry") {
	form.loccountry.value = obj.options[obj.selectedIndex].value;
    }
}

//==============================================================================
$(document).ready (function () {
    $ (".MenuLoader").not(".ExternalLoader").click (function () {
	if ($("#loccurrency")) {
	    var tmp = $ ("#loccurrency")[0];
    	if (tmp) {
    	    var val = tmp.options[tmp.selectedIndex].value;
    	    if (this.search) {
    	       window.location.href = this.href + "&loccurrency=" + val;
    	    }
    	    else {
    	       window.location.href = this.href;
    	    }
    	    return false;
	    }
	}
    });
});
