function LoginCheckWithPopUp(url,width,height,scrollbars)
{
	if (isLoggedIn > 0)
	    window.open(url, 'newWin', 'width='+width+', height='+height+', scrollbars='+scrollbars+'')
	else
    	alert('Please Log in to MySpace to submit your comments.');
}


// cross domain security work around for lightbox windows
function checkForMessages() {
			if(location.hash == "#63") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission63.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#62") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission62.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#61") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission61.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#60") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission60.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#59") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission59.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#58") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission58.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#57") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission57.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#56") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission56.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#55p1") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission55p1.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#54") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission54.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#52") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission52.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#51") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission51.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#50") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission50.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#48") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission48.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#47") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission47.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#43") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission43.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#42") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission42.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#41") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission41.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#40") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission40.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#39") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission39.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#38") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission38.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#37") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission37.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#36") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission36.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
			if(location.hash == "#35") {
				if (isLoggedIn > 0) {
					commentsUrl = "http://creative.myspacecdn.com/Client/WeightWatchers/Phase2/Comments/commentsubmission35.html";
					LoginCheckWithPopUp(commentsUrl, '700', '650', '1');
					location.hash = "#";
				} else {
					alert("Please Log in to MySpace to submit your comments.");
					location.hash = "#";
				}
			}
}

		
setInterval(checkForMessages, 500);

var win = null;
var index = 1;
function openDialog(id,w,h) {
    Dialog.alert($(id).innerHTML, {className: "alphacube",  width:w, height:h, id: "d" + index})
    index++;
	document.getElementById('frame').style.display = 'none';
}

function lastDialog(id) {
    Dialog.confirm($(id).innerHTML, {className: "alphacube",  width:250, okLabel: "Close All", ok: closeAllModalWindows})
}

function closeAllModalWindows() {
    Windows.closeAllModalWindows();
    //return true;
	document.getElementById('frame').style.display = 'inline';
}





