function changeDnevnik20(p) {
	var hold = document.getElementById('changeme');
				gDn15FlashObj = "<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" ID=\"objects\" WIDTH=\"300\" HEIGHT=\"250\"><PARAM NAME=\"movie\" VALUE=\"#phpfile#?width=300&height=250&sd=#sd#&ed=#ed#&f=#f#&ticker=#ticker#\"><PARAM NAME=\"quality\" VALUE=\"high\"><EMBED src=\"#phpfile#?width=300&height=250&sd=#sd#&ed=#ed#&f=#f#&ticker=#ticker#\" quality=\"high\" WIDTH=\"300\" HEIGHT=\"250\" TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></OBJECT>";
	var HTML = "<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" ID=\"objects\" WIDTH=\"179\" HEIGHT=\"120\"><PARAM NAME=\"movie\" VALUE=\"#phpfile#?xmlpath=#xmlpath#\"><PARAM NAME=\"quality\" VALUE=\"high\"><EMBED src=\"#phpfile#?xmlpath=#xmlpath#\" quality=\"high\" WIDTH=\"179\" HEIGHT=\"120\" TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></OBJECT>";
	HTML = HTML.replace(/#phpfile#/g, '/graph.swf');
	HTML = HTML.replace(/#xmlpath#/g, escape('/getXml.php?f=' + p));
	hold.innerHTML = HTML;
	return false;
}


function chng(pPeriod, pFreq, pCurrDate, pDivId, pDivFreqsId) {
	var lPerShift, lFreqShift, lStartDate, lEndDate, lDiv, lFreqStr = "";
	
	lGraphTempl = gDn15FlashObj;
	lFreqTempl = gDn15FreqTempl;
	
	if (!pPeriod) pPeriod = 0;//defaultni stoinosti
	if (!pFreq) {
		pFreq = gDn15FreqsByPeriods[pPeriod][0];
		lFreqShift = gDn15Freqs[gDn15FreqsByPeriods[pPeriod][0]][0]; 
	}
	else lFreqShift = gDn15Freqs[pFreq][0];

	lPerShift = gDn15Periods[pPeriod][0];
	
	lPrePhpFile = gDn15Periods[pPeriod][2];
	
	for (j = 0; j < gDn15FreqsByPeriods[pPeriod].length; j++) {
		lFreqTempl = gDn15FreqTempl.replace(/#freq#/g, gDn15Freqs[gDn15FreqsByPeriods[pPeriod][j]][1]);
		lFreqTempl = lFreqTempl.replace(/#per#/g, pPeriod);
		lFreqTempl = lFreqTempl.replace(/#freqid#/g, gDn15FreqsByPeriods[pPeriod][j]);
		lFreqStr += lFreqTempl;
	}
	
	//izchisliavame nachalnata data i krainata data
	//~ alert(pCurrDate);
	lDate = new Date(pCurrDate);
	y = lDate.getYear(); m = lDate.getMonth() + 1; d = lDate.getDate(); h = lDate.getHours(); mi = lDate.getMinutes();
	if (y < 1000) y = y + 1900;
	if (m < 10) m = "0" + m; if (d < 10) d = "0" + d; if (h < 10) h = "0" + h; if (mi < 10) mi = "0" + mi;
	lEndDate = y + "-" + m + "-" + d + "-" + h + "-" + mi;
	
	lDate.setDate(lDate.getDate() - lPerShift);
	y = lDate.getYear(); m = lDate.getMonth() + 1; d = lDate.getDate();
	if (y < 1000) y = y + 1900;
	if (m < 10) m = "0" + m; if (d < 10) d = "0" + d; 
	lStartDate = y + "-" + m + "-" + d;

	//writevame v diva navigaciata + tagovete za samata grafika
	
	lGraphTempl = lGraphTempl.replace(/#sd#/g, lStartDate);
	lGraphTempl = lGraphTempl.replace(/#ed#/g, lEndDate);
	lGraphTempl = lGraphTempl.replace(/#f#/g, lFreqShift);
	lGraphTempl = lGraphTempl.replace(/#phpfile#/g, lPrePhpFile);
	
	//~ alert(lGraphTempl);
	lDiv = document.getElementById(pDivId);
	lDiv.innerHTML = lGraphTempl;
	//~ alert(lGraphTempl);
	lDivFreqs = document.getElementById(pDivFreqsId);
	lDivFreqs.innerHTML = lFreqStr;

	//boldvane na periodite
	lPer = document.getElementById("p" + gDn15LastPerBold);
	lPer.style.fontWeight = "";
	lPer = document.getElementById("p" + pPeriod);
	lPer.style.fontWeight = "bold";
	gDn15LastPerBold = pPeriod;
	lFreqLink = document.getElementById("f" + pFreq);
	lFreqLink.style.fontWeight = "bold";
	
}
