function popup(mylink, windowname, width, height, scrolls) {
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'resizable=1, width=' + width + ', height=' + height + ', scrollbars=' + scrolls);
return false;
}

function confirmSubmit() {
var agree=confirm("Are you sure you wish to continue?");
if (agree)
	return true ;
else
	return false ;
}

<!--
var rws=10;
var cls=60;
onload=function() {
	var inp=document.getElementsByTagName('input');
	for(c=0;c<inp.length;c++) {
		if(inp[c].value=='Height +') {
			inp[c].onclick=function() {
				hi_increase();
			}
		}
		if(inp[c].value=='Height -') {
			inp[c].onclick=function() {
				hi_decrease();
			}
		}
		if(inp[c].value=='Width +') {
			inp[c].onclick=function() {
				wi_increase();
			}
		}
		if(inp[c].value=='Width -') {
			inp[c].onclick=function() {
				wi_decrease();
			}
		}
	}
}

function hi_increase() {
	rws = rws + 2;
	document.getElementById('txtara').rows=rws;
}

function hi_decrease() {
	if(rws>5) {
		rws = rws - 2;
		document.getElementById('txtara').rows=rws;
	}
}

function wi_increase() {
	cls = cls + 5;
	document.getElementById('txtara').cols=cls;
}

function wi_decrease() {
	if(cls>60) {
		cls = cls - 5;
		document.getElementById('txtara').cols=cls;
	}
}

function addRep(pid, rep, fid, iid, sid){
	if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	} else {// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200) {
			if(xmlhttp.responseText == "err1") {
				alert("Incorrect rep amount.");
			} else if (xmlhttp.responseText == "err2") {
				alert("No post was found with the ID specified");
			} else if (xmlhttp.responseText == "err3") {
				alert("You have already repped this post. You cannot do it again.");
			} else if (xmlhttp.responseText == "err4") {
				alert("You cannot change the reputation of staff members.");
			} else if (xmlhttp.responseText == "err5") {
				alert("You have reached your repping quota of the past 24 hours (10 for supporters, 5 for normal members)");
			} else if (xmlhttp.responseText == "err6") {
				alert("You cannot rep your own posts.");
			} else {
				document.getElementById(pid).innerHTML=xmlhttp.responseText;
			}
		}
	}
	xmlhttp.open("GET","/modules/comments/ajax/rep.php?pid=" + pid + "&rep=" + rep + "&fid=" + fid + "&iid=" + iid + "&sid=" + sid,true);
	xmlhttp.send();
}

function showComment(pid) {
	document.getElementById('box-' + pid).style.display = "inherit";
	document.getElementById('rep-' + pid).style.display = "none";
}

// Copyright 2006-2007 javascript-array.com

var timeout	= 0;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.display = 'none';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.display = 'block';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.display = 'none';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onblur = mclose; 

//-->

function fotm_vote() {
	var str = $("#ajax-vote-form").serialize();
	
		$.ajax({
			type: "POST",
			url: "/downloads/ajax/do_fotmvote.php",
			data: str,
			success: function(msg) {
		
				$("#note").ajaxComplete(function(event, request, settings) {

					if(msg == 1) { // Message Sent? Show the 'Thank You' message and hide the form
						result = '<div class="ajax_ok"><h2>Vote registered</h2> You have successfully voted for this file to be file of the month</div>';
						$("#fields").hide();
					} else {
						result = msg;
						$("#fields").hide();
					}
		
					$(this).html(result);
		
				});

			}

		});

	return false;	
}

function add_comment(tid, fid, img_id, aid, area) {
	var str = $("#ajax-vote-form").serialize();
	
		$.ajax({
			type: "POST",
			url: "/modules/comments/ajax/do_comment.php",
			data: str,
			success: function(msg) {
		
				$("#note").ajaxComplete(function(event, request, settings) {

					if(msg == 1) { // Message Sent? Show the 'Thank You' message and hide the form
						result = '<div class="ajax_ok"><h2>Success!</h2> Your comment was added successfully</div>';
						$("#newcomment").hide();
						ajaxpage('/modules/comments/index2.php?tid=' + tid + '&fid=' + fid + '&img_id=' + img_id + '&aid=' + aid + '&newcomment=1', area);
					} else {
						result = msg;
						$("#newcomment").hide();
					}
		
					$(this).html(result);
		
				});

			}

		});

	return false;	
}
