
function __doPostBack(eventTarget, eventArgument)
{
	var theform;

	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1)
	{
		theform = document.cardSelection;
	}
	else
	{
		theform = document.forms["cardSelection"];
	}

	theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
	theform.__EVENTARGUMENT.value = eventArgument;
	theform.submit();
}

// update the preview image before showing the preview
function swapPreview(newGraphic, rpid, width)
{
	var preview = document.getElementById('preview_img');
	if (preview)
	{
		preview.src = newGraphic;
	}
	
	if ($('#preview')[0] != null && $('#preview_txt')[0] != null)
	{
	    $('#preview')width(width);
		$('#preview_txt').show().html("Loading...");
//		$('preview_txt').innerText = "Loading...";

        $("#preview_txt").load(
            previewBasePath + '/album/cardVerseHandler.ashx?cardPage=selection&rp=' + rpid,
            function(transport)
				{
					if ($('#preview_txt').html().length == 0)
					{
						$('#preview_txt').hide();
						$('#preview').width('auto');
					}
				}
		);
	}
}

function tcOnLoad() {
	for (x = 0; x < templateControls.length; x++) {
		templateControls[x].show();
	}
}
function tcOnUnload() {
	for (x = 0; x < templateControls.length; x++) {
		templateControls[x].dispose();
		templateControls[x] = null;
	}
}
		
var childWnd;
function openChartWindow() {
	var w = 450;
	var h = 230;
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	var settings ='height='+h+',';
	settings +='width='+w+',';
	settings +='top='+wint+',';
	settings +='left='+winl;
	childWnd = window.open('../disclaimers/popup_cards_chart.aspx','PopUp1','toolbar=no,status=no,menubar=no,resizable=no,scrollbars=no,' + settings); 
	childWnd.focus();
	return false;
}

