//////+++++++  Site Wide Functions  ++++++++/////////

var YAHOO = '';

var rfpType	=	[];
rfpType[0]	=	"appliances";
rfpType[1]	= 	"cabinets";
rfpType[2]	=	"concrete";
rfpType[3]	=	"countertops";
rfpType[4]	=	"decking";
rfpType[5]	=	"doorswindows";
rfpType[6]	=	"electrical";
rfpType[7]	=	"equipment";
rfpType[8]	=	"finishes";
rfpType[9]	=	"fireplaces";
rfpType[10]	=	"flooring";
rfpType[11]	=	"furnishings";
rfpType[12]	=	"hometechnology";
rfpType[13]	=	"hvac";
rfpType[14]	=	"landscaping";
rfpType[15]	=	"lumber";
rfpType[16]	=	"masonry";
rfpType[17]	=	"mechanical";
rfpType[18]	=	"metals";
rfpType[19]	=	"paint";
rfpType[20]	=	"roofing";
rfpType[21]	=	"specialcontruction";
rfpType[22]	=	"specialties";
rfpType[23]	=	"thermalmoisture";



function showLayer(layer){
var myLayer = document.getElementById(layer);
if(myLayer.style.display=="none" || myLayer.style.display==""){
myLayer.style.display="block";
} else {
myLayer.style.display="none";
}
}

function showReply(){

	document.getElementById('viewmessage').style.display = "none";
	document.getElementById('replyBox').style.display = "block";
	tinyMCE.execCommand('mceAddControl', false, 'messagebody');

}

function rand ( n )
{
  return ( Math.floor ( Math.random ( ) * n + 1 ) );
}


function showMssgBox(layer,user,scope,yOffset){
	var myLayer = document.getElementById(layer);
	var myCurtain = document.getElementById('curtain');
	var temp = rand ( 100000000 );

	if(myLayer.style.display=="none" || myLayer.style.display==""){
		myLayer.style.display="block";
		myCurtain.style.display="block";
		document.getElementById('respmessage').innerHTML = '<span class="closethis"><strong><a href="#" onClick="closeMssgBox(); return false">Close This <img src="images/icon-wrong.gif" width="18" /></a></strong></span><iframe src="http://mobuilder.com/message.php?to=' + user + '&scope=' + scope + '&temp=' + temp + '" frameborder="0" height="470" width="550" scrolling="auto"></iframe>';
	} 
}

function closeMssgBox() {
	var myLayer = document.getElementById('respmessage');
	var myCurtain = document.getElementById('curtain');
	myLayer.style.display="none";
	myCurtain.style.display="none";

}

function showLoader(){
	var myLayer = document.getElementById('loading');
	myLayer.style.display="inline";
}


//////+++++++  RFP Functions  ++++++++/////////

function setFocus(put) {
	document.getElementById(put).style.background="white";

}
function checkRFPTitle() {
	var rfpTitle = document.getElementById('rfptitle').value;
	if (rfpTitle != ''){
		document.getElementById('rfptitle').style.background="#E4EFD1";
		document.getElementById('rfptitle').style.display="none";
		document.getElementById('rfptitledisplay').style.display="block";
		document.getElementById('rfptitledisplay').innerHTML =  rfpTitle + '<span><a href="#" onClick="editTitle();return false">Edit</a></span>';
		document.getElementById('rfpstep2').style.display="block";
		document.getElementById('rfptitlenext').style.display="none";
		checkRFPSite(); //check to see if jobs site already filled
	} 
}
function checkRFPTitleEdit() {
	var rfpTitle = document.getElementById('rfptitleedit').value;
	if (rfpTitle != ''){
		document.getElementById('rfptitleedit').style.display="none";
		document.getElementById('rfptitledisplayedit').style.display="block";
		document.getElementById('rfptitledisplayedit').innerHTML =  rfpTitle + '<span><a href="#" onClick="editTitleEdit();return false">Edit</a></span>';

	} else {
		alert('Please give your bid request a title');
	}
}
function editTitle() {
		document.getElementById('rfptitle').style.display="block";
		document.getElementById('rfptitledisplay').style.display="none";
}

function editTitleEdit() {
		document.getElementById('rfptitleedit').style.display="block";
		document.getElementById('rfptitledisplayedit').style.display="none";
}

function checkRFPSite() {
	var rfpJobSite = document.getElementById('siteID').value;
	if (rfpJobSite != '--'){
		var rfpJobSiteI = document.getElementById('siteID').selectedIndex;
		var rfpJobSite = document.getElementById('siteID').options[rfpJobSiteI].text;
		document.getElementById('rfpstep2').style.display="none";
		document.getElementById('sitedisp').style.display="block";
		document.getElementById('sitedisp').innerHTML = '<p>Site: <strong>' + rfpJobSite + '</strong> <a href="#" onClick="changeSite();return false">Change</a></p>';
		document.getElementById('rfpdatepicker').style.display="block";
	}
}
function changeSite() {
		document.getElementById('rfpstep2').style.display="block";
		document.getElementById('sitedisp').style.display="none";
		document.getElementById('keepsite').style.display="inline";

}
function checkRFPDate() {
	var rfpJobDate = document.getElementById('newrfpdate').value;
	if (rfpJobDate != ''){
		document.getElementById('rfpdatepicker').style.display="none";
		document.getElementById('newrfpdate').style.background="none";

		document.getElementById('datedisp').style.display="block";
		document.getElementById('datedisp').innerHTML = '<p>Close Bidding at: <strong>' + rfpJobDate + '</strong> <a href="#" onClick="NewCssCal(\'newrfpdate\',\'mmddyyyy\',\'arrow\',true,12);return false">Change</a></p>';

		document.getElementById('rfpsectionbuttons').style.display="block";
		document.getElementById('rfpupload').style.display="block";

	}
}
function changeDate() {
	//document.getElementById('datedisp').style.display="none";
	//document.getElementById('rfpdatepicker').style.display="block";
	//document.getElementById('rfpdatepicker').style.margin="0 0 20px 0";

}



