var propNames = ["width", "height", "type", "surveyId", "numberMode", "bgColor"];
var iframeEl = "";

addAttribute("width", forecastChartProps["width"]);
addAttribute("height", forecastChartProps["height"]);
addAttribute("frameborder", "0");
addAttribute("scrolling", "no");

if (forecastChartProps["borderColor"]) {
    addAttribute("style", "border: solid 1px #" + forecastChartProps["borderColor"]);
}

var url="";
for (i=0; i < propNames.length; i++) {
    completeURL(propNames[i]);
}

var serverURL = "http://fo.reca.st/surveys/";
addAttribute("src", serverURL + "gwt/com.forecast.charts.FeedbackChartApp/chartsGWT.html?" + url);

document.write("<iframe " + iframeEl + "> </iframe>");

function addAttribute(attrName, attrValue) {
    iframeEl = iframeEl + attrName + "=\"" + attrValue + "\" ";
}

function completeURL(propName){
    if (forecastChartProps[propName]) {
        if (url.length > 0) {
            url = url + "&";
        }
        url = url + propName + "=" + forecastChartProps[propName];
    }
}