var base_url = "http://www.gentleltd.co.uk";

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.') ) {
		$("#data").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.') ) {
		// alert(base_url);
		
		$("#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 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;
	}
}
