function openBlog(newURL)

{

testwindow= window.open (newURL, "mywindow",

    "location=1,status=1,scrollbars=1,menubar=1");

testwindow.moveTo(0,0);

}
$(document).ready(function() {
//Top Tab Navigation
	$("#WOS").click(function() {
	pageNum = 1;
		if ($(this).css("z-index") != "3") {
			$("#WOS").css("z-index", "3");
			$("#RS").css("z-index", "2");
			$("#WGT").css("z-index", "1");
			$("#rightbox").fadeOut("fast", function() {
				/*$.get("gslist.php", {category: category, sub: 1}, 
					function(data) {
						document.getElementById('rightbox').innerHTML = data;
						$("#rightbox").fadeIn("fast");
					}
				);*/
				$.ajax({
   					type: "GET",
					url: "gslist.php",
					dataType: "html",
					data: "category="+category+"&sub=4",
					success: function(data){
						document.getElementById('rightbox').innerHTML = data;
						$("#rightbox").fadeIn("fast");
						num = ($("#bigbox").width()-282)*-1;
					   	numVal = num + "px";
						pageNum = 1;
						numPages = $("#bigbox").width()/282;
						$("#next").click(function() {
    		if (pageNum != numPages) {
	    		$("#bigbox").animate({marginLeft: "-=282px"}, "fast");
	    		pageNum++;
	    		document.getElementById('page').innerHTML = pageNum;
	    	}
	    });
	    $("#back").click(function() {
	    	if (pageNum > 1) {	
	    		$("#bigbox").animate({marginLeft: "+=282px"}, "fast");
	    		pageNum--;
	   			document.getElementById('page').innerHTML = pageNum;
	    	}
    	});
   					}
				 });
			});
		}
	});
	$("#RS").click(function() {
	pageNum = 1;
		if ($(this).css("z-index") != "3") {
			$("#RS").css("z-index", "3");
			$("#WOS").css("z-index", "2");
			$("#WGT").css("z-index", "1");
			$("#rightbox").fadeOut("fast", function() {
				$.get("gslist.php", {category: category, sub: 5}, 
					function(data) {
						document.getElementById('rightbox').innerHTML = data;
						$("#rightbox").fadeIn("fast");
						num = ($("#bigbox").width()-282)*-1;
					   	numVal = num + "px";
						pageNum = 1;
						numPages = $("#bigbox").width()/282;
						$("#next").click(function() {
    		if (pageNum != numPages) {
	    		$("#bigbox").animate({marginLeft: "-=282px"}, "fast");
	    		pageNum++;
	    		document.getElementById('page').innerHTML = pageNum;
	    	}
	    });
	    $("#back").click(function() {
	    	if (pageNum > 1) {	
	    		$("#bigbox").animate({marginLeft: "+=282px"}, "fast");
	    		pageNum--;
	   			document.getElementById('page').innerHTML = pageNum;
	    	}
    	});
					}
				);
				/*$.ajax({
   					type: "GET",
					url: "gslist.php",
					dataType: "html",
					data: "category="+category+"&sub=2",
					success: function(data){
						document.getElementById('rightbox').innerHTML = data;
						$("#rightbox").fadeIn("fast");
   					}
				 });*/
			});
		}
	});
	$("#WGT").click(function() {
	pageNum = 1;
		if ($(this).css("z-index") != "3") {
			$("#WGT").css("z-index", "3");
			$("#RS").css("z-index", "1");
			$("#WOS").css("z-index", "2");
			$("#rightbox").fadeOut("fast", function() {
				/*$.get("gslist.php", {category: category, sub: 3}, 
					function(data) {
						document.getElementById('rightbox').innerHTML = data;
						$("#rightbox").fadeIn("fast");
					}
				);*/
				$.ajax({
   					type: "GET",
					url: "gslist.php",
					dataType: "html",
					data: "category="+category+"&sub=6",
					success: function(data){
						document.getElementById('rightbox').innerHTML = data;
						$("#rightbox").fadeIn("fast");
						num = ($("#bigbox").width()-282)*-1;
					   	numVal = num + "px";
						pageNum = 1;
						numPages = $("#bigbox").width()/282;
						$("#next").click(function() {
    		if (pageNum != numPages) {
	    		$("#bigbox").animate({marginLeft: "-=282px"}, "fast");
	    		pageNum++;
	    		document.getElementById('page').innerHTML = pageNum;
	    	}
	    });
	    $("#back").click(function() {
	    	if (pageNum > 1) {	
	    		$("#bigbox").animate({marginLeft: "+=282px"}, "fast");
	    		pageNum--;
	   			document.getElementById('page').innerHTML = pageNum;
	    	}
    	});
   					}
				 });
			});
		}
	});
    
  $("#next").click(function() {
    		if (pageNum != numPages) {
	    		$("#bigbox").animate({marginLeft: "-=282px"}, "fast");
	    		pageNum++;
	    		document.getElementById('page').innerHTML = pageNum;
	    	}
	    });
	    $("#back").click(function() {
	    	if (pageNum > 1) {	
	    		$("#bigbox").animate({marginLeft: "+=282px"}, "fast");
	    		pageNum--;
	   			document.getElementById('page').innerHTML = pageNum;
	    	}
    	});
});

