function changeStatus()
{
	if($('type').value == 'artist')
	{
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			$('status').outerHTML = '<select name="status" id="status" size="1"><option value="Painter">Painter</option><option value="Photography">Photography</option><option value="Various Art">Various Art</option></select>';
		}
		else
		{
			$('status').innerHTML = '<option value="Painter">Painter</option><option value="Photography">Photography</option><option value="Various Art">Various Art</option>';
		}
	}
	else if($('type').value == 'collector')
	{
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			$('status').outerHTML = '<select name="status" id="status" size="1"><option value="Collector">Collector</option><option value="Investor">Investor</option><option value="Gallery">Gallery</option></select>';
		}
		else
		{
			$('status').innerHTML = '<option value="Collector">Collector</option><option value="Investor">Investor</option><option value="Gallery">Gallery</option>';
		}
	}
	else
	{
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			$('status').outerHTML = '<select name="status" id="status" size="1"><option value="Audience">Audience</option></select>';
		}
		else
		{
			$('status').innerHTML = '<option value="Audience">Audience</option>';
		}
	}
}

// Tab Functions [START]
function init () {
	var tabcurrent = document.getElementsByClassName('current');
	for (var i = 0; i < tabcurrent.length; i++) {
		// left side
		if( tabcurrent[i].id == 'current_bids' ){
			$(tabcurrent[i].id).onclick = function () {
				$('cont_main_bids').style.height = 200;
				$('loadbids').style.height = 200;
				getTabData(this.id,'cont_main_bids','loadbids');
				changeTab('current_bids','active');
				changeTab('archive_bids','inactive');
			}
		}
		if( tabcurrent[i].id == 'current_press' ){
			$(tabcurrent[i].id).onclick = function () {
				$('loadpress').style.height = 169;
				$('cont_main_press').style.height = 169;
				getTabData(this.id,'cont_main_press','loadpress');
				changeTab('current_press','active');
				changeTab('archive_press','inactive');
				changeTab('upload_press','inactive');
			}
		}
		if( tabcurrent[i].id == 'current_network' ){
			$(tabcurrent[i].id).onclick = function () {
				$('cont_main_network').style.height = 183;
				$('loadnetwork').style.height = 183;
				getTabData(this.id,'cont_main_network','loadnetwork');
				changeTab('current_network','active');
				changeTab('archive_network','inactive');
			}
		}
		if( tabcurrent[i].id == 'current_messages' ){
			$(tabcurrent[i].id).onclick = function () {
				$('cont_main_messages').style.height = 153;
				$('loadmessages').style.height = 153;
				getTabData(this.id,'cont_main_messages','loadmessages');
				changeTab('current_messages','active');
				changeTab('archive_messages','inactive');
			}
		}
		
		// main content
		if( tabcurrent[i].id == 'current_port' ){
			$(tabcurrent[i].id).onclick = function () {
				$('big_main_port').style.height = 175;
				$('loadport').style.height = 175;
				getTabData(this.id,'big_main_port','loadport');
				changeTab('archive_port','inactive');
				changeTab('current_port','active');
				changeTab('create_album','inactive');
				changeTab('upload','inactive');
			}
		}
		if( tabcurrent[i].id == 'current_favourites' ){
			$(tabcurrent[i].id).onclick = function () {
				$('big_main_favourites').style.height = 170;
				$('loadfavourites').style.height = 170;
				getTabData(this.id,'big_main_favourites','loadfavourites');
				changeTab('archive_favourites','inactive');
				changeTab('current_favourites','active');
			}
		}
		if( tabcurrent[i].id == 'current_collection' ){
			$(tabcurrent[i].id).onclick = function () {
				$('big_main_collection').style.height = 170;
				$('loadcollection').style.height = 170;
				getTabData(this.id,'big_main_collection','loadcollection');
				changeTab('archive_collection','inactive');
				changeTab('current_collection','active');
			}
		}
		if( tabcurrent[i].id == 'current_wish' ){
			$(tabcurrent[i].id).onclick = function () {
				$('big_main_wish').style.height = 170;
				$('loadwish').style.height = 170;
				getTabData(this.id,'big_main_wish','loadwish');
				changeTab('archive_wish','inactive');
				changeTab('current_wish','active');
			}
		}
		if( tabcurrent[i].id == 'current_fav_work' ){
			$(tabcurrent[i].id).onclick = function () {
				$('big_main_fav_work').style.height = 170;
				$('loadfav_work').style.height = 170;
				getTabData(this.id,'big_main_fav_work','loadfav_work');
				changeTab('archive_fav_work','inactive');
				changeTab('current_fav_work','active');
			}
		}
		if( tabcurrent[i].id == 'current_fav_exhib' ){
			$(tabcurrent[i].id).onclick = function () {
				$('big_main_fav_exhib').style.height = 170;
				$('loadfav_exhib').style.height = 170;
				getTabData(this.id,'big_main_fav_exhib','loadfav_exhib');
				changeTab('archive_fav_exhib','inactive');
				changeTab('current_fav_exhib','active');
			}
		}
		if( tabcurrent[i].id == 'current_mystats' ){
			$(tabcurrent[i].id).onclick = function () {
				$('big_main_mystats').style.height = 170;
				$('loadmystats').style.height = 170;
				getTabData(this.id,'big_main_mystats','loadmystats');
				changeTab('archive_mystats','inactive');
				changeTab('current_mystats','active');
			}
		}
		if( tabcurrent[i].id == 'current_sold' ){
			$(tabcurrent[i].id).onclick = function () {
				$('big_main_sold').style.height = 170;
				$('loadsold').style.height = 170;
				getTabData(this.id,'big_main_sold','loadsold');
				changeTab('archive_sold','inactive');
				changeTab('current_sold','active');
			}
		}
		if( tabcurrent[i].id == 'current_myauction' ){
			$(tabcurrent[i].id).onclick = function () {
				$('big_main_myauction').style.height = 170;
				$('loadmyauction').style.height = 170;
				getTabData(this.id,'big_main_myauction','loadmyauction');
				changeTab('archive_myauction','inactive');
				changeTab('current_myauction','active');
			}
		}
		
		// profile
		if( tabcurrent[i].id == 'profile_basic' ){
			$(tabcurrent[i].id).onclick = function () {
				getTabData(this.id,'med_main_basic','loadbasic');
				changeTab('profile_basic','active');
				changeTab('profile_personal','inactive');
			}
		}
	}
	var tabarchive = document.getElementsByClassName('archive');
	for (var i = 0; i < tabarchive.length; i++) {
		// left side
		if( tabarchive[i].id == 'archive_bids' ){
			$(tabarchive[i].id).onclick = function () {
				$('cont_main_bids').style.height = 470;
				$('loadbids').style.height = 470;
				getTabData(this.id,'cont_main_bids','loadbids');
				changeTab('current_bids','inactive');
				changeTab('archive_bids','active');
			}
		}
		if( tabarchive[i].id == 'archive_press' ){
			$(tabarchive[i].id).onclick = function () {
				$('loadpress').style.height = 290;
				$('cont_main_press').style.height = 290;
				getTabData(this.id,'cont_main_press','loadpress');
				changeTab('current_press','inactive');
				changeTab('archive_press','active');
				changeTab('upload_press','inactive');
			}
		}
		if( tabarchive[i].id == 'archive_network' ){
			$(tabarchive[i].id).onclick = function () {
				$('cont_main_network').style.height = 283;
				$('loadnetwork').style.height = 283;
				getTabData(this.id,'cont_main_network','loadnetwork');
				changeTab('current_network','inactive');
				changeTab('archive_network','active');
			}
		}
		if( tabarchive[i].id == 'archive_messages' ){
			$(tabarchive[i].id).onclick = function () {
				$('cont_main_messages').style.height = 153;
				$('loadmessages').style.height = 153;
				getTabData(this.id,'cont_main_messages','loadmessages');
				changeTab('archive_messages','inactive');
				changeTab('archive_messages','active');
			}
		}
		
		// main content
		if( tabarchive[i].id == 'archive_port' ){
			$(tabarchive[i].id).onclick = function () {
				$('big_main_port').style.height = 470;
				$('loadport').style.height = 470;
				getTabData(this.id,'big_main_port','loadport');
				changeTab('archive_port','active');
				changeTab('current_port','inactive');
				changeTab('create_album','inactive');
				changeTab('upload','inactive');
			}
		}
		if( tabarchive[i].id == 'archive_favourites' ){
			$(tabarchive[i].id).onclick = function () {
				$('big_main_favourites').style.height = 470;
				$('loadfavourites').style.height = 470;
				getTabData(this.id,'big_main_favourites','loadfavourites');
				changeTab('archive_favourites','active');
				changeTab('current_favourites','inactive');
			}
		}
		if( tabarchive[i].id == 'archive_collection' ){
			$(tabarchive[i].id).onclick = function () {
				$('big_main_collection').style.height = 470;
				$('loadcollection').style.height = 470;
				getTabData(this.id,'big_main_collection','loadcollection');
				changeTab('archive_collection','active');
				changeTab('current_collection','inactive');
			}
		}
		if( tabarchive[i].id == 'archive_wish' ){
			$(tabarchive[i].id).onclick = function () {
				$('big_main_wish').style.height = 470;
				$('loadwish').style.height = 470;
				getTabData(this.id,'big_main_wish','loadwish');
				changeTab('archive_wish','active');
				changeTab('current_wish','inactive');
			}
		}
		if( tabarchive[i].id == 'archive_fav_work' ){
			$(tabarchive[i].id).onclick = function () {
				$('big_main_fav_work').style.height = 470;
				$('loadfav_work').style.height = 470;
				getTabData(this.id,'big_main_fav_work','loadfav_work');
				changeTab('archive_fav_work','active');
				changeTab('current_fav_work','inactive');
			}
		}
		if( tabarchive[i].id == 'archive_fav_exhib' ){
			$(tabarchive[i].id).onclick = function () {
				$('big_main_fav_exhib').style.height = 470;
				$('loadfav_exhib').style.height = 470;
				getTabData(this.id,'big_main_fav_exhib','loadfav_exhib');
				changeTab('archive_fav_exhib','active');
				changeTab('current_fav_exhib','inactive');
			}
		}
		if( tabarchive[i].id == 'archive_mystats' ){
			$(tabarchive[i].id).onclick = function () {
				$('big_main_mystats').style.height = 470;
				$('loadmystats').style.height = 470;
				getTabData(this.id,'big_main_mystats','loadmystats');
				changeTab('archive_mystats','active');
				changeTab('current_mystats','inactive');
			}
		}
		if( tabarchive[i].id == 'archive_sold' ){
			$(tabarchive[i].id).onclick = function () {
				$('big_main_sold').style.height = 470;
				$('loadsold').style.height = 470;
				getTabData(this.id,'big_main_sold','loadsold');
				changeTab('archive_sold','active');
				changeTab('current_sold','inactive');
			}
		}
		if( tabarchive[i].id == 'archive_myauction' ){
			$(tabarchive[i].id).onclick = function () {
				$('big_main_myauction').style.height = 470;
				$('loadmyauction').style.height = 470;
				getTabData(this.id,'big_main_myauction','loadmyauction');
				changeTab('archive_myauction','active');
				changeTab('current_myauction','inactive');
			}
		}
		
		// profile
		if( tabarchive[i].id == 'profile_personal' ){
			$(tabarchive[i].id).onclick = function () {
				getTabData(this.id,'med_main_basic','loadbasic');
				changeTab('profile_basic','inactive');
				changeTab('profile_personal','active');
			}
		}
		
	}
	var tabinactive = document.getElementsByClassName('inactivetab');
	for (var i = 0; i < tabinactive.length; i++) {
		// create album
		if( tabinactive[i].id == 'create_album' ){
			$(tabinactive[i].id).onclick = function () {
				$('big_main_port').style.height = 200;
				$('loadport').style.height = 200;
				getTabData(this.id,'big_main_port','loadport');
				changeTab('archive_port','inactive');
				changeTab('current_port','inactive');
				changeTab('create_album','active');
				changeTab('upload','inactive');
				$('msg').style.display = 'none';
			}
		}
		// upload artwork
		if( tabinactive[i].id == 'upload' ){
			$(tabinactive[i].id).onclick = function () {
				$('big_main_port').style.height = 600;
				$('loadport').style.height = 600;
				getTabData(this.id,'big_main_port','loadport');
				changeTab('archive_port','inactive');
				changeTab('current_port','inactive');
				changeTab('create_album','inactive');
				changeTab('upload','active');
				$('msg').style.display = 'none';
			}
		}
		// upload press
		if( tabinactive[i].id == 'upload_press' ){
			$(tabinactive[i].id).onclick = function () {
				$('cont_main_press').style.height = 300;
				$('loadpress').style.height = 300;
				getTabData(this.id,'cont_main_press','loadpress');
				changeTab('archive_press','inactive');
				changeTab('current_press','inactive');
				changeTab('upload_press','active');
			}
		}
		// upload press
		if( tabinactive[i].id == 'requests' ){
			$(tabinactive[i].id).onclick = function () {
				$('cont_main_network').style.height = 230;
				$('loadnetwork').style.height = 230;
				getTabData(this.id,'cont_main_network','loadnetwork');
				changeTab('archive_network','inactive');
				changeTab('current_network','inactive');
				changeTab('requests','active');
			}
		}
	}
	
	getTabData('current_bids','cont_main_bids','loadbids');
	getTabData('profile_basic','med_main_basic','loadbasic');
	$('cont_main_network').style.height = 183;
	getTabData('current_network','cont_main_network','loadnetwork');
	getTabData('current_favourites','big_main_favourites','loadfavourites');
	getTabData('current_fav_work','big_main_fav_work','loadfav_work');
	getTabData('current_sold','big_main_sold','loadsold');
	
	if($('big_main_mystats'))
	{
		$('big_main_mystats').style.height = 165;
	}
	
	changeTab('current_bids', 'active');
	changeTab('current_port', 'active');
	changeTab('current_collection', 'active');
	changeTab('current_sold', 'active');
	changeTab('current_myauction', 'active');
	changeTab('current_wish', 'active');
	changeTab('current_favourites', 'active');
	changeTab('current_fav_work', 'active');
	
}
// Output
function getTabData(id,outid,div,start) {
	var url = '/profiletabs.php';
	var rand   = Math.random(9999);
	var uid = document.getElementById('profile_id').value;
	var album = document.getElementById('album').value;
	var album_id = document.getElementById('album_id').value;
	if( start > 0 ){
		var pagestart = start;
	} else { var pagestart = 0; }
	if(album == 1 && id == 'upload'){
		var pars   = 'id=' + id + '&rand=' + rand + '&u=' + uid + '&album=' + album + '&start=' + pagestart;
	} else {
		if(album_id > 0 && id == 'album') {
			var pars   = 'id=' + id + '&rand=' + rand + '&u=' + uid + '&album_id=' + album_id + '&start=' + pagestart;
		} else {
			var pars   = 'id=' + id + '&rand=' + rand + '&u=' + uid + '&start=' + pagestart;
		}
	}
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: function(){
			$(div).style.display = 'block';
		}, 
		onComplete: function(showResponse){
			var newData = showResponse.responseText;
			$(div).style.display = 'none';
			$( outid ).innerHTML = newData;
		}
	} );
}

