	var email_message = "* Required";
	var name_message  = "* Required";
	function backInBlack(ob){
		ob.style.color = "#000000";
		ob.value = "";
	}

function serialize(_obj)
{
   // Let Gecko browsers do this the easy way
   if (typeof _obj.toSource !== 'undefined' && typeof _obj.callee === 'undefined')
   {
      return _obj.toSource();
   }

   // Other browsers must do it the hard way
   switch (typeof _obj)
   {
      // numbers, booleans, and functions are trivial:
      // just return the object itself since its default .toString()
      // gives us exactly what we want
      case 'number':
      case 'boolean':
      case 'function':
         return _obj;
         break;

      // for JSON format, strings need to be wrapped in quotes
      case 'string':
         return '\'' + _obj + '\'';
         break;

      case 'object':
         var str;
         if (_obj.constructor === Array || typeof _obj.callee !== 'undefined')
         {
            str = '[';
            var i, len = _obj.length;
            for (i = 0; i < len-1; i++) { str += serialize(_obj[i]) + ','; }
            str += serialize(_obj[i]) + ']';
         }
         else
         {
            str = '{';
            var key;
            for (key in _obj) { str += key + ':' + serialize(_obj[key]) + ','; }
            str = str.replace(/\,$/, '') + '}';
         }
         return str;
         break;

      default:
         return 'UNKNOWN';
         break;
   }
}


function submitProductQuoteForm(){
	//alert("here");
/*	if($('productQuoteForm').onsubmit()){
		$('productQuoteForm').submit();
	}*/
	if(checkProductQuoteNameAndEmail()){
		var productFormValues = $('productQuoteForm').serialize();
		var tmpUrl = "/?fuseaction=quote.sendProductQuote&"+productFormValues;
		//alert(tmpUrl);
		new Ajax.Updater('formFormDiv', tmpUrl, {method: 'post', insertion: Insertion.Bottom, budgetAjax: false});
	}
}

function submitProductQuoteFormbottom(){
	//alert("here");
/*	if($('productQuoteForm').onsubmit()){
		$('productQuoteForm').submit();
	}*/

	var strstr = "";

	strstr = strstr + "frombottom=1" + "&";
	strstr = strstr + "qqproduct=" + document.productQuoteFormbottom.qqproduct.value + "&";
	strstr = strstr + "qqname=" + document.productQuoteFormbottom.qqname.value + "&";
	strstr = strstr + "qqcompany=" + document.productQuoteFormbottom.qqcompany.value + "&";
	strstr = strstr + "qqemail=" + document.productQuoteFormbottom.qqemail.value + "&";
	strstr = strstr + "qqphone=" + document.productQuoteFormbottom.qqphone.value + "&";
	strstr = strstr + "qqquan=" + document.productQuoteFormbottom.qqquan.value + "&";
	strstr = strstr + "qqcapacity=" + document.productQuoteFormbottom.qqcapacity.value + "&";
	strstr = strstr + "qqcheck=" + document.productQuoteFormbottom.qqcheck.value;

	if(checkProductQuoteNameAndEmailbottom()){
		var tmpUrl = "/?fuseaction=quote.sendProductQuote&"+strstr;
		//alert(tmpUrl);
		new Ajax.Updater('formFormDivbottom', tmpUrl, {method: 'post', insertion: Insertion.Bottom, budgetAjax: false});
		
	}
}


