function largerView(URL,dest)
{
if ($('#largeImg'+dest).attr('src') == '')
{
	$('#largeImg'+dest).attr('src',URL);	
}
$('#battleView').hide();
$('#largeView .bigimg').hide();
$('#largeView #largeImg'+dest).show();
$('#largeView').show();
}
function battleView()
{
$('#largeView').hide();
$('#battleView').show();
}


function showSubNav(src)
{
	$(".sub-nav").hide();
	if (src != "none")
	{
		$("#"+src+"-nav").show();
	}
}

$(document).ready(function(){
	$("#nav").hover(
		function(){},
		function(){
			/*if (typeof(defaultNav) == "string")
			{
			showSubNav(defaultNav);
			$("#main-nav li").removeClass("hovered nothovered");
			}*/
		}
	);
	$("#main-nav li").hover(
		function(){
			$("#main-nav li").removeClass("hovered").addClass("nothovered");
			$(this).removeClass("nothovered").addClass("hovered");
		},
		function(){}
	);
})

function cycle(TIG,NUM)
{
if (document.getElementById('div'+TIG).className == 'black')
	{
	document.getElementById('div'+TIG).className = 'blue';
	document.getElementById('Change' + NUM).value = 'plus';
	}
else if (document.getElementById('div'+TIG).className == 'blue')
	{
	document.getElementById('div'+TIG).className = 'red';
	document.getElementById('Change' +NUM).value = 'minus';
	}
else if (document.getElementById('div'+TIG).className == 'red')
	{
	document.getElementById('div'+TIG).className = 'black';
	document.getElementById('Change' +NUM).value = 'even';
	}
}
function addtags()
{
document.getElementById('addtags1').className = 'hide';
document.getElementById('addtags2').className = 'show';
}
function changeToSubmitCaption()
{
	$("#showCaption").hide()
	$("#captionForm").show();
}
function toggleDisplay(hideSrc,showSrc)
{
	$('#'+hideSrc).hide();
	$('#'+showSrc).show();
	$('#Buttons').show();
}
function setCookie(c_name, value) {
	time = 30;
	if (value == false)	{time = -30}
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + time);
    document.cookie = c_name + "=" + escape(value) + ";expires=" + exdate.toUTCString();
}
function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) c_end = document.cookie.length;
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}
 var scrollLockHeight = 0;
	 var scrollHeight = 0;
	 var isIE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;
	 $(document).ready(function(){
		if ($(".scrollLockTarget")[0])
		{
			offset = $(".scrollLockTarget").offset();
			scrollHeight = $(".scrollLockTarget").height();
			 scrollLockHeight = offset.top;
			 
		 window.onscroll = function(){
			if ($(document).scrollTop() > scrollLockHeight)
			{
				if (isIE6 == false)
				{
					$(".scrollLockTarget").css({'position':'fixed','top':'0'})
				}
				else
				{
					$(".scrollLockTarget").css({'position':'absolute','top':$(document).scrollTop()})					
				}
			}
			else
			{
				$(".scrollLockTarget").css({'position':'','top':'0px'})				
			}
		 }
		}
	 });
	 
function testCat()
{
	document.getElementById("catErrorSpan").style.display = "none";
	var form = document.forms["upload"];
	var category = form["category"];
	var catName = "";
	for (i = category.length-1; i > -1; i--)
	{
	    if (category[i].checked)
	    {
	        catName = category[i].value;
	    }
	}
	if (catName == "")
	{
	    document.getElementById("catErrorSpan").style.display = "block";
		return false;
	}
	else
	{
		uploading();
	    return true;
	}
}
function uploading()
{
	document.getElementById("step_1_msg").innerHTML="Uploading...";
	document.getElementById("formdiv").style.display="none";
	document.getElementById("uploadingdiv").style.display="block";
	rotate();
}
var rotnum = 1;
var numlist = new Array();
numlist[1]="^----";
numlist[2]="-^---";
numlist[3]="--^--";
numlist[4]="---^-";
numlist[5]="----^";
function rotate()
{
	rotnum = rotnum+1;
	document.getElementById("rotateme").innerHTML=numlist[rotnum];
	if (rotnum == 5)
	{
	rotnum = 0;
	}
	window.setTimeout('rotate()',300);
}