function cancelUpload(){
	$('big_main_port').style.height = 175;
	$('loadport').style.height = 175;
	getTabData('current_port','big_main_port','loadport');
	changeTab('archive_port','inactive');
	changeTab('current_port','active');
	changeTab('create_album','inactive');
	changeTab('upload','inactive');
}


function editArtwork(id) {
	var url = '/profiletabs.php';
	var rand   = Math.random(9999);
	var uid = document.getElementById('profile_id').value;
	var pars   = 'id=upload&rand=' + rand + '&u=' + uid + '&artwork=' + id;
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: function(){
			$('big_main_port').style.height = 650;
			$('loadport').style.display = 'block';
			$('loadport').style.height = 650;
			$('msg').style.display = 'none';
		}, 
		onComplete: function(showResponse){
			var newData = showResponse.responseText;
			$('loadport').style.display = 'none';
			$('big_main_port').style.height = 650;
			$('big_main_port').innerHTML = newData;
		}
	} );
}

function delArtwork(id) {
	var url = '/profiletabs.php';
	var rand   = Math.random(9999);
	var uid = document.getElementById('profile_id').value;
	var pars   = 'id=upload_delete&rand=' + rand + '&u=' + uid + '&artwork=' + id;
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: function(){
			$('big_main_port').style.height = 175;
			$('loadport').style.display = 'block';
			$('loadport').style.height = 175;
		}, 
		onComplete: function(showResponse){
			var newData = showResponse.responseText;
			$('loadport').style.display = 'none';
			$('big_main_port').style.height = 175;
			$('big_main_port').innerHTML = newData;
		}
	} );
}

