function swtch (pid)
{
	if (document.getElementById)
	{
		piece = document.getElementById('nst' + pid);
		if (conts[pid])
		{
			piece.innerHTML = conts[pid];
			conts[pid] = '';

		}
		else
		{
			conts[pid] = piece.innerHTML;
			piece.innerHTML = '';

		}

	}
}


function button_on (bid)
{
	if (document.getElementById)
	{
		ttl = document.getElementById('ttl' + bid);
		ttl.style.color='#FFFFFF';
	}
}

function button_off (bid)
{
	if (document.getElementById)
	{
		ttl = document.getElementById('ttl' + bid);
		ttl.style.color='#000000';
	}
}

function checkForm(formID) {
	var frm = document.getElementById(formID);
	frm.elements['ch_targ'].value=frm.elements['ch_source'].value;
}

function showLoaderIcon(elmID){
	var obj = document.getElementById(elmID);
	var pos = $("#" + elmID).offset();
	var icon = document.getElementById("ajaxLoader");

	var width = $(obj).width();
	var height = $(obj).height();

	$(icon).css('left', pos.left + width - 20);
	$(icon).css('top', pos.top + 2);
	$(icon).show();
}

function hideLoaderIcon(){
	$("#ajaxLoader").hide();
}

$(document).ready(function(){
	function openDialog(url,left,top,width,height){
		$("#stdDialog").html("");
		$("#stdDialog").load(url);
		$("#stdDialog").css("width",width + "px");
		$("#stdDialog").css("height",height + "px");
		$("#stdDialog").css("left",left + "px");
		$("#stdDialog").css("top",top + "px");
		if (!$.browser.msie) {
			$("#stdModality").css("position","fixed");
			$("#stdDialog").css("position","fixed");
		}
		$("#stdModality").bgiframe();
		$("#dpList").hide();
		$("#stdModality").show();
		$("#stdDialog").show();
	}

	$("#triggerDPList").click(function(){
		if ($("#dpList").css("display")=='none') {
			var offset = $("#triggerDPList").position();
			offset.left-=54;
			offset.top+=22;
			$("#dpList").css("left",offset.left + "px");
			$("#dpList").css("top",offset.top + "px");
			$("#dpList").show();
		} else {
			$("#dpList").hide();
		}
	});
	$("#triggerCurrencyDlg").click(function(){
		var price = $(this).attr("data-price");
		var offset = $("#triggerDPList").position();
		openDialog("/" + LANG_PREFIX + "/_currency/?code=USD&price=" + price,offset.left-530,offset.top+25,545,80);
	});
	$("#closeDlgLink").live("click",function(){
		$("#stdDialog").hide();
		$("#stdModality").hide();
	});

});
