drawFuncs= function (){
	this.deleteMedia= function(n1){ // delete media
		this.deleteItem('media',n1);
	}
	this.deleteItem= function(type, n1){ // delete different things
		if(confirm('Are you sure you want to delete?')){
			$.get(url_root+'/ajax1.php?op=delete_item&type='+type+'&id='+n1, function(data) {
				if(type=='media'){
					window.location.href=data.url;
				}else if(type=='image'){
					window.location.reload();
				}else if(type=='hdmedia'){
				}
			}, "json");
		}
	}
	this.changeItem= function(type, n1, defvalue, target, n2, n3){ // change different things
		var chmsg='Please enter new value';
		if(defvalue==null){
			if(el(target)){
				defvalue=el(target).innerHTML;
			}
		}
		var msg=prompt(chmsg, defvalue);
		if(msg!=null){
			var aj = new ajax();
			aj.init();
			aj.success = function (){
				if(type=='image'){
					if(el(target)){
						el(target).innerHTML=msg;
					}
				}
			}
			if(type=='image'){
				var params='ajax1.php?op=change_item&type='+type+'&id='+n1+'&newvalue='+remq(msg);
			}
			aj.load('GET', url_root+'/'+params,true);
		}
	}
	this.createCut= function(proj_id, fcall_id, cut_title, cut_desc){
		var params = 'op=create_new_cut';
		params += '&projid='+proj_id;
		params += '&fcallid='+fcall_id;
		params += '&title=' + encodeURIComponent(cut_title);
		params += '&desc=' + encodeURIComponent(cut_desc);
		var create_cut_url = ajax_url+'/ajax-cut.php?'+params;
		$.get(create_cut_url, function(data) {
			if(data.success==1){
				window.location = data.edit_url;
			}else{
				alert(data.error);
			}
		}, 'json');
		return false;
	}
}
var drawFuncs = new drawFuncs();