function test() {
	$("#comoverlay").fadeOut("slow");
}

function openReply(cid) {

	if(!window.innerWidth)
	{
		//strict mode
		if(!(document.documentElement.clientWidth == 0))
		{
			intLeft = document.documentElement.clientWidth / 100;
			intTop = document.documentElement.clientHeight/2;
		}
		//quirks mode
		else
		{
			intLeft = document.body.clientWidth / 2 - 325;
			intTop = document.body.clientHeight/2;
		}
	}
	//w3c
	else
	{
		intLeft = window.innerWidth/ 2 - 325;
		intTop = window.innerHeight/2;
	}
	
	intLeft = window.innerWidth/ 2 - 325;
	intTop = (window.pageYOffset - 15) + (window.innerHeight/2) - 200;

	var wrapper = document.getElementById('cwrapper');
	var overlay = document.createElement('div');
	overlay.setAttribute('id', 'comoverlay');
	overlay.style.width = "650px";
	overlay.style.position = "absolute";
	overlay.style.left = intLeft + "px";
	overlay.style.top = intTop + "px";
	overlay.style.zIndex = "100";
	overlay.style.display = "none";
	document.body.appendChild(overlay);
	$("#comoverlay").fadeIn("slow");
	$.post("ajaxcom.php",
	{ cid: cid },
	function (data) {
		document.getElementById("comoverlay").innerHTML = data;
	}
	);
	
}

function reply(cid) {
	cat_id = category;
	subject = $("#subject").val();
	comtext = $("#comtext").val();
	if($("#subject").val() != "" && $("#comtext").val() != "") {
	
	$.post("comreply.php", 
		{
			cat_id: cat_id,
			subject: subject,
			comtext: comtext,
			cid: cid
		}, 
    	function (data) {
    		$("#commid").fadeOut("fast",
    		function() {
    			document.getElementById('commid').innerHTML = "<p class=\"steps\" style=\"color:black; width:350px; padding-top:8px; padding-left:50px;\">Your comment has been saved!</p>";
    			$(this).fadeIn("fast");
    			$.post("comdisplaythread.php", {cat: category}, 
    				function (data) {
    					document.getElementById('bContent').innerHTML = data;
  		  			}
				);
    			var t = setTimeout("fade()", 3000);
    		}
    	);    		
    });
    }
    else {
    	document.getElementById('avail').innerHTML = "You must enter both a subject and a comment.";
    }
}

function fade() {
	$("#comoverlay").fadeOut("slow");
}