var image1 = new Image();
image1.src = 'images/frontend/site/btnSetAsHomepage_over.gif';
var image2 = new Image();
image2.src = 'images/frontend/site/btnSendToFriend_over.gif';
var image3 = new Image();
image3.src = 'images/frontend/site/btnPrint_over.gif';

function ChangeTarget(url,clientId)
{
	document.getElementById(clientId).action = url; 
}

function EnableButton(checkboxId, buttonId)
{
	if (document.getElementById(checkboxId.id).checked == true)
	{
		alert("checked");
		btnPay = document.getElementById(buttonId);
		btnPay.Enable = false;
	}
	else
	{
		alert("unchecked");
		btnPay = document.getElementById(buttonId);
		btnPay.Enable = true;
	}
}

function ValidateSearchString(objval)
{
	if (TrimAll(document.getElementById(objval).value) == "" || TrimAll(document.getElementById(objval).value) == "Search Site" )
	{
	 alert('Please specify a search string');
	 return false;
	}
	 else
	 return true;	 
}

function ValidateEmailAddress(objval)
{
	if (TrimAll(document.getElementById(objval).value) == "")
	{
	 alert('Please specify a Email address');
	 return false;
	}
	 else
	 return true;	 
}

function NavigateTab(PageId,NewWindow)
{
	if (PageId != "")
	{
		if (NewWindow == "True")
		window.open("?PageId=" + PageId) 
		else
		window.location = "?PageId=" + PageId; 
	}
	else
	return void(0);
}

function SetLinkHoverColor(obj)
{
	obj.parentNode.style.backgroundColor = '#5E910B';
}

function SetLinkOutColor(obj)
{
	obj.parentNode.style.backgroundColor = '#7BB707';
}

function ValidateLogin(Username, Password, LoginButton)
{
	if (TrimAll(document.getElementById(Username).value) == '')
	{
		alert('Please specify an username');
		document.getElementById(Username).focus();
		return false;
	}
	if (TrimAll(document.getElementById(Password).value) == '')
	{
		alert('Please specify a password');
		document.getElementById(Password).focus();
		return false;
	}
	document.getElementById(LoginButton).onclick = new Function("return false;");
	return true;
}

function ValidateSubscriptions(source,args)
{
	var Marked = 0;
	for (var i = 0; i < document.forms[0].elements.length; i++) 
	{
		if (document.forms[0].elements[i].checked && document.forms[0].elements[i].name.indexOf('cbxSelected') > -1)
		Marked = Marked +1;		
	}
	if (Marked == 0) 
	{
		args.IsValid = false;
	}
	else
		args.IsValid = true;
	
}

function SetAsHomepage()
{
	if (document.all) {
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage('http://www.epets.co.za');
	}
	else
	{
		alert("This function is unavailable in your browser.");
	}
}