var m_mycats 	= new Array();
var m_mytags	= new Array();

count=0;

function S(Form){
	if (Form.File1.value == '' && Form.File2.value == '' && Form.File3.value == '' )
	{
		alert("please select at least 1 Image")
		return false;
	}
	else
	{
		UploadInterval = window.setInterval("Progress()", 1000);
		document.getElementById('UploadStatus').childNodes[0].data = 'starting upload, please wait';
		Form.SubmitButton.disabled="disabled";
		urchinTracker('/StartUploadButton');
	}
}

function Progress(){
	count++;
	document.getElementById('UploadStatus').innerHTML = 'uploading, time elapsed: <span class="ut">' + count + '</span>s<br /><br /><div class="ut j">LEAVING THIS PAGE WILL ABORT THE UPLOAD, PLEASE WAIT WHILE THE FILE IS UPLOADED.</div><div class="j">Uploading can take a few seconds or minutes. If you want to browse the site while uploading, please open a new browser window.</div><br />' ;	
}

function LoginFocus(){
	if (document.getElementById('User')) {
		document.getElementById('User').focus();
	}
}

function PassFocus(){
	if (document.getElementById('Pass')) {
		document.getElementById('Pass').focus();
	}
}

function CommentFocus(){
	if (document.getElementById('Comment')) {
		document.getElementById('Comment').focus();
	}
}

function SignUpFocus(){
	if (document.getElementById('NewUser')) {
		document.getElementById('NewUser').focus();
	}
}

function UpdatePics(cID, CatID)
{
	var d = new Date();
	var t = d.getTime();
	new Ajax.Updater('AjaxResponsePics', 'http://www.picato.net/mypicato/mypicato_AjaxPics.asp?cID='+cID+'&CatID='+CatID+'&t='+t,{method: 'get',evalScripts:true});
	//m_cID = cID;
	return false;
}

function UpdateCats(cb)
{
	for (var i = 0; i < m_mycats.length; i++)
	{
		Droppables.remove(m_mycats[i]);
	}
	
	var d = new Date();
	var t = d.getTime();
	new Ajax.Updater('AjaxResponseCats', 'http://www.picato.net/mypicato/mypicato_AjaxCats.asp?cb='+cb+'&t='+t,{method: 'get',evalScripts:true});
	
	m_mycats.length=0;
	
	return false;
}

function UpdateCatsCloud(cb)
{
	var d = new Date();
	var t = d.getTime();
	new Ajax.Updater('AjaxResponseCatsCloud', 'http://www.picato.net/mypicato/mypicato_AjaxCatsCloud.asp?cb='+cb+'&t='+t,{method: 'get',evalScripts:true});
	return false;
}

function UpdateCatsSDA(cb)
{
	for (var i = 0; i < m_mycats.length; i++)
	{
		Droppables.remove(m_mycats[i]);
	}
	var d = new Date();
	var t = d.getTime();
	new Ajax.Updater('AjaxResponseCatsSDA', 'http://www.picato.net/mypicato/mypicato_AjaxCatsSDA.asp?cb='+cb+'&t='+t,{method: 'get',evalScripts:true});
	return false;
}

function UpdateTags(TagID)
{
	for (var i = 0; i < m_mytags.length; i++)
	{
		Droppables.remove(m_mytags[i]);
	}
	
	var d = new Date();
	var t = d.getTime();
	new Ajax.Updater('AjaxResponseTags', 'http://www.picato.net/mypicato/mypicato_AjaxTags.asp?TagID='+TagID+'&t='+t,{method: 'get',evalScripts:true});
	
	m_mytags.length=0;
	
	return false;
}

function UpdateTagsCloud(TagID)
{
	var d = new Date();
	var t = d.getTime();
	new Ajax.Updater('AjaxResponseTagsCloud', 'http://www.picato.net/mypicato/mypicato_AjaxTagsCloud.asp?TagC='+TagID+'&t='+t,{method: 'get',evalScripts:true});
	return false;
}

function UpdateTagsSDA(TagID)
{
	for (var i = 0; i < m_mytags.length; i++)
	{
		Droppables.remove(m_mytags[i]);
	}
	
	var d = new Date();
	var t = d.getTime();
	new Ajax.Updater('AjaxResponseTagsSDA', 'http://www.picato.net/mypicato/mypicato_AjaxTagsSDA.asp?TagID='+TagID+'&t='+t,{method: 'get',evalScripts:true});
	
	m_mytags.length=0;
	
	return false;
}

function DeletePic(PicID)
{
	if (confirm('Are you sure you want to delete this picture? This will remove it from all cat profiles and tags too.'))
	{
		$('Status').innerHTML = 'Deleting, please wait..'
		var d = new Date();
		var t = d.getTime();
		new Ajax.Updater('Status', 'http://www.picato.net/mypicato/mypicato_AjaxDeletePic.asp?PicID='+PicID+'&t='+t,{method: 'get',evalScripts:true});
		
		numSavedFiles--;
		if (numSavedFiles == 0)
		{
			window.location = 'http://www.picato.net/mypicato/mypictures/';
		}
	}
	return false;
}

function ConfirmDelete()
{
	if (confirm('Are you sure you want to delete this picture? This will remove it from all cat profiles and tags too.'))
	{return true;}
	else
	{return false;}
}

function ConfirmCatDelete()
{
	if (confirm('Are you sure you want to delete this cat? The pictures will still be under "my pictures".'))
	{return true;}
	else
	{return false;}
}

function ConfirmTagDelete()
{
	if (confirm('Are you sure you want to delete this tag? The pictures will still be under "my pictures".'))
	{return true;}
	else
	{return false;}
}

function ConfirmRemove()
{
	if (confirm('Are you sure you want to remove this picture? The picture will still be under "my pictures"'))
	{return true;}
	else
	{return false;}
}