function editAlbum(id) {
	var url = '/profiletabs.php';
	var rand   = Math.random(9999);
	var uid = document.getElementById('profile_id').value;
	var pars   = 'id=create_album&rand=' + rand + '&u=' + uid + '&album=' + id;
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: function(){
			$('big_main_port').style.height = 200;
			$('loadport').style.display = 'block';
			$('loadport').style.height = 200;
			$('msg').style.display = 'none';
		}, 
		onComplete: function(showResponse){
			var newData = showResponse.responseText;
			$('loadport').style.display = 'none';
			$('big_main_port').style.height = 200;
			$('big_main_port').innerHTML = newData;
		}
	} );
}

function delAlbum(id) {
	var url = '/profiletabs.php';
	var rand   = Math.random(9999);
	var uid = document.getElementById('profile_id').value;
	var pars   = 'id=album_delete&rand=' + rand + '&u=' + uid + '&album=' + id;
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: function(){
			$('big_main_port').style.height = 175;
			$('loadport').style.display = 'block';
			$('loadport').style.height = 175;
		}, 
		onComplete: function(showResponse){
			var newData = showResponse.responseText;
			$('loadport').style.display = 'none';
			$('big_main_port').style.height = 175;
			$('big_main_port').innerHTML = newData;
		}
	} );
}

