var ROOT_URL = "http://www.marinea-yachting.com/";

//********************************************************
// SHOW / HIDE SIDE BOX
//********************************************************
function showhideSideBox(DivID, ImgID)
{
	var showhideDiv = document.getElementById(DivID);
	var showhideImg = document.getElementById(ImgID);
	if (showhideDiv.style.display == "none") {
		showhideDiv.style.display = "block";
		showhideImg.src = DOMAIN_URL + "include/images/box_hide.jpg";
	}
	else {
		showhideImg.src = DOMAIN_URL + "include/images/box_show.jpg";
		showhideDiv.style.display = "none";	
	}
}

//********************************************************
// SHOW / HIDE BROWSE BY BOX
//********************************************************
function showhideBrowseByBox(DivID)
{
	var showhideDiv = document.getElementById(DivID);
	if (showhideDiv.style.display == "none") {
		document.getElementById('BrowseByBox_Type').style.display = "none";
		document.getElementById('BrowseByBox_Model').style.display = "none";
		document.getElementById('BrowseByBox_Cabins').style.display = "none";
		document.getElementById('BrowseByBox_Year').style.display = "none";
		document.getElementById('BrowseByBox_Price').style.display = "none";
		document.getElementById('BrowseByBox_CharterBase').style.display = "none";
		document.getElementById('BrowseByBox_Destination').style.display = "none";
		showhideDiv.style.display = "block";
	}
	else {
		showhideDiv.style.display = "none";	
	}
}


//********************************************************
// SHOW / HIDE ELEMENT
//********************************************************
function showHideElement(elemID, showHide) {
	if(document.getElementById(elemID)) {
		document.getElementById(elemID).style.display = (showHide == 'show' ? 'block' : 'none');
	}
}

//********************************************************
// SHOW / HIDE LOGIN BAR
//********************************************************
function toggleLogin() {
	var loginID = document.getElementById('loginbar');
	
	if (loginID.style.display == "none") {
		slidedown('loginbar');
		setTimeout("document.getElementById('LoginUsername').focus()",300);
	}
	else {
		slideup('loginbar');
		document.getElementById('LoginUsername').blur();
	}
	
	return(false);
}

//********************************************************
// OPEN URL IN NEW WINDOW
//********************************************************
function open_win(url, width, height)
{
	window.open(url,"marinea_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width="+width+", height="+height);
}

//********************************************************
// SUBMIT NEWSLETTER SUBSCRIPTION
//********************************************************
function NewsletterSubscriptionSubmit()
{
	open_win(ROOT_URL + "newsletter/subscribe.php?email=" + document.fmNewsletterSignInBox.NewsletterEmail.value, "400", "320")
	
}

//********************************************************
// SEND PAGE TO FRIEND
//********************************************************
function SendToFriend()
{
	open_win(ROOT_URL + "send_to_friend.php", "400", "460")
	
}

//********************************************************
// EMPTY QUICK SEARCH INPUT FIELD
//********************************************************
function emptyQuickSearch()
{
	var searchQueryID = document.getElementById('SearchQuery');
	
	searchQueryID.value = "";
}


//****** draw CAPTCHA *********//
function drawVisualCaptcha(picID) 
{
	//alert(picID);
	document.getElementById(picID).src = ROOT_URL + "include/captcha/inc.captcha_redraw.php?" + Math.random();
}

