function showUrl(url) {
      var width = 500;
	var height = 150;
	var params = "menubar=0,resizable=0,toolbar=0,scrollbars=1,status=0";
      params += ",width=" + width;
	params += ",height=" + height;
	var left = (screen.width - width)/2;
      params += ",left=" + left;
	var top = (screen.height - height)/2;
	params += ",top=" + top;

	//var thisWindow = window.open ("", "mywindow", params);
    //  var dialogText = "The URL of this Webstakk web site is " + url; 
	//var h3tag = '<H3><left>' + dialogText + '</left></H3>';
    //  thisWindow.document.write("");
	//thisWindow.document.write(h3tag);
	var msg = "The URL of this Webstakk web site is: " + url;
	openDialog(msg, "", 1);

}

function endViewTimeout() {
		clearTimeout(viewTimer);
		document.getElementById("msg").childNodes[0].nodeValue = "Congratulations.  Your webstakk has passed the preview test.  You may now click the 'Get Webstakk Link' button.";
		viewTimer = setTimeout("hideDialog()", 2000);
		
	}
	
	function hideDialog(){
		clearTimeout(viewTimer);
		var dlgProg = dojo.widget.byId("dialogNode");
		dlgProg.hide();
	}
	
function showDialog(msg) {
	//alert(msg);
	openDialog(msg, "", 1);
}

//positive can be 1 or 0
function doVote(positive, pid, pathRoot){
	var url = pathRoot + "vote.php?vote=" + positive + "&pid=" + pid;
	initAjax();
	var result = sendAndReceiveAjax(url);
	result = trim(result);
	if (result == "0 Show miniRegister") {
		//openDialog("In order to vote, you must log in first.  Please click the Webstakk logo on the top left to log in on our homepage.","",1);
		openMiniRegister();
		return;
	}
	if (result == "0 Do not show miniRegister") {
		return;
	}
	//alert("result is: " + result);
	if (result.substr(0,2) == "0 ") {
		var msg = result.substr(2,result.length-2);
		//lert(msg);
		showDialog(msg);
		return;
	}
	var index = result.indexOf("1");
	index += 2;   //skip "1 "
	var posNum = result.substr(index,5);
	var negNum = result.substr(index+6,5);
	document.getElementById("positiveVote").childNodes[0].nodeValue = posNum;
	document.getElementById("negativeVote").childNodes[0].nodeValue = negNum;
}

function openWelcomePageWindow(pathRoot) {
	var path = pathRoot + "welcome.php";
	//window.open(path);
	location.href = path;
	
}

//This is only for users who are not logged in
function openCreatorPageWindow(pathRoot) {
	var path = pathRoot + "creator_page.php?sample=true";
	//window.open(path);
	location.href = path;
	
}

function registerToContact() {
	openDialog("You need to register before you can contact an author.", "", 1);
}

var currentFrameId = "result0";

function setCurrentFrameId(f) {
	currentFrameId = f;
}

function killPage() {
	var frameId = document.getElementById(currentFrameId);
	frameId.src = "about:blank";
}