function editPress(id) {
	var url = '/profiletabs.php';
	var rand   = Math.random(9999);
	var uid = document.getElementById('profile_id').value;
	var pars   = 'id=upload_press&rand=' + rand + '&u=' + uid + '&press=' + id;
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: function(){
			$('cont_main_press').style.height = 300;
			$('loadpress').style.display = 'block';
			$('loadpress').style.height = 300;
			$('msg').style.display = 'none';
		}, 
		onComplete: function(showResponse){
			var newData = showResponse.responseText;
			$('loadpress').style.display = 'none';
			$('cont_main_press').style.height = 300;
			$('cont_main_press').innerHTML = newData;
		}
	} );
}

function cancelPress(){
	$('cont_main_press').style.height = 169;
	$('loadpress').style.height = 169;
	getTabData('current_press','cont_main_press','loadpress');
	changeTab('archive_press','inactive');
	changeTab('current_press','active');
	changeTab('upload_press','inactive');
}

function delPress(id) {
	var url = '/profiletabs.php';
	var rand   = Math.random(9999);
	var uid = document.getElementById('profile_id').value;
	var pars   = 'id=press_delete&rand=' + rand + '&u=' + uid + '&press=' + id;
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: function(){
			$('cont_main_press').style.height = 169;
			$('loadpress').style.display = 'block';
			$('loadpress').style.height = 169;
		}, 
		onComplete: function(showResponse){
			var newData = showResponse.responseText;
			$('loadpress').style.display = 'none';
			$('cont_main_press').style.height = 169;
			$('cont_main_press').innerHTML = newData;
		}
	} );
}

