// JavaScript Document


/*
#################################################################################
FUNCTION NAME:	doBold()
Author: 		Joel Kanning (Banik Communications)
Created: 		4/11/07	
---------------------------------------------------------------------------------
Adds bold text in content
#################################################################################
*/
function toggleDivs(div1, div2)
{
	document.getElementById(div1).style.display = "none";
	document.getElementById(div2).style.display = "";
}

/*
#################################################################################
FUNCTION NAME:	doBold()
Author: 		Joel Kanning (Banik Communications)
Created: 		4/11/07	
---------------------------------------------------------------------------------
Adds bold text in content
#################################################################################
*/
function doBold(form, elem)
{
	var text = prompt("Enter the text you want to be in bold below:","");
	if(text != null)
	{
		document.update.content.value = document.update.content.value + "<strong>" + text + "</strong>";

	}
}

/*
#################################################################################
FUNCTION NAME:	doItalics()
Author: 		Joel Kanning (Banik Communications)
Created: 		4/11/07	
---------------------------------------------------------------------------------
Adds italic text in content
#################################################################################
*/
function doItalics()
{
	var text = prompt("Enter the text you want to be in italics below:","");
	if(text != null)
	{
		document.update.content.value = document.update.content.value + "<em>" + text + "</em>";
	}
}

/*
#################################################################################
FUNCTION NAME:	doEmail()
Author: 		Joel Kanning (Banik Communications)
Created: 		4/11/07	
---------------------------------------------------------------------------------
Adds email link in content
#################################################################################
*/
function doEmail()
{
	var text = prompt("Enter the email address below:","");
	if(text != null)
	{
		document.update.content.value = document.update.content.value + "<a href=mailto:" + text + ">" + text + "</a>";
	}
}

/*
#################################################################################
FUNCTION NAME:	doURL()
Author: 		Joel Kanning (Banik Communications)
Created: 		4/11/07	
---------------------------------------------------------------------------------
Adds URL link in content
#################################################################################
*/
function doURL()
{
	var url = prompt("Step 1 - Enter the URL:","http://");
	if(url != null)
	{
		url = url.replace("http:\/\/","");
		var text = prompt("Step 2 - Enter the link text:",url);
		if(text != null)
		{
			document.update.content.value = document.update.content.value + "<a href=http://" + url + " target=_blank>" + text + "</a>";
		}
	}
}

function toggleCS(thediv,thelink)
{
	if(document.getElementById(thediv).style.display=="none")
	{
		document.getElementById(thediv).style.display="";
		document.getElementById(thelink).innerHTML = "Close Details";
	}
	else
	{
		document.getElementById(thediv).style.display="none";
		document.getElementById(thelink).innerHTML = "Open Details";
	}
}

/*
#################################################################################
FUNCTION NAME:	confirmDelete()
Author: 		Joel Kanning (Banik Communications)
Created: 		4/21/07	
---------------------------------------------------------------------------------
Display confirmation dialog before deleting
#################################################################################
*/
function confirmDelete(id)
{
	if (confirm("Are you sure you want to delete this horse?\nThis action cannot be undone."))
	{
		document.location.href="?delete=" + id;
	}
	else
		return false;
}

/*
#################################################################################
FUNCTION NAME:	deletePhoto(horse_id, photo_id)
Author: 		Joel Kanning (Banik Communications)
Created: 		4/24/07	
---------------------------------------------------------------------------------
Display confirmation dialog before deleting
#################################################################################
*/
function deletePhoto(horse_id ,photo_id)
{
	if (confirm("Are you sure you want to delete this photo?\nThis action cannot be undone."))
	{
		document.location.href="index.php?photos=" + horse_id + "&delete=" + photo_id;
	}
	else
		return false;
}

/*
#################################################################################
FUNCTION NAME:	deleteThumb(horse_id, thumb_id)
Author: 		Joel Kanning (Banik Communications)
Created: 		4/24/07	
---------------------------------------------------------------------------------
Display confirmation dialog before deleting
#################################################################################
*/
function deleteThumb(horse_id ,thumb_id)
{
	if (confirm("Are you sure you want to delete this thumbnail?\nThis action cannot be undone."))
	{
		document.location.href="index.php?photos=" + horse_id + "&delete_thumb=" + thumb_id;
	}
	else
		return false;
}

/*
#################################################################################
FUNCTION NAME:	getImageWidth(myImage)
Author: 		Joel Kanning (Banik Communications)
Created: 		4/30/07	
---------------------------------------------------------------------------------
Get image width
#################################################################################
*/
function getImageWidth(myImage) {
	var x, obj;
	if (document.layers) {
		var img = getImage(myImage);
		return img.width;
	} else {
		return getElementWidth(myImage);
	}
	return -1;
}

/*
#################################################################################
FUNCTION NAME:	getImageHeight(myImage)
Author: 		Joel Kanning (Banik Communications)
Created: 		4/30/07	
---------------------------------------------------------------------------------
Get image height
#################################################################################
*/
function getImageHeight(myImage) {
	var y, obj;
	if (document.layers) {
		var img = getImage(myImage);
		return img.height;
	} else {
		return getElementHeight(myImage);
	}
	return -1;
}
