if(screen != null) { var xpos = screen.width; var ypos = screen.height; }
else { var xpos = 640; var ypos = 480; }

function pics(pageToLoad, w, h)
{
	var winheight = parseInt(h);
	var scrollingwidth = w;
	var scrollingheight = winheight;
	var scrolling = 0;
	
	if(xpos > 800) 
	{
		if(h > 700) { scrollingwidth = parseInt(w) + 20; scrollingheight = 700; scrolling = 1; }
		if(w > 1000) { scrollingheight = parseInt(winheight) + 20; scrollingwidth = 1000; scrolling = 1; }
		if((w > 1000) && (h > 700)) { scrollingheight = 700; scrollingwidth = 1000; scrolling = 1; }
	}
	else
	{
		if(h > 450) { scrollingwidth = parseInt(w) + 20; scrollingheight = 450; scrolling = 1; }
		if(w > 730) { scrollingheight = parseInt(winheight) + 20; scrollingwidth = 730; scrolling = 1; }
		if((w > 730) && (h > 450)) { scrollingheight = 450; scrollingwidth = 730; scrolling = 1; }
	}
	xposition = (xpos - scrollingwidth) / 2;
	yposition = (ypos - scrollingheight) / 2;
	args = "width=" + scrollingwidth + ","
		+ "height=" + scrollingheight + ","
		+ "location=0, menubar=0, resizable=1, scrollbars=" + scrolling + ","
		+ "status=0, titlebar=0, toolbar=0, hotkeys=0, "
		+ "screenx=" + xposition + ","
		+ "screeny=" + yposition + ","
		+ "left=" + xposition + ","
		+ "top=" + yposition;
	oWin = window.open("","_blank",args);

	pic_pop =  '<HTML><TITLE>VoteMeOff.com - Picture</TITLE>';
	pic_pop += '<BODY bgcolor="#000000" text="#000000" rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="margin:0">';
	pic_pop += '<img style="cursor:hand;" onclick="window.close()" src="'+ pageToLoad +'" width="'+ w +'" height="'+ h +'" vspace="0" hspace="0" border="0">'; 
	pic_pop += '</BODY></HTML>';

	oWin.document.open();
	oWin.document.writeln(pic_pop);
	oWin.document.close();
}

function popUp(url, h, w)
{
	var load = window.open(url,'','scrollbars=yes,menubar=no,height='+h+',width='+w+',resizable=yes,toolbar=no,location=no,status=yes');
}

function checkUncheckAll(form)
{
	var SelectAll = form.selectAll;
	for ( var i=0; i < form.elements.length; i++ )
	{
		var e = form.elements[i];
		if (SelectAll.checked)
		{
			e.checked = true;
		}
		else
		{
			e.checked = false;
		}
	}
}

function disableForm(theform)
{
	if (document.all || document.getElementById)
	{
		for (i = 0; i < theform.length; i++)
		{
			var tempobj = theform.elements[i];
			if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
			tempobj.disabled = true;
		}
		return true;
	}
	else
	{
		return false;
	}
}

function loadSmilies()
{
	var load = window.open('smilies.html','','scrollbars=yes,menubar=no,height=370,width=310,resizable=yes,toolbar=no,location=no,status=no');
}
function loadEnumeratedSmilies()
{
	var load = window.open('smilies.enumerated.php','','scrollbars=yes,menubar=no,height=370,width=310,resizable=yes,toolbar=no,location=no,status=no');
}

function loadColorPicker(arg_refid)
{
        var load = window.open('color_picker.php','','scrollbars=yes,menubar=no,height=370,width=310,resizable=yes,toolbar=no,location=no,status=no');
	load.refid=arg_refid;
}


function confirmAttack()
{
	var x=document.getElementById("ArsenalSelect");
	if(x.options[x.selectedIndex].text=="- Select Item -")
	{
		return alert("You must select an action item from the list first. ");
	}
	if(confirm("Attack user?"))
	{
		document.forms.arsenal_form.method.value='rate';
		document.forms.arsenal_form.submit();
	}
}

function confirmTransfer()
{
	var x=document.getElementById("ArsenalSelect");
        if(x.options[x.selectedIndex].text=="- Select Item -")
	{
		return alert("You must select an action item from the list first. ");
	}
	if(confirm("Transfer arsenal item to user?"))
	{
		document.forms.arsenal_form.method.value='transfer';
		document.forms.arsenal_form.submit();
	}
}

function confirmTransfer2()
{
	var x=document.getElementById("ArsenalSelect");
	if(x.options[x.selectedIndex].text=="- Select Item -")
	{
		return alert("You must select an action item from the list first");
	}
	var amount=prompt("How many items do you wish to transfer?","");
	if(amount==null){return;}
	if(!parseInt(amount)){return alert("you must enter a number greater than zero");}
	if(amount <=0 ){return alert("you must enter a number greater than zero");}
	document.forms.arsenal_form.amount.value=amount;
	document.forms.arsenal_form.method.value='transfer';
	document.forms.arsenal_form.submit();
}

function confirmVoteUp()
{
	if(confirm("Vote User +5 ?"))
	{
		document.forms.voteup.submit();
	}
}

function confirmVoteDown()
{
	if(confirm("Vote User -1 ?"))
	{
		document.forms.votedown.submit();
	}
}
function changeTemplate(template_index)
{
        var tc=document.template_change.new_type;
        switch(template_index)
        {
                case '1': tc.value='Questions'; break;
                case '2': tc.value='Images'; break;
                case '5': tc.value='Movie'; break;
                case '6': tc.value='Book'; break;
                case '7': tc.value='Album'; break;
		case '8': tc.value='Game'; break;
		case '9': tc.value='Poll'; break;
                default: tc.value=document.template_change.original_type.value; break;
        }
        document.template_change.submit();
}
