var qqimagesrc = document.URL; //set the source image to the URL and it will remain that way by default

function openQuickQuote (obj) {

	var htmlIsOpen = false;
	var qqmenubutton = document.getElementById('nav_quickquote');
	
	for (var i = 0; i < hs.sleeping.length; i++) {
		if (hs.sleeping[i] && hs.sleeping[i].isHtml) {
			hs.sleeping[i].awake();
			qqmenubutton.className = 'current';
			hs.sleeping[i] = null;
		}
	}
	
	for (var i = 0; i < hs.expanders.length; i++) {
		if (hs.expanders[i] && hs.expanders[i].isHtml) {
			hs.expanders[i].focus();
			htmlIsOpen = true;
		}		
	}
	
	if (!htmlIsOpen) {
		hs.htmlExpand(obj, { contentId: 'highslide-html-ajax', outlineType: 'beveled', wrapperClassName: 'highslide-white', outlineWhileAnimating: true, objectType: 'ajax' } );
		if (hs.getExpander(obj))
			qqimagesrc = hs.getExpander(obj).a.href;
		qqmenubutton.className = 'current';
		return false;
	} else {
		if (hs.getExpander(obj))
			qqimagesrc = hs.getExpander(obj).a.href;
		return false;
	}
		
}

function closeQuickQuote(obj) {
	
	document.getElementById('nav_quickquote').className = '';
	return hs.close(obj);
}

function FormSubmit(obj) {

	obj.qq_current_pic.value = qqimagesrc;
	return (qqCheckName(obj) && qqCheckEmail(obj) && qqCheckMessage(obj));
}

function qqCheckEmail(myForm) {
	var emailID= myForm.Email;
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailID.value))
		return true;
	alert("Please input your Email address.");
	emailID.focus();
	return false;
}

function qqCheckName(myForm) {
	var nameID=myForm.Name;
	if (nameID.value)
		return true;
	alert("Please input your Name before sending the form.");
	nameID.focus();
	return false;
}

function qqCheckMessage(myForm) {
	var messageID=myForm.Message;
	if (messageID.value)
		return true;
	alert("Please write a message before sending the form.");
	messageID.focus();
	return false;
}