function postCSV(csvString){
	post_to_url('http://ir.nasdaqomxnordic.com/OpenInEXcel', csvString);
	return "success";
}

function post_to_url(path, csvString) {
	method = "post"; // Set method to post by default, if not specified.
	var form = document.createElement("form");
	form.setAttribute("method", method);
	form.setAttribute("action", path);
	var hiddenField = document.createElement("input");
	hiddenField.setAttribute("type", "hidden");
	hiddenField.setAttribute("name", "csvString");
	hiddenField.setAttribute("value", csvString);
	form.appendChild(hiddenField);
	document.body.appendChild(form); // Not entirely sure if this is necessary
	form.submit();
}
document.write("<script type='text/javascript'>var head = document.getElementsByTagName('head')[0];script = document.createElement('script');script.src = 'http://www.nasdaqomxnordic.com/static/ir/JavaScriptFunctions/flashCheck.js';script.type = 'text/javascript';head.appendChild(script);</script>");
document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' id='NasdaqOmxFlash' width='640' height='400' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'>");
document.write("  <param name='flashVars' value='instrumentId=HEX24283&width=640&height=400&titleBarBgColor=0xE73C33&borderStyle=solid&borderThickness=1&borderColor=0x000000&searchBtnTxt=Hae&titleTxt=Kurssihistoriahaku&fromTxt=Pvm&toTxt=Pvm&dateTxt=Päivä&highPriceTxt=Ylin&lowPriceTxt=Alin&closingPriceTxt=Päätöskurssi&totalVolumeTxt=Määrä&turnoverTxt=Liikevaihto&fromDateDays=30&loadexcel=Lataa tiedot Excel-tiedostoon&titleTxtColor=0xffffff&hideHeder=false&thousandSeparator= &decimalSeparator=,&historyBoxBGColor1=${configuration.getParameter('historyBoxBGColor1')}&historyBoxBGColor2=${configuration.getParameter('historyBoxBGColor2')}&historyBoxHeaderColors=${configuration.getParameter('historyBoxHeaderColors')}&fontFamily=${configuration.getParameter('fontFamily')}&fontSize=${configuration.getParameter('fontSize')}&headRowBGColor=${configuration.getParameter('headRowBGColor')}&verticalGridLineColor=${configuration.getParameter('verticalGridLineColor')}&horizontalGridLineColor=${configuration.getParameter('horizontalGridLineColor')}&averagePriceTxt=${configuration.getParameter('averagePriceTxt')}'/>");
document.write("  <param name='movie' value='http://www.nasdaqomxnordic.com/static/ir/historicalSearch/HistoricalSearch.swf' />");
document.write("  <param name='quality' value='high' />");
document.write("  <param name='bgcolor' value='#ffffff' />");
document.write("  <param name='AllowScriptAccess' value='always' />");
document.write("  <param name='wmode' value='transparent' />");
document.write("  <embed src='http://www.nasdaqomxnordic.com/static/ir/historicalSearch/HistoricalSearch.swf' quality='high' bgcolor='#ffffff'");
document.write("    width='640' height='400' name='historicalSearch' align='middle'");
document.write("    play='true'");
document.write("    loop='false'");
document.write("    AllowScriptAccess='always'");
document.write("    wmode='transparent'");
document.write("    type='application/x-shockwave-flash'");
document.write("    flashVars='instrumentId=HEX24283&width=640&height=400&titleBarBgColor=0xE73C33&borderStyle=solid&borderThickness=1&borderColor=0x000000&searchBtnTxt=Hae&titleTxt=Kurssihistoriahaku&fromTxt=Pvm&toTxt=Pvm&dateTxt=Päivä&highPriceTxt=Ylin&lowPriceTxt=Alin&closingPriceTxt=Päätöskurssi&totalVolumeTxt=Määrä&turnoverTxt=Liikevaihto&fromDateDays=30&loadexcel=Lataa tiedot Excel-tiedostoon&titleTxtColor=0xffffff&hideHeder=false&thousandSeparator= &decimalSeparator=,&historyBoxBGColor1=${configuration.getParameter('historyBoxBGColor1')}&historyBoxBGColor2=${configuration.getParameter('historyBoxBGColor2')}&historyBoxHeaderColors=${configuration.getParameter('historyBoxHeaderColors')}&fontFamily=${configuration.getParameter('fontFamily')}&fontSize=${configuration.getParameter('fontSize')}&headRowBGColor=${configuration.getParameter('headRowBGColor')}&verticalGridLineColor=${configuration.getParameter('verticalGridLineColor')}&horizontalGridLineColor=${configuration.getParameter('horizontalGridLineColor')}&averagePriceTxt=${configuration.getParameter('averagePriceTxt')}'");
document.write(" </embed>");
document.write("</object>");
