var theicon = '';

function settheme(){
	selObj = document.getElementById('theme');
	selIndex = selObj.selectedIndex;
	selectedtheme = selObj.options[selIndex].value;
	$('preview').style.backgroundImage = 'url("/skins/' + selectedtheme + '/preferences-preview.jpg")';
	document.getElementById('form_theme_method').value = selectedtheme;
}

function placeobject(target,item,selected){
	//document.getElementById(target).innerHTML = '<a href="javascript:void(0);"><IMG SRC="images/'+item+'_module_sm.jpg" BORDER="0" class="draggable" NAME="area_'+item+'" ID="area_'+item+'" onmousedown="selecteditem = \''+item+'\'; theicon = \''+item+'_module\';" onMouseOut=""  width="133" height="89"></a>';
	document.getElementById(target).innerHTML = '<img src="/images/my_prefs_assets/med_mods/'+item+'.jpg" alt=""  class="draggable" NAME="area_'+item+'" ID="area_'+item+'" onmousedown="selecteditem = \''+item+'\'; theicon = \''+item+'\';" onMouseOut=""/>';
	document.getElementById('module_method'+selected).value = item;
}

function getcontent(target, urlstring) {
		$(target).innerHTML = "<h5>Searching...</h5>" 
		new Ajax.Updater(target, urlstring, {asynchronous:true});
	}
	
	

function changemessage(){
	if (document.getElementById('messagetext').value.length == 0){
		document.getElementById('playermessage').className = 'hidden';
	}else{
		document.getElementById('playermessage').className = '';
		document.getElementById('playermessage').innerHTML = document.getElementById('messagetext').value;
	}
	document.getElementById('form_homemessage').value = document.getElementById('messagetext').value;
}

function searchimages()
	{
		$('pictureSearch').value = $('pictureSearch').value.replace(/([^0-9a-zA-Z\s])/g, "");
		//document.myPreferencesForm.pictureSearch.value = document.myPreferencesForm.pictureSearch.value.replace(/'/g,"");
		if($('pictureSearch').value.length > 0){
		new Ajax.Updater($('photo-search'), "/ajax/myPreferencesImageSearch.cfm?Ntt=" + $('pictureSearch').value + "&Nr=d_Asset_Type%3aImage&Ntk=All&N=0&Nty=1", {asynchronous:true});
		}
	}
	
function imagePopulate(guidImageId)
	{
		$('playerimage').innerHTML = "<img src='images/pictures/player/" + guidImageId + ".jpg' border='0' width='194' height='132'>";
		document.getElementById('form_homeimage').value = guidImageId;
	}