// Tab Function [END]

// Upload Artwork
function LimitAttach(form, file) {
    extArray = new Array(".jpg", ".png");
    allowSubmit = false;
    if (!file) return;
    while (file.indexOf("\\") != -1)
    file = file.slice(file.indexOf("\\") + 1);
    ext = file.slice(file.lastindexOf(".")).toLowerCase();
    for (var i = 0; i < extArray.length; i++) {
    	if (extArray[i] == ext) { allowSubmit = true; break; }
    }
    if (allowSubmit) return true;
    else
	alert("Please only upload files that end in types:  " + (extArray.join("  ")) + "\nPlease select a new "
	+ "file to upload and submit again.");
    return false;
}

function chkUpload(){
	if (document.upload.title.value == ""){
		alert("Please enter a title.");
		document.upload.title.focus();
		return false;
	}
	if (document.upload.status[0].checked == false && document.upload.status[1].checked == false && document.upload.status[2].checked == false){
		alert("Please choose a status.");
		document.upload.status[0].focus();
		return false;
	}
	if ((document.upload.status[0].checked == true || document.upload.status[1].checked == true) && document.upload.price.value == ""){
			alert("Please enter a price.");
			document.upload.price.focus();
			return false;
	}
	if ((document.upload.status[0].checked == true || document.upload.status[1].checked == true) && isNaN(parseFloat(document.upload.price.value))){
			alert("Please enter a valid price.");
			document.upload.price.focus();
			return false;
	}
	if ((document.upload.status[0].checked == true || document.upload.status[1].checked == true) && parseFloat(document.upload.price.value) <= 0){
			alert("Please enter a positive price.");
			document.upload.price.focus();
			return false;
	}
	if ((document.upload.status[0].checked == true || document.upload.status[1].checked == true) && document.upload.shipping_costs.value == ""){
			alert("Please enter a domestic shipping cost.");
			document.upload.shipping_costs.focus();
			return false;
	}
	if ((document.upload.status[0].checked == true || document.upload.status[1].checked == true) && document.upload.intl_shipping_costs.value == ""){
			alert("Please enter a international shipping cost.");
			document.upload.intl_shipping_costs.focus();
			return false;
	}
	if ((document.upload.status[0].checked == true || document.upload.status[1].checked == true) && document.upload.width.value == ""){
			alert("Please enter a width.");
			document.upload.width.focus();
			return false;
	}
	if ((document.upload.status[0].checked == true || document.upload.status[1].checked == true) && isNaN(parseFloat(document.upload.width.value))){
			alert("Please enter a valid width.");
			document.upload.width.focus();
			return false;
	}
	if ((document.upload.status[0].checked == true || document.upload.status[1].checked == true) && parseFloat(document.upload.width.value) <= 0){
			alert("Please enter a valid width.");
			document.upload.width.focus();
			return false;
	}
	if ((document.upload.status[0].checked == true || document.upload.status[1].checked == true) && document.upload.height.value == ""){
			alert("Please enter a height.");
			document.upload.height.focus();
			return false;
	}
	if ((document.upload.status[0].checked == true || document.upload.status[1].checked == true) && isNaN(parseFloat(document.upload.height.value))){
			alert("Please enter a valid height.");
			document.upload.height.focus();
			return false;
	}
	if ((document.upload.status[0].checked == true || document.upload.status[1].checked == true) && parseFloat(document.upload.height.value) <= 0){
			alert("Please enter a valid height.");
			document.upload.height.focus();
			return false;
	}
	if (document.upload.image.value == ""){
		alert("Please choose a picture.");
		document.upload.image.focus();
		return false;
	}
	if (document.upload.category[0].checked == false && document.upload.category[1].checked == false && document.upload.category[2].checked == false){
		alert("Please choose a category.");
		document.upload.category[0].focus();
		return false;
	}
	if (document.upload.terms.checked == false){
		alert("Please accept our terms of use.");
		document.upload.terms.focus();
		return false;
	}
	
	if(document.upload.status[1].checked == true){
		if (document.upload.end_date.value == ""){
			alert("Please enter an end date for your auction.");
			document.upload.end_date.focus();
			return false;
		}
		if (document.upload.shipping_costs.value == ""){
			alert("Please enter shipping costs for your auction.");
			document.upload.shipping_costs.focus();
			return false;
		}
		if (document.upload.item_location.value == ""){
			alert("Please enter an item location for your auction.");
			document.upload.item_location.focus();
			return false;
		}
	}
	
	return LimitAttach(document.upload, document.upload.image.value);
}
function chkEdit(){
	if (document.upload.title.value == ""){
		alert("Please enter a title.");
		document.upload.title.focus();
		return false;
	}
	if (document.upload.status[0].checked == false && document.upload.status[1].checked == false && document.upload.status[2].checked == false){
		alert("Please choose a status.");
		document.upload.status[0].focus();
		return false;
	}
	if (document.upload.category[0].checked == false && document.upload.category[1].checked == false && document.upload.category[2].checked == false){
		alert("Please choose a category.");
		document.upload.category[0].focus();
		return false;
	}
	if(document.upload.status[1].checked == true){
		if (document.upload.end_date.value == ""){
			alert("Please enter an end date for your auction.");
			document.upload.end_date.focus();
			return false;
		}
		if (document.upload.shipping_costs.value == ""){
			alert("Please enter shipping costs for your auction.");
			document.upload.shipping_costs.focus();
			return false;
		}
		if (document.upload.item_location.value == ""){
			alert("Please enter an item location for your auction.");
			document.upload.item_location.focus();
			return false;
		}
	}
	return LimitAttach(document.upload, document.upload.image.value);
}
// Remove Artwork
function removeUpload(id){
	if( confirm("Are you sure to delete this Artwork?") ){
		delArtwork(id);
	} else {
		cancelUpload();
	}
}
// Remove Album
function removeAlbum(id){
	if( confirm("Are you sure to delete this Album?") ){
		delAlbum(id);
	} else {
		cancelUpload();
	}
}
// Remove Press
function removePress(id){
	if( confirm("Are you sure to delete this Press Release?") ){
		delPress(id);
	} else {
		cancelPress();
	}
}