////ajax add site

	function rfpAjaxSite()
	{ 
		var req = null; 

		//document.ajax.dyn.value="Started...";
 
		if (window.XMLHttpRequest)
		{
 			req = new XMLHttpRequest();

		} 
		else if (window.ActiveXObject) 
		{
			try {
				req = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e)
			{
				try {
					req = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
        	}


		req.onreadystatechange = function()
		{ 
			//document.ajax.dyn.value="Wait server...";
			if(req.readyState == 4)
			{
				if(req.status == 200)
				{
					//document.ajax.dyn.value="Received:" + req.responseText;	
            				document.getElementById('rfpmysites').innerHTML = req.responseText;            
				}	
				else	
				{
					//document.ajax.dyn.value="Error: returned status code " + req.status + " " + req.statusText;
				}	
			} 
		}; 
		req.open("GET", "ajaxsites2.php?action=new&z=" + Math.random(), true); 
		req.send(null); 
	} 

	function rfpAjaxAdd()
	{ 
		var sitename 		= document.getElementById('sitename').value;
		var siteaddress1 	= document.getElementById('siteaddress1').value;
		var siteaddress2	= document.getElementById('siteaddress2').value;
		var sitecity		= document.getElementById('sitecity').value;
		var sitestate 		= document.getElementById('sitestate').value;
		var sitezip 		= document.getElementById('sitezip').value;

		var req = null; 

		//document.ajax.dyn.value="Started...";
 
		if (window.XMLHttpRequest)
		{
 			req = new XMLHttpRequest();

		} 
		else if (window.ActiveXObject) 
		{
			try {
				req = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e)
			{
				try {
					req = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
        	}


		req.onreadystatechange = function()
		{ 
			//document.ajax.dyn.value="Wait server...";
			if(req.readyState == 4)
			{
				if(req.status == 200)
				{
					//document.ajax.dyn.value="Received:" + req.responseText;	
            				document.getElementById('rfpmysites').innerHTML = req.responseText;            

				}	
				else	
				{
					//document.ajax.dyn.value="Error: returned status code " + req.status + " " + req.statusText;
				}	
			} 
		}; 
		req.open("GET", "ajaxsites2.php?action=add&sitename=" + sitename + "&siteaddress1=" + siteaddress1 + "&siteaddress2=" + siteaddress2 + "&sitecity=" + sitecity + "&sitestate=" + sitestate + "&sitezip=" + sitezip + "&z=" + Math.random(), true); 
		req.send(null); 

		ajaxClear(sitename,siteaddress1,siteaddress2,sitecity,sitestate,sitezip);

	} 

function ajaxClear(sitename,siteaddress1,siteaddress2,sitecity,sitestate,sitezip) {
	if ((sitename != '') && (siteaddress1 != '') && (sitecity != '') && (sitestate != '') && (sitezip != '')) {
		//var rfpJobSiteI = document.getElementById('siteID').selectedIndex;
		//var rfpJobSite = document.getElementById('siteID').options[rfpJobSiteI].text;
		document.getElementById('rfpstep2').style.display="none";
		document.getElementById('sitedisp').style.display="block";
		var newSiteAlert = '<p>Site: <strong>' + sitename + '</strong> <a href="#" onClick="changeSite();return false">Change</a> <span class="siteadded">Site Added Successfully</span></p>';
		var newSiteDisplay = '<p>Site: <strong>' + sitename + '</strong> <a href="#" onClick="changeSite();return false">Change</a></p>';
		document.getElementById('sitedisp').innerHTML = newSiteAlert;
		document.getElementById('rfpdatepicker').style.display="block";
	}
}

function ajaxSiteCancel() {
		var req = null; 

		//document.ajax.dyn.value="Started...";
 
		if (window.XMLHttpRequest)
		{
 			req = new XMLHttpRequest();

		} 
		else if (window.ActiveXObject) 
		{
			try {
				req = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e)
			{
				try {
					req = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
        	}


		req.onreadystatechange = function()
		{ 
			//document.ajax.dyn.value="Wait server...";
			if(req.readyState == 4)
			{
				if(req.status == 200)
				{
					//document.ajax.dyn.value="Received:" + req.responseText;	
            				document.getElementById('rfpmysites').innerHTML = req.responseText;            

				}	
				else	
				{
					//document.ajax.dyn.value="Error: returned status code " + req.status + " " + req.statusText;
				}	
			} 
		}; 
		req.open("GET", "ajaxsites2.php?action=list&z=" + Math.random(), true); 
		req.send(null); 
}


///////end ajax add site

   var http_request = false;
   function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('myspan').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
   
   function get(obj) {
      var poststr = "mytextarea1=" + encodeURI( document.getElementById("mytextarea1").value ) +
                    "&mytextarea2=" + encodeURI( document.getElementById("mytextarea2").value );
      makePOSTRequest('post.php', poststr);
   }


///////end ajax add site

function doNextStep(step) {
	if (step == '1') {
		var rfpTitle = document.getElementById('rfptitle').value;
		var rfpJobSite = document.getElementById('siteID').value;
		var rfpJobDate = document.getElementById('newrfpdate').value;

		if ((rfpTitle != '') && (rfpJobSite != '--') && (rfpJobDate != '')) {
			document.getElementById('rfpinfo').style.display="none";
			document.getElementById('rfpprev1').innerHTML = '<p class="rfpheading">' + rfpTitle + '</p><p><span class="smallnote">For Job Site: ' + rfpJobSite + '</span><span class="smallnote">Close Bidding: ' + rfpJobDate + '</span></p>';
			document.getElementById('rfpprev1').style.display="block";
			document.getElementById('rfpclicker').style.display="block";

			document.getElementById('rfpstep1').style.backgroundImage="url(http://mobuilder.com/images/icon-ok14.gif)";

			document.getElementById('rfpstep2').style.backgroundColor="#e6ebc2";
			document.getElementById('rfpstep2').style.backgroundImage="url(http://mobuilder.com/images/6.png)";
			document.getElementById('rfpstep2').style.backgroundPosition="70px center";
			document.getElementById('rfpstep2').style.backgroundRepeat="no-repeat";
			document.getElementById('rfpstep2').style.color="#5B5E56";
			document.getElementById('rfpstep2').style.fontStyle="normal";
			document.getElementById('rfpstep2').style.fontWeight="bold";
			document.getElementById('rfpstep2').style.textDecoration="underline";
		} else {
			document.getElementById('stepalert1').innerHTML = "<p>Please complete all three fields</p>";
		}
	}

}

function showRFPLayer(layer){
	var curtain = document.getElementById('curtain');
	curtain.style.display="block";
	document.getElementById(layer).style.zIndex = "5";
	document.getElementById(layer).style.display = "block";

}
function RFPSection(RFPSection, type) {

	if (document.getElementById(RFPSection + 'send').value == "0") {
		document.getElementById(RFPSection + 'send').value = "1"
		document.getElementById(RFPSection).style.display="block";
		if (type == "99") {
			document.getElementById(RFPSection + 'li').style.background="#8BD7DF";
			setTimeout ( 'document.getElementById("' + RFPSection + 'li").style.background="#5DDF1B"', 500 );
		} else {
			document.getElementById(RFPSection + 'li').style.background="#5DDF1B";
		}
		document.getElementById(RFPSection + 'li').style.display="inline";
		document.getElementById('addsupplylist').selectedIndex = 0;
	} else {
		document.getElementById(RFPSection + 'send').value = "0";
		document.getElementById(RFPSection).style.display="none";
		document.getElementById(RFPSection + 'li').style.background="red";
		document.getElementById('addsupplylist').selectedIndex = 0;
		setTimeout ( 'document.getElementById("' + RFPSection + 'li").style.background="#626F4C"', 500 );
		if (type == "0") {
			setTimeout ( 'document.getElementById("' + RFPSection + 'li").style.display="none"', 500 );
		}
	}
	checkActionButtons();
}
function checkActionButtons() {
	document.getElementById('rfpactions').style.display="block";

}
function editRFPSection(RFPSection) {
	document.getElementById(RFPSection + 'show').style.display="none";
	document.getElementById(RFPSection + 'edit').style.display="block";
	if (RFPSection == "concrete") {

	} else if (RFPSection == "roofing") {
		if(document.getElementById('roofing1').value == "<p>See attached files...<p>") {
			document.getElementById('roofing1').value = "";
		}
		var textID = 'roofing3';
		tinyMCE.execCommand('mceAddControl', false, textID);
	} else {
		var textID = RFPSection + '1';
		tinyMCE.execCommand('mceAddControl', false, textID);
	}
}
function replyRFPSection(RFPSection) {
	document.getElementById(RFPSection + 'supedit').style.display="block";
	document.getElementById(RFPSection + 'respa').style.display="none";
	var textID = RFPSection + '1';
	tinyMCE.execCommand('mceAddControl', false, textID);

}
function addRFPSection(RFPSection) {
	document.getElementById(RFPSection + 'show').style.display="block";
	if (RFPSection == "concrete") {
		if (document.getElementById('concrete1').value != '') {
			var concrete2 = "No";
			var concrete3 = "No";
			if (document.getElementById('concrete2').checked === true) {
				concrete2 = "Yes";
			} 
			if (document.getElementById('concrete3').checked === true) {
				concrete3 = "Yes";
			}
			var mynum = document.getElementById('concrete1').value;
			if (document.getElementById('concrete1').value == parseFloat(document.getElementById('concrete1').value)) {
				document.getElementById(RFPSection + 'show').innerHTML = '<p><strong>' + document.getElementById('concrete1').value + ' Yards</strong><br />Exposed Aggregate: <strong>' + concrete2 + '</strong><br />Foundation Work: <strong>' + concrete3 + '</strong><br /><a href="#" onClick="editRFPSection(\'concrete\');return false">Change</a></p>';
			} else {
			document.getElementById(RFPSection + 'show').innerHTML = '<p><strong>' + document.getElementById('concrete1').value + '</strong><br />Exposed Aggregate: <strong>' + concrete2 + '</strong><br />Foundation Work: <strong>' + concrete3 + '</strong><br /><a href="#" onClick="editRFPSection(\'concrete\');return false">Change</a></p>';
			}
		} else {
			document.getElementById(RFPSection + 'show').innerHTML = '<p>See attached files... <a href="#" onClick="editRFPSection(\'concrete\');return false">Change</a></p>';
		}

	} else if (RFPSection == "roofing") {

		if ((document.getElementById('roofing1').value != '') || (document.getElementById('roofing5').value != '')) {
			var roofing1 = "<strong>Squares: None</strong><br />";
			var roofing2 = "";

			if (document.getElementById('roofing1').value != '') {
				roofing1 = "<strong>Squares: " + document.getElementById('roofing1').value + "</strong><br />";
				
				if (document.getElementById('roofing2-2').checked == true) {
					roofing2 = "30 Year Rating<br />";
				} else {
					var roofing2 = "15 Year Rating<br />";
				}
				if (tinyMCE.get('roofing3').getContent() != '') {
					var roofing3 = "<u>Roofing Type/Color/Material/Brand:</u><br />" + tinyMCE.get('roofing3').getContent();
				} else {
					var roofing3 = "";
				}
			} 
			if (document.getElementById('roofing5').value != '') {
				var roofing5 = "<br />Rolls of Felt Paper: " + document.getElementById('roofing5').value + "<br />";
			} else {
				var roofing5 = "";
			}


			document.getElementById(RFPSection + 'show').innerHTML = '<p>' + roofing1 + roofing2 + '<br />' + roofing3 + roofing5 + '<a href="#" onClick="editRFPSection(\'roofing\');return false">Change</a></p>';
		} else {
			document.getElementById(RFPSection + 'show').innerHTML = '<p>See attached files... <a href="#" onClick="editRFPSection(\'roofing\');return false">Change</a></p>';
		}


	} else {
		document.getElementById(RFPSection + 'show').innerHTML = '<p>' + tinyMCE.get(RFPSection + '1').getContent() + '<a href="#" onClick="editRFPSection(\'' + RFPSection + '\');return false">Change</a></p>';
	}
	document.getElementById(RFPSection + 'edit').style.display = "none";

}
function cancelRFP (layer) {
	document.getElementById(layer + 'send').value = "0";
	//alert(document.getElementById(layer + 'send').value);

	if (layer == 'concrete') {
		document.getElementById('concrete1').value = '';
		document.getElementById('concrete2').checked = false;
		document.getElementById('concrete3').checked = false;
	} else if (layer == 'roofing') {
		document.getElementById('roofing1').value = '';
		document.getElementById('roofing3').value = '';
		tinyMCE.get('roofing3').setContent('');
		document.getElementById('roofing5').value = '';
	} else {
		document.getElementById(layer + '1').value = '';
		tinyMCE.get(layer + '1').setContent('');
	}
	document.getElementById(layer).style.display = 'none';
	document.getElementById(layer + 'li').style.background="red";
	setTimeout ( 'document.getElementById("' + layer + 'li").style.background="#626F4C"', 500 );

}

function fileClick(num) {
	document.getElementById('fileadd').style.display = "block";
	document.getElementById('file' + num + 'titlespan').style.display = "inline";

}

function addFileChange() {
	document.getElementById('filetitlespan').style.display = "inline";
	document.getElementById('filetitlespan').style.display = "inline";
}

function showRFPLi(layer) {

}

function checkNewRFP () {
	var rfpTitle = document.getElementById('rfptitle').value;
	var siteID = document.getElementById('siteID').value;
	var newrfpdate = document.getElementById('newrfpdate').value;

	if (rfpTitle == '') {
		alert('Please Enter a RFP Title');
		return false;
	} else if (siteID == "--") {
		alert('Please Select a Job Site');
		return false;
	} else if (newrfpdate == '') {
		alert('Please Enter a RFP Closing Date');
		return false;
	} else {
		return true;
	}
	
}

function showPreview() {

//alert('s1');
	var previewHTML = '';

	if (document.getElementById('appliances1').value != '') {
		var span = "RFPSection('appliances');";
		previewHTML = previewHTML + "<h3>Appliances <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('appliances');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('appliances');return false\">Delete</a></span></h3>" + document.getElementById('appliances1').value + "";
	}
	if (document.getElementById('cabinets1').value != '') {
		previewHTML = previewHTML + "<h3>Cabinets <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('cabinets');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('cabinets');return false\">Delete</a></span></h3>" + document.getElementById('cabinets1').value + "";
	}
	if (document.getElementById('concrete1').value != '') {
		var expAg = 'No';
		var foundation = 'No';
		if (document.getElementById('concrete2').checked == true) {
			expAg = "Yes";
		} 
		if (document.getElementById('concrete3').checked == true) {
			foundation = "Yes";
		} 			
		//alert (expAg);
		previewHTML = previewHTML + "<h3>Concrete <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('concrete');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('concrete');return false\">Delete</a></span></h3><p><strong>Yards: " + document.getElementById('concrete1').value + "</strong><br />Exposed Aggregate: <strong>" + expAg + "</strong><br />Foundation Work:  <strong>" + foundation + "</strong></p>";
	}
//alert('s2');

	if (document.getElementById('countertops1').value != '') {
//alert('s3');

		previewHTML = previewHTML + "<h3>Counter Tops <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('countertops');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('countertops');return false\">Delete</a></span></h3>" + document.getElementById('countertops1').value + "";
//alert('s4');
	}
	if (document.getElementById('decking1').value != '') {
		previewHTML = previewHTML + "<h3>Decking <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('decking');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('decking');return false\">Delete</a></span></h3>" + document.getElementById('decking1').value + "";
	}
	if (document.getElementById('doorswindows1').value != '') {
		previewHTML = previewHTML + "<h3>Doors &amp; Windows <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('doorswindows');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('doorswindows');return false\">Delete</a></span></h3>" + document.getElementById('doorswindows1').value + "";
	}
	if (document.getElementById('electrical1').value != '') {
		previewHTML = previewHTML + "<h3>Electrical <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('electrical');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('electrical');return false\">Delete</a></span></h3>" + document.getElementById('electrical1').value + "";
	}
	if (document.getElementById('equipment1').value != '') {
		previewHTML = previewHTML + "<h3>Equipment <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('equipment');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('equipment');return false\">Delete</a></span></h3>" + document.getElementById('equipment1').value + "";
	}
	if (document.getElementById('finishes1').value != '') {
		previewHTML = previewHTML + "<h3>Finishes <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('finishes');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('finishes');return false\">Delete</a></span></h3>" + document.getElementById('finishes1').value + "";
	}
	if (document.getElementById('fireplaces1').value != '') {
		previewHTML = previewHTML + "<h3>Fire Places <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('fireplaces');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('fireplaces');return false\">Delete</a></span></h3>" + document.getElementById('fireplaces1').value + "";
	}
	if (document.getElementById('flooring1').value != '') {
		previewHTML = previewHTML + "<h3>Flooring <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('flooring');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('flooring');return false\">Delete</a></span></h3>" + document.getElementById('flooring1').value + "";
	}
	if (document.getElementById('furnishings1').value != '') {
		previewHTML = previewHTML + "<h3>Furnishings <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('furnishings');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('furnishings');return false\">Delete</a></span></h3>" + document.getElementById('furnishings1').value + "";
	}
	if (document.getElementById('hometechnology1').value != '') {
		previewHTML = previewHTML + "<h3>Home Technology <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('hometechnology');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('hometechnology');return false\">Delete</a></span></h3>" + document.getElementById('hometechnology1').value + "";
	}
	if (document.getElementById('hvac1').value != '') {
		previewHTML = previewHTML + "<h3>HVAC <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('hvac');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('hvac');return false\">Delete</a></span></h3>" + document.getElementById('hvac1').value + "";
	}
	if (document.getElementById('landscaping1').value != '') {
		previewHTML = previewHTML + "<h3>Landscaping <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('landscaping');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('landscaping');return false\">Delete</a></span></h3>" + document.getElementById('landscaping1').value + "";
	}
	if (document.getElementById('lumber1').value != '') {
		previewHTML = previewHTML + "<h3>Lumber <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('lumber');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('lumber');return false\">Delete</a></span></h3>" + document.getElementById('lumber1').value + "";
	}
	if (document.getElementById('masonry1').value != '') {
		previewHTML = previewHTML + "<h3>Masonry <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('masonry');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('masonry');return false\">Delete</a></span></h3>" + document.getElementById('masonry1').value + "";
	}
	if (document.getElementById('mechanical1').value != '') {
		previewHTML = previewHTML + "<h3>Mechanical <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('mechanical');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('mechanical');return false\">Delete</a></span></h3>" + document.getElementById('mechanical1').value + "";
	}
	if (document.getElementById('metals1').value != '') {
		previewHTML = previewHTML + "<h3>Metals <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('metals');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('metals');return false\">Delete</a></span></h3>" + document.getElementById('metals1').value + "";
	}
	if (document.getElementById('paint1').value != '') {
		previewHTML = previewHTML + "<h3>Paint &amp; Painting <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('paint');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('paint');return false\">Delete</a></span></h3>" + document.getElementById('paint1').value + "";
	}


	if (document.getElementById('roofing1').value != '') {
	var yrValue = 15;
	if (document.getElementById('roofing2-2').checked == true){
		yrValue = 30;
	}
	var rollsPrint = "No";
	if (document.getElementById('roofing5').value != 0){
		rollsPrint = "Yes, " + document.getElementById('roofing5').value + " rolls";
	}
		previewHTML = previewHTML + "<h3>Roofing <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('roofing');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('roofing');return false\">Delete</a></span></h3><p>Squares: <strong>" + document.getElementById('roofing1').value + "</strong><br />Yr. Rating: <strong>" + yrValue + "</strong><br />Roofing Type/Color/Material/Brand: <strong>" + document.getElementById('roofing3').value + "</strong><br />Felt Paper: <strong>" + rollsPrint + "</strong></p>";
	}


	if (document.getElementById('specialcontruction1').value != '') {
		previewHTML = previewHTML + "<h3>Special Construction <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('specialcontruction');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('specialcontruction');return false\">Delete</a></span></h3>" + document.getElementById('specialcontruction1').value + "";
	}
	if (document.getElementById('specialties1').value != '') {
		previewHTML = previewHTML + "<h3>Specialties <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('specialties');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('specialties');return false\">Delete</a></span></h3>" + document.getElementById('specialties1').value + "";
	}
	if (document.getElementById('thermalmoisture1').value != '') {
		previewHTML = previewHTML + "<h3>Thermal &amp; Moisture <span class=\"prevedit\"><a href=\"#\" onClick=\"RFPSection('thermalmoisture');return false\">Edit</a></span> <span class=\"prevdelete\"><a href=\"#\" onClick=\"cancelRFP('thermalmoisture');return false\">Delete</a></span></h3>" + document.getElementById('thermalmoisture1').value + "";
	}
//alert('s5');

	document.getElementById('rfpprev').innerHTML = previewHTML;

	if ( previewHTML != '') {
		document.getElementById('saverfpbutton').style.display = "inline";
	} else {
		document.getElementById('saverfpbutton').style.display = "none";
	}
//alert('s6');

	//alert('this fires the preview function');
}

function rfpTypeShow(layer) {
	var myLayer = document.getElementById(layer);
	var children = document.getElementById('responsecontainer').getElementsByTagName('div');
	for ( var i=0, len=children.length; i<len; ++i ){
		children[i].style.display="none";
	}
	//myLayer.style.visibility="visible";
	//alert(myLayer.style.visibility);
	var myLayer2 = document.getElementById('response-equipment');
	myLayer.style.display="block";
	//alert(myLayer.style.display);
}





///////////// YUI Rich Text ////////////////////////////////////

/*
var myEditor = new YAHOO.widget.SimpleEditor('appliances1', {
    height: '300px',
    width: '522px',
    dompath: true //Turns on the bar at the bottom
});
myEditor.render();
*/




////////////////////////////////////////////////////////////////




//////////////////RFP RESPONSE DISPLAY FUNCTIONS/////////////////

function closeResp(layer) {
	document.getElementById(layer + 'supedit').style.display = "none";
	document.getElementById(layer + 'respa').style.display = "inline";
}

function viewRFPLayer(layer) {
	var container = document.getElementById(layer);
	var viewResponses = document.getElementById('view' + layer);
	var children = document.getElementById('rfprespveiw').getElementsByTagName('div');
	for ( var i=0, len=children.length; i<len; ++i ){
		children[i].style.visibility="hidden";
	}
	container.style.visibility="visible";
	viewResponses.style.visibility="visible";

}

function toggleRespView(type,section) {
	var myReq = document.getElementById('my' + section);
	var responses = document.getElementById('view' + section);
	if (type == 'resp') {
		myReq.style.display="none";
		responses.style.display="block";
	} 
	if (type == 'my') {
		myReq.style.display="block";
		responses.style.display="none";
	}
	if (type == 'hide') {
		myReq.style.display="none";
		responses.style.display="none";
	}
}

function showRespDetails(action, id) {

	var vd = document.getElementById('vd' + id);
	var hd = document.getElementById('hd' + id);
	var rd = document.getElementById('rd' + id);
	var browser=navigator.appName;
	if (action == 'show') {
		vd.style.display="none";
		hd.style.display="inline";
		if (browser == "Microsoft Internet Explorer") {
			rd.style.display="block"
		} else {
			rd.style.display="table-row"
		}
		//alert(browser);
	} 
	if (action == 'hide') {
		vd.style.display="inline";
		hd.style.display="none";
		rd.style.display="none";
	}

}

function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
		num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		if(cents<10)
			cents = "0" + cents;
			for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
				num = num.substring(0,num.length-(4*i+3))+','+
				num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + num + '.' + cents);
}

/////////////////////////////////////////////////////////////////

function tab(tab) {
	var i=1;
	for (i=1;i<=10;i++) {
		if (document.getElementById('tab' + i + 'a')) { document.getElementById('tab' + i + 'a').style.backgroundPosition = "left top"; }
		if (document.getElementById('tab' + i + 's')) { document.getElementById('tab' + i + 's').style.backgroundPosition = "right top"; }
		if (document.getElementById('tab' + i + 's')) { document.getElementById('tab' + i + 's').style.color = "#424F0F"; }
		if (document.getElementById('tabcontent' + i)) { document.getElementById('tabcontent' + i).style.display = "none"; }
	}
		document.getElementById('tab' + tab + 'a').style.backgroundPosition = "0% -42px";
		document.getElementById('tab' + tab + 's').style.backgroundPosition = "100% -42px";
		document.getElementById('tab' + tab + 's').style.color = "#fff";
		document.getElementById('tabcontent' + tab).style.display = "block";

}
function tab2(tab) {
	var i=1;
	for (i=1;i<=10;i++) {
		if (document.getElementById('tab' + i + 'a')) { document.getElementById('tab' + i + 'a').style.backgroundPosition = "left top"; }
		if (document.getElementById('tab' + i + 's')) { document.getElementById('tab' + i + 's').style.backgroundPosition = "right top"; }
		if (document.getElementById('tab' + i + 's')) { document.getElementById('tab' + i + 's').style.color = "#424F0F"; }
		if (document.getElementById('tabcontent' + i)) { document.getElementById('tabcontent' + i).style.display = "none"; }
	}

		document.getElementById('tab' + tab + 'a').style.backgroundPosition = "0% -42px";
		document.getElementById('tab' + tab + 's').style.backgroundPosition = "100% -42px";
		document.getElementById('tab' + tab + 's').style.color = "#fff";
		document.getElementById('tabcontent' + tab).style.display = "block";


}

//////// HELP FUNCTIONS ////////////////////////
function helpMe(pageID) {
	document.getElementById('curtain').style.display = "block";
	document.getElementById('help').style.display = "block";

	//list item arrays
	var helpItems = new Array();

	if (pageID == "members") {
		helpItems[0]	=	"What's a Dashboard?";
		helpItems[1]	=	"Latest Bid Requests";
		helpItems[2]	=	"Mailbox";
		helpItems[3]	=	"News from Mobuilder";
	}


	if (pageID == "newrfp") {
		helpItems[0]	=	"Overview";
		helpItems[1]	=	"Bid Request Title";
		helpItems[2]	=	"Job Sites";
		helpItems[3]	=	"Bidding End Time";
		helpItems[4]	=	"Attachments";
		helpItems[5]	=	"Supplier Types";
		helpItems[6]	=	"Supply Type Sections";
		helpItems[7]	=	"Save &amp; Review";
	}

	if (pageID == "responses") {
		helpItems[0]	=	"Overview";
		helpItems[1]	=	"Viewing Responses";
		helpItems[2]	=	"Bid Details";
		helpItems[3]	=	"Supplier Needs to Update";
		helpItems[4]	=	"Accepting a Bid";
	}
/* not using, self explanatroy (we hope)
	if (pageID == "myrfp") {
		helpItems[0]	=	"What's a Dashboard?";
		helpItems[1]	=	"Latest Bid Requests";
		helpItems[2]	=	"Mailbox";
		helpItems[3]	=	"News from Mobuilder";
	}
*/

	if (pageID == "myrfp1") {
		helpItems[0]	=	"Publish";
		helpItems[0]	=	"Save without publishing";
		helpItems[1]	=	"View Responses";
		helpItems[2]	=	"Edit";
		helpItems[3]	=	"Delete";
	}

	if (pageID == "myrfpedit") {
		helpItems[0]	=	"Overview";
		helpItems[1]	=	"Changing the Title";
		helpItems[2]	=	"Job Sites";
		helpItems[3]	=	"Bidding Closing Time";
		helpItems[4]	=	"Attachments";
		helpItems[5]	=	"Supplier Types";
		helpItems[6]	=	"Supply Type Sections";
		helpItems[7]	=	"Save &amp; Review";
	}

	if (pageID == "deleterfp") {
		helpItems[0]	=	"Forever?";

	}

	if (pageID == "myjobsites") {
		helpItems[0]	=	"Adding a new Job Site";
		helpItems[1]	=	"Changing a Site's Details";
		helpItems[2]	=	"Deleting a Site";
		helpItems[3]	=	"New Bid Request";
	}

	if (pageID == "mailbox") {
		helpItems[0]	=	"Inbox";
		helpItems[1]	=	"Sent";
		helpItems[2]	=	"Trash";
	}

	if (pageID == "supplier") {
		helpItems[0]	=	"What's a Dashboard?";
		helpItems[1]	=	"Latest Bid Requests";
		helpItems[2]	=	"Mailbox";
		helpItems[3]	=	"Need to Update";
		helpItems[4]	=	"News from Mobuilder";
	}

	if (pageID == "rfps") {
		helpItems[0]	=	"What is all this?";
	}

	if (pageID == "rfps1") {
		helpItems[0]	=	"What is all this?";
		helpItems[1]	=	"Title &amp; Info";
		helpItems[2]	=	"Sections &amp; Status";
		helpItems[3]	=	"Viewing Requests";
		helpItems[4]	=	"Responding (Bidding)";
		helpItems[5]	=	"Need to Update";
		helpItems[6]	=	"Uploading Attachments";
		helpItems[7]	=	"Accepted Bids";

	}

	if (pageID == "myresponses") {
		helpItems[0]	=	"View Tabs";
		helpItems[1]	=	"Responses Table";
	}

	if (pageID == "profilec") {
		helpItems[0]	=	"What's a Dashboard?";
		helpItems[1]	=	"Latest Bid Requests";
		helpItems[2]	=	"Mailbox";
		helpItems[3]	=	"News from Mobuilder";
	}

	if (pageID == "profiles") {
		helpItems[0]	=	"What's a Dashboard?";
		helpItems[1]	=	"Latest Bid Requests";
		helpItems[2]	=	"Mailbox";
		helpItems[3]	=	"News from Mobuilder";
	}

	//set up list items
	var helpList = "<ul class='helplist'>";
	for(i = 0; i < 100; i++){
		if (helpItems[i] != undefined) {
			helpList = helpList + "<li id='answerli" + i + "'><a id='answerlia" + i + "' href='#' onClick='showAnswer(\"" + i + "\",\"" + pageID + "\");return false'>" + helpItems[i] + "</a></li>";
		}
	}
	helpList = helpList + "</ul>";

	//set up content items

	var helpHTML = "<h2 class='helptitle'><span class='closehelp'><a href='#' onClick='closeHelp();return false'>Close This</a></span>Mobuilder Help</h2>";
	helpHTML = helpHTML + helpList + "<div id='helpcontainer'></div>";

	document.getElementById('help').innerHTML = helpHTML;

	showAnswer('0', pageID);

}

function showAnswer(ans, pageID) {
	//help section arrays
	var helpContent = new Array();

	if (pageID == "members") {
		helpContent[0]	=	"Your Dashboard is like home base.  It's a great place to start out once logging into Mobuilder.  You can check the status of your latest Bid Requests, see your Mobuilder Mail, and catch the latest news from the Mobuiilder community.";
		helpContent[1]	=	"The Latest Bid Request box displays five of your last Bid Requests.<ul><li><strong>Responses:</strong> Total number of responses, for example there could be two supplier responses for a couple of bid categories each - totalling four responses.  Also, the <span style='color:red;'>Not Published</span> message will display if the Bid Request hasn't been published to suppliers yet.</li><li><strong>View:</strong> The view link displays your Bid Request as suppliers would see it.</li><li><strong>Edit:</strong> The edit link allows you to make changes to the Bid Request</li><li><strong>Delete:</strong>  Deleting is forever, but you will be asked for a confirmation before it's deleted.</li></ul>";
		helpContent[2]	=	"Your Mailbox is where you get messages from suppliers.  The latest five will be displayed, click \"View all Messages\" to view your whole inbox, sent items, and trashed messages.";
		helpContent[3]	=	"Mobuilder News is the latest few posts to our blog concerning the community, new features, how to use Mobuilder and more.";
	}

	if (pageID == "newrfp") {
		helpContent[0]	=	"Creating a New Bid Request is supposed to be flexible.  Here's the process in a nutshell:<ol class='helpol'><li>Give it a title</li><li>Choose/add a job site</li><li>Select a deadline</li><li>Add any attachments</li><li>Select Supply Type(s)</li><li>Add Request Details</li></ul>";
		helpContent[1]	=	"Short and descriptive, think \"classified ad\".  Examples: \"Commercial Paving in Atlanta\" or \"10 MW Solar Panels\" or \"Portland Basement Remodel\"";
		helpContent[2]	=	"Enter details about the job site.  Many suppliers will need locational information to give you accurate pricing, especially if they are to be delivered to the site.<br />You may select an existing job site, add one directly in the Bid Request, or manage your Job Sites through the \"MY JOB SITES\" tab in the navigation menu.";
		helpContent[3]	=	"Select a month, day, and time to close Bid Responses from Suppliers.  You may change the closing date at any time, however, suppliers may need to update their bids to make them accurate.";
		helpContent[4]	=	"You may upload as many files with your Bid Request as you like.  We accept files up to 4mb in size, and in .doc, .pdf, and .jpg formats.<br />Uploading Attachments:<ol><li>Select a file</li><li>Click the <span style='color:red;'>red</span> upload button</li><li>Repeat as necessary</li></ol>Please note:<br />*Uploaded files will appear above the upload box once they are finished<br />*Uploading a file twice does not overwrite the original file, instead, we'll append a number to the file name (ex: Plan.pdf will become Plan1.pdf if it already exists)<br />*Attachments will be sent to all supplier types selected with this Bid Request";
		helpContent[5]	=	"Select the types of supplies you would like to recieve quotes for by clicking on the dark green buttons (most active) and/or by selecting additional types from the drop down menu.  Once selected, the supply type button will display with a light green background.  Simply click them again to remove the item(s).";
		helpContent[6]	=	"Once a supply type is selected above, a corresponding \"details\" section will open below.  Here is where you can specify quantities, specifications, colors, and anything else - or even just ask suppliers to reference one of your attached files.<br /><u>Examples:</u><br /><em>20 Finish Grade 2 x 4 x 16s</em><br /><em>Four 200' Spools of Cat5e Cable without Connections</em><br /><em>Lease and Delivery of Two (preferably Caterpillar) Front End Loaders</em><br /><em>See attached \"Electrical Plan\"</em>";
		helpContent[7]	=	"You will have a chance to review your Bid Request before \"Publishing\" it to suppliers.  Once you click \"Save &amp; Review\" your Bid Request will display entirely.  From there, you may save it for later, edit it, or \"Publish\" it.  Publishing is when your Bid Request is actually sent to suppliers for bid.";
	}

	if (pageID == "responses") {
		helpContent[0]	=	"The responses page is where you can:<il><li>View Bids that Suppliers have sent you</li><li>View your Bid Request</li><li>Send Suppliers messages regarding their Bids</li><li>Accept Bids for your project</li></ul>";
		helpContent[1]	=	"For each supply type you requested in your bid request, there will be a corresponding section with bids for that supply type.<br />In each section you may view your Bid Responses, view your Bid Request, or hide the section until later.<br />Then a table with the Supplier, Price, and Bid Details.";
		helpContent[2]	=	"Each Bid will initially show the Supplier's user name, Price, and a link to view the Bid's Details.  Hovering your mouse over the Supplier's user name will display a balloon with their profile information, and clicking on the user name will direct you to their profile page.  Clicking on the \"View Details &raquo;\" link will pull up:<ol><li>The time submitted</li><li>Supplier Needs to Update message if applicable</li><li>The Supplier's attachments</li><li>Bid Response Details</li><li>Send Message button to contact the Supplier with questions/concerns</li><li>An Accept button to accept the bid</li></ol>";
		helpContent[3]	=	"\"Supplier Needs to Update\" indicates that you have edited your bid request after the supplier has sent this response, so <strong>it may not be valid</strong> still.  Once the Supplier has had a chance to update or confirm thier bid, this message will not appear.";
		helpContent[4]	=	"Accepting a Bid starts the ordering process.  You will have a chance to confirm your acceptance before notification goes to the Supplier.<br /><u>Please Note:</u><br />*Each Supplier provides their own instructions on how to fulfill the bid once you accept it, and will be displayed accordingly.<br />";
	}

	if (pageID == "myrfp1") {
		helpContent[0]	=	"Publishing a Bid Request is when the magic happens.  Once you publish your Bid Request, it is sent to Suppliers who have subscribed to the subsections you requested in the state in which your job site is located.";
		helpContent[1]	=	"Saves your Bid Request for later.  Don't worry, no body can see your masterpiece of construction supply until you \"Publish\" it to suppliers.";
		helpContent[2]	=	"If Published, you can click this link in order to review responses from suppliers.";
		helpContent[3]	=	"Published or not, you may go here to change the title, job site, closing date, supply types, and details of your bid request before publishing it.";
		helpContent[4]	=	"Don't freak out, you get to confirm it before your Bid Request disappears forever.";
	}

	if (pageID == "myrpfedit") {
		helpContent[0]	=	"This is where you can make changes to a published or unpublished Bid Request.  <strong>Caution</strong>:  Changing a published bid request will require any suppliers who may have already bid to have to update their quotes for accuracy.";
		helpContent[1]	=	"Short and descriptive, think \"classified ad\".  Examples: \"Commercial Paving in Atlanta\" or \"10 MW Solar Panels\" or \"Portland Basement Remodel\"";
		helpContent[2]	=	"Select an existing job site, or create a new one.  Many suppliers will need locational information to give you accurate pricing, especially if they are to be delivered to the site.<br />Existing Job Sites may be edited through the \"MY JOB SITES\" tab in the navigation menu.";
		helpContent[3]	=	"Select a month, day, and time to close Bid Responses from Suppliers.  You may change the closing date at any time, however, suppliers may need to update their bids to make them accurate.";
		helpContent[4]	=	"You may upload as many files with your Bid Request as you like.  We accept files up to 4mb in size, and in .doc, .pdf, and .jpg formats.<br />Uploading Attachments:<ol><li>Select a file</li><li>Click the <span style='color:red;'>red</span> upload button</li><li>Repeat as necessary</li></ol>Please note:<br />*Uploaded files will appear above the upload box once they are finished<br />*Uploading a file twice does not overwrite the original file, instead, we'll append a number to the file name (ex: Plan.pdf will become Plan1.pdf if it already exists)<br />*Attachments will be sent to all supplier types selected with this Bid Request";
		helpContent[5]	=	"Select the types of supplies you would like to recieve quotes for by clicking on the dark green buttons (most active) and/or by selecting additional types from the drop down menu.  Once selected, the supply type button will display with a light green background.  Simply click them again to remove the item(s).";
		helpContent[6]	=	"Once a supply type is selected above, a corresponding \"details\" section will open below.  Here is where you can specify quantities, specifications, colors, and anything else - or even just ask suppliers to reference one of your attached files.<br /><u>Examples:</u><br /><em>20 Finish Grade 2 x 4 x 16s</em><br /><em>Four 200' Spools of Cat5e Cable without Connections</em><br /><em>Lease and Delivery of Two (preferably Caterpillar) Front End Loaders</em><br /><em>See attached \"Electrical Plan\"</em>";
		helpContent[7]	=	"You will have a chance to review your Bid Request before \"Publishing\" it to suppliers.  Once you click \"Save &amp; Review\" your Bid Request will display entirely.  From there, you may save it for later, edit it, or \"Publish\" it.  Publishing is when your Bid Request is actually sent to suppliers for bid.";
	}

	if (pageID == "deleterfp") {
		helpContent[0]	=	"Yes, deleting is forever and irreversible.";
	}

	if (pageID == "myjobsites") {
		helpContent[0]	=	"Click on the \"[+] Add a new job site button.  The site's name, address, city, state, and zip code are required so that suppliers can accurately price materials for that location.";
		helpContent[1]	=	"Just click the \"Edit\" link next the job site's name.";
		helpContent[2]	=	"Click the \"Delete\" link next the job site's name. You will have a chance to confirm this before it disappears forever.<br /><strong>Important:</strong> Deleting a Job Site with Active Bid Requests is not Advisable";
		helpContent[3]	=	"Click the link \"Submit New Bid Request\" to submit a new Bid Request for this site.";
	}

	if (pageID == "mailbox") {
		helpContent[0]	=	"These are messages to you from other Mobuilder users.  New messages are in bold, and clicking on the From, Subject, or Date columns will bring up the message.  Feel free to delete them at any time since you can restore them from your \"Trash\".";
		helpContent[1]	=	"These are items that you have sent to other Mobuilder users.";
		helpContent[2]	=	"These are messages that you have deleted, clicking the \"Restore\" link will move them back to the \"Inbox\".";
	}

	if (pageID == "supplier") {
		helpContent[0]	=	"Your Dashboard is like home base.  It's a great place to start out once logging into Mobuilder.  You can check the status of your find your New Bid Requests, see your Mobuilder Mail, and catch the latest news from the Mobuiilder community.";
		helpContent[1]	=	"The Latest Bid Requests box displays five of latest Bid Requests, click the link below to see all of the active Bid Requests.<ul><li><strong>Request Title:</strong>The title of the request from the contractor. <em>Click it to view it!</em></li><li><strong>Location:</strong> The job site location for the Bid Request.</li><li><strong>User:</strong> The user name of the contractor requesting a bid. <em>Click the user name to go to thier profile</em>.</li><li><strong>Closes:</strong>  The deadline to close bidding on the request.</li><li><strong>Updated:</strong> When the contractor submitted or last updated the Bid Request.</li></ul>";
		helpContent[4]	=	"";
		helpContent[2]	=	"Your Mailbox is where you get messages from contractors.  The latest five will be displayed, click \"View all Messages\" to view your whole inbox, sent items, and trashed messages.";
		helpContent[3]	=	"List of Bids that need to be updated because the contractor has edited the Bid Request information and may not accurately reflect your bid.";
		helpContent[4]	=	"Mobuilder News is the latest few posts to our blog concerning the community, new features, how to use Mobuilder and more.";
	}

	if (pageID == "rfps") {
		helpContent[0]	=	"From left to right:<ul><li><strong>Request Title</strong>: The title of the Bid Request given by the Contractor, click it to view and/or bid.</li><li><strong>Location</strong>: The location of the Job Site to which the Bid Request belongs.</li><li><strong>User</strong>: The user name of the Contractor who submitted the Bid Request.  Click on their user name to view their profile.</li><li><strong>Closes</strong>: The closing deadline in which to submit Bids for the Request (in Eastern Standard Time).</li><li><strong>Updated</strong>: The time at which the Contractor submitted or last updated the Bid Request (in Eastern Standard Time).</li>";

	}

	if (pageID == "rfps1") {
		helpContent[0]	=	"This is where you can view and respond to Contractors' Bid Request, or even send the Contractor a message.";
		helpContent[1]	=	"Title &amp; Info";
		helpContent[2]	=	"Sections &amp; Status";
		helpContent[3]	=	"Viewing Requests";
		helpContent[4]	=	"Responding to Requests (Bidding)";
	}

	if (pageID == "myresponses") {
		helpContent[0]	=	"These tabs sort your Bid Responses (Quotes) by their status.<ul><li><strong>View All</strong>: A list of all your Bid Responses regardless of Status.</li><li><strong>Accepted</strong>: Bid Responses that have been accepted by Contractors.</li><li><strong>Need to Update</strong>: These are Bid Responses that are no longer valid because the Contractor has edited it, and it may no longer accurately reflect your Bid.</li><li><strong>Pending</strong>: These are Bids that you have entered, but have not yet been accepted or expired.</li><li><strong>Expired</strong>: This is an archive of Bids that you had entered and have expired.</li></ul>";
		helpContent[1]	=	"From left to right:<br /><ul><li><strong>Contractor</strong>: The user name of the contractor who submitted the Bid Request.  Hovering over thier username will bring up a balloon with their information, and clicking on it will take you to their profile.  Click the <img class='tmessage' width='12' src='http://mobuilder.com/images/message.png' /> icon to send them a message.</li><li><strong>Type</strong>: The supply category in which the Bid Request belongs.</li><li><strong>View</strong>: Click the Details link to view and respond to the Bid Request.</li><li><strong>Price</strong>: The price you quoted in the Bid Response.</li><li><strong>Status</strong>: The status of your Bid Request.</li><li><strong>Closes</strong>: The closing time for the Bid Request in Eastern Standard Time.</li>";
	}

	if (pageID == "profilec") {
		helpContent[0]	=	"";
		helpContent[1]	=	"";
		helpContent[2]	=	"";
		helpContent[3]	=	"";
		helpContent[4]	=	"";
	}

	if (pageID == "profiles") {
		helpContent[0]	=	"";
		helpContent[1]	=	"";
		helpContent[2]	=	"";
		helpContent[3]	=	"";
		helpContent[4]	=	"";
	}

	for(i = 0; i < 10; i++){
		if (document.getElementById('answerli' + i)) {
			//alert(i + " - " + ans);
			document.getElementById('answerli' + i).style.background = "#636F30";
			document.getElementById('answerlia' + i).style.color = "#fff";
			document.getElementById('answerlia' + i).style.fontWeight = "";
		}
	}

	document.getElementById('answerli' + ans).style.background = "#FFFFEF";
	document.getElementById('answerlia' + ans).style.color = "#5B5E56";
	document.getElementById('answerlia' + ans).style.fontWeight = "bold";
	document.getElementById('helpcontainer').innerHTML = helpContent[ans];
//alert(ans + " - " + pageID);
}

function closeHelp() {
	document.getElementById('curtain').style.display = "none";
	document.getElementById('help').style.display = "none";
}
//////// END HELP FUNCTIONS ////////////////////
