var base_url = "http://www.cenorestaurant.com";

var link_nohandler= window.clientInformation ? null : window.undefined;

function link_down() {
    this.onfocus= this.blur;
}

function link_up() {
    this.onfocus= link_nohandler;
}

function link_bind() {
    for (var i= document.links.length; i-->0;) {
        document.links[i].onmousedown= link_down;
        document.links[i].onmouseup= link_up;
    }
}

function changeImgSrc(id,v) { var el = document.getElementById(id); if (el) el.setAttribute('src',v); }

function changeLinks(id, col) {
	
	var el = document.getElementById(id);
	
	document.getElementById('floorplans_nav').style.display='none';
	
	document.getElementById('front_aspect').style.color='#'+col;
	document.getElementById('rear_aspect').style.color='#'+col;
	document.getElementById('enquire').style.color='#'+col;
	document.getElementById('floorplans').style.color='#'+col;

	el.style.color='#333333';
}

function deleteProject(uid) {
	
	if ( confirm('Are you sure you wish to delete this project?\nThis can NOT be undone.') ) {
		$("#data").load(base_url + "/includes/ajax.php", { action: 'deleteproject', theuid: uid });
		
 		window.location = base_url + '/cms/projects/';
 
 	} else {
		 return false;
	}
}

function deleteNews(uid) {
	
	if ( confirm('Are you sure you wish to delete this news article?\nThis can NOT be undone.') ) {
		$("#data").load(base_url + "/includes/ajax.php", { action: 'deletenews', theuid: uid });
		
 		window.location = base_url + '/cms/news/';
 
 	} else {
		 return false;
	}
}

function deleteFadePhoto(fadeid,uid) {
	if ( confirm('Are you sure you wish to delete this image?\nThis can NOT be undone.') ) {
		$("#headersdata").load(base_url + "/includes/ajax.php", { action: 'deletefadephoto', theuid: fadeid });
		 		
 		document.getElementById('id_' + uid).style.display='none';
 		
 		// window.location = base_url + '/cms/news/edit/' + newsid + '/';
 
 	} else {
		 return false;
	}
}

function deleteNewsPhoto(uid, newsid) {
	
	if ( confirm('Are you sure you wish to delete this image?\nThis can NOT be undone.') ) {
		$("#data").load(base_url + "/includes/ajax.php", { action: 'deletenewsphoto', theuid: uid });
		 		
 		document.getElementById('id_' + uid).style.display='none';
 		
 		// window.location = base_url + '/cms/news/edit/' + newsid + '/';
 
 	} else {
		 return false;
	}
}

function deleteCourseAsssociation(uid, menuid) {
	
	if ( confirm('Are you sure you wish to delete this Course form the menu?\nThis can NOT be undone.') ) {
		
			var url = base_url + '/includes/ajax.php?action=deleteCourseAsssociation&thecourseid=' + uid + '&themenuid=' + menuid;

			var ajax = new Ajax.Request(url,{
				method: 'post'
			});
		
// 		$("#data").load(base_url + "/includes/ajax.php", { action: 'deleteCourseAsssociation', theuid: uid });
// 		 		
 		// alert(uid);
 		
 		document.getElementById('mc_' + uid).style.display='none';
 		
 		// window.location = base_url + '/cms/news/edit/' + newsid + '/';
 
 	} else {
		 return false;
	}
}

function deleteDishAsssociation(uid, courseid, menuid) {
	
	if ( confirm('Are you sure you wish to delete this Dish form the course?\nThis can NOT be undone.') ) {
		
			var url = base_url + '/includes/ajax.php?action=deleteDishAsssociation&dishuid=' + uid + '&thecourseid=' + courseid + '&menuid=' + menuid;

			var ajax = new Ajax.Request(url,{
				method: 'post'
			});
		
// 		$("#data").load(base_url + "/includes/ajax.php", { action: 'deleteCourseAsssociation', theuid: uid });
// 		 		
 		// alert(uid);
 		
 		document.getElementById('mc_' + uid).style.display='none';
 		
 		// window.location = base_url + '/cms/news/edit/' + newsid + '/';
 
 	} else {
		 return false;
	}
}


function deleteProjectsPhoto(uid, newsid) {
	
	if ( confirm('Are you sure you wish to delete this image?\nThis can NOT be undone.') ) {
		$("#data").load(base_url + "/includes/ajax.php", { action: 'deleteprojectsphoto', theuid: uid });
		 		
 		document.getElementById('id_' + uid).style.display='none';
 		
 		// window.location = base_url + '/cms/news/edit/' + newsid + '/';
 
 	} else {
		 return false;
	}
}