// Create Album
function chkAlbum(){
	if (document.album.title.value == ""){
		alert("Please enter a title.");
		document.album.title.focus();
		return false;
	}
}
// Recommend
function checkrecommendform(){
	if (document.recommend.rec_email.value == ""){
		alert("Please enter an email.");
		document.recommend.rec_email.focus();
		return false;
	}
}
// Upload Press
function LimitAttachPress(form, file) {
    extArray = new Array(".pdf");
    allowSubmit = false;
    if (!file) return;
    while (file.indexOf("\\") != -1)
    file = file.slice(file.indexOf("\\") + 1);
    ext = file.slice(file.lastindexOf(".")).toLowerCase();
    for (var i = 0; i < extArray.length; i++) {
    	if (extArray[i] == ext) { allowSubmit = true; break; }
    }
    if (allowSubmit) return true;
    else
	alert("Please only upload files that end in types:  " + (extArray.join("  ")) + "\nPlease select a new "
	+ "file to upload and submit again.");
    return false;
}

function chkUploadPress(){
	if (document.upload_press.title_mag.value == ""){
		alert("Please enter a title of the magazine.");
		document.upload_press.title_mag.focus();
		return false;
	}
	if (document.upload_press.pdf.value == ""){
		alert("Please choose a pdf.");
		document.upload_press.pdf.focus();
		return false;
	}
	if (document.upload_press.title_article.value == ""){
		alert("Please enter a title of the article.");
		document.upload_press.title_article.focus();
		return false;
	}
	if (document.upload_press.terms.checked == false){
		alert("Please accept our terms of use.");
		document.upload_press.terms.focus();
		return false;
	}
	if(document.upload_press.date_day.value < 0 || document.upload_press.date_day.value > 32){
		alert("Wrong day format. Please enter a valid day.");
		document.upload_press.date_day.focus();
		return false;
	}
	if(document.upload_press.date_year.value.length < 4){
		alert("Wrong year format. Please enter a valid year.");
		document.upload_press.date_year.focus();
		return false;
	}
	
	return LimitAttachPress(document.upload_press, document.upload_press.pdf.value);
}
function chkEditPress(){
	if (document.upload_press.title_mag.value == ""){
		alert("Please enter a title of the magazine.");
		document.upload_press.title_mag.focus();
		return false;
	}
	if (document.upload_press.pdf.value != ""){
		return LimitAttachPress(document.upload_press, document.upload_press.pdf.value);
	}
	if (document.upload_press.title_article.value == ""){
		alert("Please enter a title of the article.");
		document.upload_press.title_article.focus();
		return false;
	}
	if(document.upload_press.date_day.value < 0 || document.upload_press.date_day.value > 32){
		alert("Wrong day format. Please enter a valid day.");
		document.upload_press.date_day.focus();
		return false;
	}
	if(document.upload_press.date_year.value.length < 4){
		alert("Wrong year format. Please enter a valid year.");
		document.upload_press.date_year.focus();
		return false;
	}
}

