Array.prototype.inArray = function (value) {
	var i;
	for (i=0; i < this.length; i++) {
		if (this[i] === value) {
			return true;
		}
	}
	return false;
};

function return_dir(uid) {
	return_str=uid.substr(1,2)+"/"+uid;
	 return(return_str);
}


// nav
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function visit_user(obj,mikon_id) {
	//alert(obj.selectedIndex);
	if ( obj.options[obj.selectedIndex].value ) {
		window.location.href="/people/"+obj.options[obj.selectedIndex].value+"/"+mikon_id;
	} 
    
}
function visit_shared_with(obj) {
	visit_user(obj,mikon_db_id);
}
function visit_remixer(obj) {
	window.location.href="/people/"+obj.options[obj.selectedIndex].value;
	 
}

function make_shared_with(usernames,users,privates) {
	dropdown_usernames=usernames.split(",");
	dropdown_users=users.split(",");
	
	$("shared_with_select").options.length=0;
	total=0;
	for (i=0; i < dropdown_usernames.length; i++) {
		if (dropdown_usernames[i]!=which_user) {
			 
			$("shared_with_select").options[total+1]=new Option(dropdown_users[i], dropdown_usernames[i], false, false);
			total++;
		}
	}
 	var all_shared=(total+parseFloat(privates));
 	 
	$("shared_with_select").options[0]=new Option(all_shared+" other users", "", true, false);
 	
 	if ( privates >=1 ) $("shared_with_select").options[$("shared_with_select").options.length]=new Option("["+privates+" private]", "", false, false);
	$("shared_with_select").options[0].selected=true;
}
function change_opacity(id,opacity) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 
 

function toggle(which,foc) {
	if (document.getElementById(which).style.display == 'none') {
		document.getElementById(which).style.display = 'block';
		if (arguments.length > 1) {	
			document.getElementById(foc).focus();
		}
	} else {
		document.getElementById(which).style.display = 'none';
	}
}

function toggle_set(which) {
	if (document.getElementById(which+'_open').style.display == 'none') {
		document.getElementById(which+'_open').style.display = 'block';
		document.getElementById(which+'_closed').style.display = 'none';
	} else {
		document.getElementById(which+'_open').style.display = 'none';
		document.getElementById(which+'_closed').style.display = 'block';
	}
}

function toggle_vis(which,foc,x,y) {
	//alert(which + ", " + foc);
	if (document.getElementById(which).style.visibility == 'hidden') {
		document.getElementById(which).style.visibility = 'visible';
		document.getElementById(which).style.right = x+'px';
		document.getElementById(which).style.top = y+'px';
		if (arguments.length > 1) {	
			document.getElementById(foc).focus();
		}
	} else {
		document.getElementById(which).style.visibility = 'hidden';
	}
}

function toggle_details(which) {
	//alert(which + ", " + foc);
	if (document.getElementById(which).style.visibility == 'hidden') {
		document.getElementById(which).style.visibility = 'visible';
		document.getElementById(which).style.top = '0';
		document.getElementById(which).style.left = '68px';
		if (arguments.length > 1) {	
			document.getElementById(foc).focus();
		}
	} else {
		document.getElementById(which).style.visibility = 'hidden';
	}
}

function popHelp(a) {
  new_win = window.open('/pop/help.html#'+a,'help','resizable,scrollbars=yes,width=550,height=500');
  new_win.focus();
}

function confirm_delete() {
	var agree=confirm("Are you sure you wish to delete this?");
	if (agree) {
		return true;
	} else {
		return false;
	}
}
function get_random(max_num){
    var ranNum= Math.floor(Math.random()*max_num);
    return ranNum;
}
 

function process_return() {
	 
	if (xmlhttp.readyState==4) {
		var response = xmlhttp.responseText;
		 
		status_obj = document.getElementById((which_status_obj));
		status_obj.style.display = 'inline';
		status_obj.innerHTML=response;
		 
	 	 
		setTimeout('Effect.Fade(status_obj,{duration:0.5})',3000)


		
	}
}

// -->