Ajax.Responders.register(
{
	onCreate : function(a_request)
	{
		if (Ajax.activeRequestCount >= 1)
		{
			//alert(a_request.my_custom_var);
			if (a_request.options.budgetAjax)
			{
				Element.show('systemWorking');
			}
			else 
			{
				$('theRequestSubmitbottom').style.cursor='wait';
				Element.show('systemWorking2');
				$('theRequestSubmitbottom').style.background='url(images/productlayout/submiting.png)';
				$('theRequestSubmitbottom').onclick = function(){}

				$('theRequestSubmit').style.cursor='wait';
				Element.show('systemWorking2');
				$('theRequestSubmit').style.background='url(images/productlayout/submiting.png)';
				$('theRequestSubmit').onclick = function(){
		       		}
			}
		}
	},
	onComplete : function(a_request)
	{
		if (Ajax.activeRequestCount == 0)
		{
			if (a_request.options.budgetAjax)
			{
				Element.hide('systemWorking');
			}
			else 
			{
				$('theRequestSubmit').style.cursor='default';
				Element.hide('systemWorking2');
				$('theRequestSubmit').style.background='url(images/productlayout/submitted.png)';

				$('theRequestSubmitbottom').style.cursor='default';
				Element.hide('systemWorking2');
				$('theRequestSubmitbottom').style.background='url(images/productlayout/submitted.png)';
			}
		}
	}
});

var issubmittingproduct = 0;

	function checkProductQuoteNameAndEmail(){

	if(issubmittingproduct == 1)
	{
		return false;
	}
	else
	{
		issubmittingproduct = 1;
	}

	var name_form  = document.productQuoteForm.qqname;
	var email_form = document.productQuoteForm.qqemail;
	name_form.onfocus = function(){
		backInBlack(this);
	}
	email_form.onfocus = function(){
		backInBlack(this);
	}
	var strEmail = document.productQuoteForm.qqemail.value;
	var strName = document.productQuoteForm.qqname.value;
	var echk = true;
	var emailFilter = /^.+@.+\..{2,3}$/;
	var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/;

	if (strName == "" || strName == name_message){
		name_form.style.color = "#ff0033";
		name_form.value = name_message;
		echk = false;
	}
	if (strName.match(illegalChars)){
		name_form.style.color = "#ff0033";
		name_form.value = name_message;
		echk = false;
	}
	if (strEmail == "" || strEmail == email_message){
		email_form.style.color = "#ff0033";
		email_form.value = email_message;
		echk = false;
	}
	if (!emailFilter.test(strEmail))
	{
		email_form.style.color = "#ff0033";
		email_form.value = email_message;
		echk = false;
	}
	if (strEmail.match(illegalChars))
	{
		email_form.style.color = "#ff0033";
		email_form.value = email_message;
		echk = false;
	}

	if(echk == false)
	{
		issubmittingproduct = 0;
	}

	return echk;
}

function checkProductQuoteNameAndEmailbottom(){

	var name_form  = document.productQuoteFormbottom.qqname;
	var email_form = document.productQuoteFormbottom.qqemail;
	name_form.onfocus = function(){
		backInBlack(this);
	}
	email_form.onfocus = function(){
		backInBlack(this);
	}

	var strEmail = document.productQuoteFormbottom.qqemail.value;
	var strName = document.productQuoteFormbottom.qqname.value;
	var echk = true;
	var emailFilter = /^.+@.+\..{2,3}$/;
	var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/;

	if (strName == "" || strName == name_message){
		name_form.style.color = "#ff0033";
		name_form.value = name_message;
		echk = false;
	}
	if (strName.match(illegalChars)){
		name_form.style.color = "#ff0033";
		name_form.value = name_message;
		echk = false;
	}
	if (strEmail == "" || strEmail == email_message){
		email_form.style.color = "#ff0033";
		email_form.value = email_message;
		echk = false;
	}
	if (!emailFilter.test(strEmail))
	{
		email_form.style.color = "#ff0033";
		email_form.value = email_message;
		echk = false;
	}
	if (strEmail.match(illegalChars))
	{
		email_form.style.color = "#ff0033";
		email_form.value = email_message;
		echk = false;
	}

	return echk;
}

function fillReferrer(){
	document.getElementById("productReferrer").value = encodeURIComponent(location.href);
	//alert(location.href);
}



function taText(){
	if(document.getElementById('qqaddinfo').value == "i.e. customization questions, due date, multiple quantities, etc"){
		document.getElementById('qqaddinfo').value = "";
	}
	else if (document.getElementById('qqaddinfo').value == ""){
		document.getElementById('qqaddinfo').value = "i.e. customization questions, due date, multiple quantities, etc";
	}
}