// Switch Navbar Containers
function showSold() {
	sold = document.getElementById('cont_big_sold');
	myauction = document.getElementById('cont_big_myauction');
	fav_artists = document.getElementById('cont_big_fav_artists');
	fav_work = document.getElementById('cont_big_fav_works');
	acquired = document.getElementById('cont_big_collection');
	stats = document.getElementById('cont_big_stats');
	if(myauction.style.display == ''){
		new Effect.Fade(myauction, {duration: 0});
	}
	if(fav_work.style.display == ''){
		new Effect.Fade(fav_work, {duration: 0});
	}
	if(acquired.style.display == ''){
		new Effect.Fade(acquired, {duration: 0});
	}
	if(stats && stats.style.display == ''){
		new Effect.Fade(stats, {duration: 0});
	}
	if(fav_artists.style.display == ''){
		new Effect.Fade(fav_artists, {duration: 0});
	}
	if(sold.style.display == 'none'){
		new Effect.Appear(sold, {duration: 0});
	}
}

function showMyAuction() {
	getTabData('current_myauction','big_main_myauction','loadmyauction');
	sold = document.getElementById('cont_big_sold');
	myauction = document.getElementById('cont_big_myauction');
	fav_artists = document.getElementById('cont_big_fav_artists');
	fav_work = document.getElementById('cont_big_fav_works');
	acquired = document.getElementById('cont_big_collection');
	stats = document.getElementById('cont_big_stats');
	if(sold.style.display == ''){
		new Effect.Fade(sold, {duration: 0});
	}
	if(fav_artists.style.display == ''){
		new Effect.Fade(fav_artists, {duration: 0});
	}
	if(fav_work.style.display == ''){
		new Effect.Fade(fav_work, {duration: 0});
	}
	if(acquired.style.display == ''){
		new Effect.Fade(acquired, {duration: 0});
	}
	if(stats && stats.style.display == ''){
		new Effect.Fade(stats, {duration: 0});
	}
	if(myauction.style.display == 'none'){
		new Effect.Appear(myauction, {duration: 0});
	}
}

