function setContentPaneURL(widgetId, url) {
	var widget = dojo.widget.byId(widgetId);
	if (widget!=null) {
		widget.href = url;
		widget.refresh();
	}
}

function expandFAQ(id) {
    var contentRoot = dojo.byId("body");
    var items = dojo.html.getElementsByClass("expanded",contentRoot,"div");
    for (i=0;i<items.length;i++ ) {
        dojo.html.removeClass(items[i], "expanded");
    }
    var thisItem = dojo.byId(id);
    dojo.html.addClass(thisItem, "expanded");
}

function getQS(month, year, offset) {
    if (month+offset == 0)
        year+=-1;
    if (month+offset == 13)
        year+= 1;
    return "month=" + ((month + offset + 11) %12 + 1) + "&year=" + year;
}

function postFlexSpaceResponse(url, FeedbackID, redirectURL) {
    dojo.io.bind({
		url: url,
		method: "post",
		content: {
			FeedbackID: FeedbackID, 
			Submission: dojo.byId('comment').value.replace(/'/g, "''")
		},
		load: function(load, data, e) {
		    alert("Thank you for your submission.");
			window.location.href = redirectURL + '?FeedbackID=' + FeedbackID;
		}
	});
}

//Form builder functions:
//this function is to show hide an target element depending on a 
			//control element's value fit to the list of values provided in ;delimited format 

		//this function is to show hide an target element depending on a 
			//control element's value fit to the list of values provided in ;delimited format 

			function showHide(valueStr, ctlFieldName, tgtDivName, name)
			{
				if (valueStr.indexOf(";") == -1)
					valueStr = valueStr + ";";
			
				var valueArray = valueStr.split(";");
				var n = valueArray.length;
			
			
				var ctlElement = dojo.byId(name)[ctlFieldName];
				var tgtDiv = document.getElementById(tgtDivName);
			
				var toDisplay  = false;
				for (i=0;i<n;i++)
				{
					if (valueArray[i] != "")
					{
						if (ctlElement != null)
						{
							if (ctlElement.value ==  null) //radio buttons
							{
								var l = ctlElement.length;
								for (j=0;j<l;j++)
								{
									if ((ctlElement[j].value == valueArray[i]) && (ctlElement[j].checked))
									{
										toDisplay = true;
										break;			
									}
								}
							}
							else if (ctlElement.type == "checkbox")
							{
								if (ctlElement.checked == (valueArray[i] == 'True'))
								{
									toDisplay = true;
									break;
								}
							}
							else
							{
								if (ctlElement.value == valueArray[i])
								{
									toDisplay = true;
									break;
								}
							}
						}
					}
				}
			
				if (tgtDiv != null)
				{
					if (toDisplay)
						tgtDiv.style.display = "block";
					else
						tgtDiv.style.display = "none";
				}			
			}	
			
			function open_BrWindow(img,winName,price,title){
			  if (screen) {
			   leftpos = screen.width/2-150
			   toppos = screen.height/2-75
			   }

			  win=window.open('','win','width=300,height=180,left='+leftpos+',top='+toppos+'');
				win.close();
			win=window.open('','win','width=300,height=180,left='+leftpos+',top='+toppos+'');
			  win.document.write("<html><body> <img src=" + img +" align='center'><br><br><font style='font-family: verdana; font-size: 11px; color: #393838;'><center>" + price + "</center></font></body></html>")
			  win.focus();

			  }