var width;	

	function OpenAskWindow(){
		$('#LoginPopup').remove();
		$('#RegisterPopup').remove();
		$('#CommentPopup').remove();
		$('#ImagePopup').remove();
		$('#ForgotPopup').remove();
		$('#MapPopup').remove();
		$('#ContinuePopup').remove();
		$('#NavHolder').append(
			'<div id="AskPopup"><iframe src ="/Ask/" width="419px" height="452px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="true"></iframe><div>'
		);
		width = $("body").width();
		$('#AskPopup').css('left',(width/2)-210+'px');
	}
	
	function OpenCommentWindow(BlogID){
		$('#LoginPopup').remove();
		$('#RegisterPopup').remove();
		$('#AskPopup').remove();
		$('#ImagePopup').remove();
		$('#ForgotPopup').remove();
		$('#MapPopup').remove();
		$('#ContinuePopup').remove();
		$('#NavHolder').append(
			'<div id="CommentPopup"><iframe src ="/Comment/'+BlogID+'" width="419px" height="452px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="true"></iframe><div>'
		);
		width = $("body").width();
		$('#CommentPopup').css('left',(width/2)-210+'px');
	}
	
	function OpenRegisterWindow(){
		$('#LoginPopup').remove();
		$('#RegisterPopup').remove();
		$('#CommentPopup').remove();
		$('#ImagePopup').remove();
		$('#ForgotPopup').remove();
		$('#MapPopup').remove();
		$('#ContinuePopup').remove();
		$('body').append(
			'<div id="RegisterPopup"><iframe src ="/Register/" width="419px" height="399px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="true"></iframe><div>'
		);
		width = $("body").width();
		$('#RegisterPopup').css('left',(width/2)-210+'px');
	}
	
	function OpenLoginWindow(){
		$('#RegisterPopup').remove();
		$('#LoginPopup').remove();
		$('#CommentPopup').remove();
		$('#ImagePopup').remove();
		$('#ForgotPopup').remove();
		$('#MapPopup').remove();
		$('#ContinuePopup').remove();		
		$('#NavHolder').append(
			'<div id="LoginPopup"><iframe src ="/Login/" width="273px" height="253px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="true"></iframe><div>'
		);
		width = $("body").width();
		$('#LoginPopup').css('left',(width/2)-140+'px');
	}
	
	function OpenContinueWindow(FowardingURL){
		$('#RegisterPopup').remove();
		$('#LoginPopup').remove();
		$('#CommentPopup').remove();
		$('#ImagePopup').remove();
		$('#ForgotPopup').remove();
		$('#MapPopup').remove();
		$('#ContinuePopup').remove();
		var GoTo=FowardingURL.replace(/&/g,'-_-');
		$('#NavHolder').append(
			'<div id="ContinuePopup"><iframe src ="/Intercept/'+GoTo+'" width="385px" height="293px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="true"></iframe><div>'
		);
		width = $("body").width();
		$('#ContinuePopup').css('left',(width/2)-190+'px');
	}
	
	function OpenForgotWindow(){
		$('#RegisterPopup').remove();
		$('#LoginPopup').remove();
		$('#CommentPopup').remove();
		$('#MapPopup').remove();
		$('#ImagePopup').remove();
		$('#ForgotPopup').remove();
		$('#ContinuePopup').remove();
		$('#NavHolder').append(
			'<div id="ForgotPopup"><iframe src ="/Forgot/" width="396px" height="276px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="true"></iframe><div>'
		);
		width = $("body").width();
		$('#ForgotPopup').css('left',(width/2)-200+'px');
	}
	
	function OpenRequestWindow(){
		$('#RegisterPopup').remove();
		$('#LoginPopup').remove();
		$('#CommentPopup').remove();
		$('#MapPopup').remove();
		$('#ImagePopup').remove();
		$('#ForgotPopup').remove();
		$('#ContinuePopup').remove();
		$('#NavHolder').append(
			'<div id="RequestPopup"><iframe src ="/Request/" width="426px" height="529px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="true"></iframe><div>'
		);
		width = $("body").width();
		$('#RequestPopup').css('left',(width/2)-213+'px');
	}
	
	function OpenMapWindow(Code){
		$('#RegisterPopup').remove();
		$('#LoginPopup').remove();
		$('#CommentPopup').remove();
		$('#ImagePopup').remove();
		$('#ForgotPopup').remove();
		$('#MapPopup').remove();
		$('#ContinuePopup').remove();
		$('#NavHolder').append(
			'<div id="MapPopup"><iframe src ="/Map/'+Code+'/" width="540px" height="440px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="true"></iframe><div>'
		);
		width = $("body").width();
		$('#MapPopup').css('left',(width/2)-270+'px');
		if($.browser.msie && $.browser.version=="6.0") {			
			var ST=parent.$(document).scrollTop();
			ST=ST+100;
			parent.$('#MapPopup').css({top:ST+'px'});
		}
	}
	
	function OpenImageWindow(){
		$('#RegisterPopup').remove();
		$('#LoginPopup').remove();
		$('#CommentPopup').remove();
		$('#LoginPopup').remove();
		$('#MapPopup').remove();
		$('#ContinuePopup').remove();
		$('#NavHolder').append(
			'<div id="ImagePopup"><iframe src ="/Login/" width="273px" height="253px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="true"></iframe><div>'
		);
		width = $("body").width();
		$('#LoginPopup').css('left',(width/2)-140+'px');
	}
	
	$(window).bind('resize', function() {
		width = $("body").width();
		$('#RegisterPopup').css('left',(width/2)-210+'px');
		$('#LoginPopup').css('left',(width/2)-140+'px');
		$('#AskPopup').css('left',(width/2)-210+'px');
		$('#CommentPopup').css('left',(width/2)-210+'px');
	});