function showFavArtists() {
	sold = document.getElementById('cont_big_sold');
	myauction = document.getElementById('cont_big_myauction');
	fav_artists = document.getElementById('cont_big_fav_artists');
	fav_work = document.getElementById('cont_big_fav_works');
	acquired = document.getElementById('cont_big_collection');
	stats = document.getElementById('cont_big_stats');
	if(sold.style.display == ''){
		new Effect.Fade(sold, {duration: 0});
	}
	if(myauction.style.display == ''){
		new Effect.Fade(myauction, {duration: 0});
	}
	if(fav_work.style.display == ''){
		new Effect.Fade(fav_work, {duration: 0});
	}
	if(acquired.style.display == ''){
		new Effect.Fade(acquired, {duration: 0});
	}
	if(stats && stats.style.display == ''){
		new Effect.Fade(stats, {duration: 0});
	}
	if(fav_artists.style.display == 'none'){
		new Effect.Appear(fav_artists, {duration: 0});
	}
}

function showFavWork() {
	sold = document.getElementById('cont_big_sold');
	myauction = document.getElementById('cont_big_myauction');
	fav_artists = document.getElementById('cont_big_fav_artists');
	fav_work = document.getElementById('cont_big_fav_works');
	acquired = document.getElementById('cont_big_collection');
	stats = document.getElementById('cont_big_stats');
	if(sold.style.display == ''){
		new Effect.Fade(sold, {duration: 0});
	}
	if(myauction.style.display == ''){
		new Effect.Fade(myauction, {duration: 0});
	}
	if(fav_artists.style.display == ''){
		new Effect.Fade(fav_artists, {duration: 0});
	}
	if(acquired.style.display == ''){
		new Effect.Fade(acquired, {duration: 0});
	}
	if(stats && stats.style.display == ''){
		new Effect.Fade(stats, {duration: 0});
	}
	if(fav_work.style.display == 'none'){
		new Effect.Appear(fav_work, {duration: 0});
	}
}

function showAcquired() {
	sold = document.getElementById('cont_big_sold');
	myauction = document.getElementById('cont_big_myauction');
	fav_artists = document.getElementById('cont_big_fav_artists');
	fav_work = document.getElementById('cont_big_fav_works');
	acquired = document.getElementById('cont_big_collection');
	stats = document.getElementById('cont_big_stats');
	if(sold.style.display == ''){
		new Effect.Fade(sold, {duration: 0});
	}
	if(myauction.style.display == ''){
		new Effect.Fade(myauction, {duration: 0});
	}
	if(fav_artists.style.display == ''){
		new Effect.Fade(fav_artists, {duration: 0});
	}
	if(fav_work.style.display == ''){
		new Effect.Fade(fav_work, {duration: 0});
	}
	if(stats && stats.style.display == ''){
		new Effect.Fade(stats, {duration: 0});
	}
	if(acquired.style.display == 'none'){
		new Effect.Appear(acquired, {duration: 0});
	}
}

function showStats() {
	sold = document.getElementById('cont_big_sold');
	myauction = document.getElementById('cont_big_myauction');
	fav_artists = document.getElementById('cont_big_fav_artists');
	fav_work = document.getElementById('cont_big_fav_works');
	acquired = document.getElementById('cont_big_collection');
	stats = document.getElementById('cont_big_stats');
	if(sold.style.display == ''){
		new Effect.Fade(sold, {duration: 0});
	}
	if(myauction.style.display == ''){
		new Effect.Fade(myauction, {duration: 0});
	}
	if(fav_artists.style.display == ''){
		new Effect.Fade(fav_artists, {duration: 0});
	}
	if(fav_work.style.display == ''){
		new Effect.Fade(fav_work, {duration: 0});
	}
	if(acquired.style.display == ''){
		new Effect.Fade(acquired, {duration: 0});
	}
	if(stats && stats.style.display == 'none'){
		new Effect.Appear(stats, {duration: 0});
	}
}
