﻿/**
 * ajax.js
 *
 * @author Peter Molnar <molipet15@freemail.hu> 
 * @version 1.0
 *
 * @copyright Copyright (c) 2006-08, chek <www.chek.hu>  
 *
 * AJAX funkciokat megvalosito javascript-gyujtemeny
 *
 */

var Ajax = {
	/**
	*	vegrehajtja a scriptet
	*
	* @param string dataSource - az URL amit el kell kuldeni
	*/
	makeURL : function(dataSource, message) {
		xmlHttpURL = this.createXMLHttpRequest();
		xmlHttpURL.open("GET", dataSource + "&ajax", true);
		xmlHttpURL.onreadystatechange = function() {
			Ajax.loadPart(xmlHttpURL, "message");
			document.getElementById("message").style.display = "block";
		};
		xmlHttpURL.send(null);
	},
	
	
	/**
	*	betolti a menu-sort a topmenu DOM id-vel jelzett helyre
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje a menu-t
	*/
	loadMenu : function(dataSource) {
		xmlHttpMenu = this.createXMLHttpRequest();
		xmlHttpMenu.open("GET", dataSource + "&ajax&topmenu", true);
		xmlHttpMenu.onreadystatechange = function() {Ajax.loadPart(xmlHttpMenu, "topmenu");};
		xmlHttpMenu.send(null);
	},
	
	/**
	*	betolti a bal menu-sort a leftmenu DOM id-vel jelzett helyre
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje a menu-t
	*/
	loadLeftMenu : function(dataSource) {
		if (document.getElementById("leftmenu")) {
			xmlHttpLeftMenu = this.createXMLHttpRequest();
			xmlHttpLeftMenu.open("GET", dataSource + "&ajax&leftmenu", true);
			xmlHttpLeftMenu.onreadystatechange = function() {Ajax.loadPart(xmlHttpLeftMenu, "leftmenu");};
			xmlHttpLeftMenu.send(null);
		}
	},
	
	/**
	*	betolti a login menu-sort a topmenu DOM id-vel jelzett helyre
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje a menu-t
	*/
	loadLogMenu : function(dataSource) {
		if (document.getElementById("logmenu")) {
			xmlHttpLogMenu = this.createXMLHttpRequest();
			xmlHttpLogMenu.open("GET", dataSource + "&ajax&logmenu", true);
			xmlHttpLogMenu.onreadystatechange = function() {Ajax.loadPart(xmlHttpLogMenu, "logmenu");};
			xmlHttpLogMenu.send(null);
		}
	},
	
	/**
	*	betolti a content_text-t a content_text DOM id-vel jelzett helyre
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje a menu-t
	*/
	loadContentText : function(dataSource) {
		if (document.getElementById("content_text")) {
			xmlHttpContentText = this.createXMLHttpRequest();
			xmlHttpContentText.open("GET", dataSource + "&ajax", true);
			xmlHttpContentText.onreadystatechange = function() {Ajax.loadPart(xmlHttpContentText, "content_text");};
			xmlHttpContentText.send(null);
		}
	},
	
	/**
	*	betolti az utvonal-sort a rout_top, rout_bottom DOM id-vel jelzett helyre
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje az utvonalat-t
	*/
	loadRoute : function(dataSource) {
		if (document.getElementById("route_top")) {
			xmlHttpRouteTop = this.createXMLHttpRequest();
			xmlHttpRouteTop.open("GET", dataSource + "&ajax&route", true);
			xmlHttpRouteTop.onreadystatechange = function() {Ajax.loadPart(xmlHttpRouteTop, "route_top");};
			xmlHttpRouteTop.send(null);
		}
		if (document.getElementById("route_bottom")) {
			xmlHttpRouteBottom = this.createXMLHttpRequest();
			xmlHttpRouteBottom.open("GET", dataSource + "&ajax&route", true);
			xmlHttpRouteBottom.onreadystatechange = function() {Ajax.loadPart(xmlHttpRouteBottom, "route_bottom");};
			xmlHttpRouteBottom.send(null);
		}
	},
	
	/**
	*	betolti a login reszt a loginbox DOM id-vel jelzett helyre
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje az utvonalat-t
	*/
	loadLogin : function(dataSource) {
		if (document.getElementById("loginbox")) {
			xmlHttpLogin = this.createXMLHttpRequest();
			xmlHttpLogin.open("GET", dataSource + "&ajax&log", true);
			xmlHttpLogin.onreadystatechange = function() {Ajax.loadPart(xmlHttpLogin, "loginbox");};
			xmlHttpLogin.send(null);
		}
	},
	
	/**
	*	betolti a footer reszt a loginbox DOM id-vel jelzett helyre
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje az utvonalat-t
	*/
	loadAjaxFooter : function(dataSource) {
		if (document.getElementById("ajaxfooter")) {
			xmlHttpFooter = this.createXMLHttpRequest();
			xmlHttpFooter.open("GET", dataSource + "&ajax&ajaxfooter", true);
			xmlHttpFooter.onreadystatechange = function() {Ajax.loadPart(xmlHttpFooter, "ajaxfooter");};
			xmlHttpFooter.send(null);
		}
	},
	
	/**
	*	betolti a tetszoleges URL-t a topmenu DOM id-vel jelzett helyre
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje a tetszoleges dolgot-t
	*/
	loadID : function(dataSource, id) {
		if (document.getElementById(id)) {
			xmlHttpID = this.createXMLHttpRequest();
			xmlHttpID.open("GET", dataSource + "&ajax&justID", true);
			xmlHttpID.onreadystatechange = function() {Ajax.loadPart(xmlHttpID, id);};
			xmlHttpID.send(null);
		}
	},
	
	/**
	*	betolti a tetszoleges URL-t a topmenu DOM id-vel jelzett helyre SZINKRON
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje a tetszoleges dolgot-t
	*/
	loadIDSync : function(dataSource, id) {
		if (document.getElementById(id)) {
			xmlHttpID = this.createXMLHttpRequest();
			xmlHttpID.open("GET", dataSource + "&ajax&justID", false);
			xmlHttpID.send(null);
			//xmlHttpID.onreadystatechange = function() {Ajax.loadPart(xmlHttpID, id);};
			text = xmlHttpID.responseText;
			document.getElementById(id).innerHTML = text;
			this.makeJS(text);
		}
	},
	
	/**
	*	betolt egy oldalt a content_text DOM id-vel jelzett helyre
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje az adott oldalt
	*/
	loadPage : function(dataSource, scrollTop) {
		//this.loadMenu(dataSource); - nem kell ujratolteni, mert akkor elcseszodik a tooltip js-effect
		this.loadRoute(dataSource);
		this.loadLeftMenu(dataSource);
		//this.loadLogMenu(dataSource); - nem kell ujratolteni, mert akkor elcseszodik a tooltip js-effect
		this.loadLogin(dataSource);
		this.loadAjaxFooter(dataSource);
		xmlHttp = this.createXMLHttpRequest();
		xmlHttp.open("GET", dataSource + "&ajax", true);
		xmlHttp.onreadystatechange = function() {Ajax.loadPart(xmlHttp, "content_text");};
		xmlHttp.send(null);
		this.setScroll(scrollTop);
	},
	
	/**
	*	a real time form TEXT, CHECKBOX, RADIO, PASSWORD tiupsu osszes mezojere beallitja az onBlur esemenykezelot
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje a kimenetet
	* @param string formName - a form neve
	*/
	/*realTimeInit : function(dataSource, formName) {
		form = document.forms[formName];
		childLen = form.length;
		for (i = 0; i < childLen; i++) {
			field = form[i];
			if (field.name) {
				if (field.type == "checkbox" || field.type == "radio" || field.type == "text" || field.type == "password") {
					field.onblur = Ajax.realTimeCheck(dataSource, field);
				}
			}
		}
	},*/
	/**
	*	a real time form ellenorzos reszeknel hasznaljuk
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje a kimenetet
	* @param object t - a mezo objektuma
	* @param string formName - a form neve, amibol majd a POST query stringet kell csinalni
	* @param string errorIndex - ezt akkor kell hasznalni, ha egy adott hiba-t tobb mezo okozhat (pl: datumnal - ev, ho, nap), ekkor az itt megadott string legyen a PHP this->error assoc tomb indexe - OPCIONALIS
	*/
	realTimeCheck : function(dataSource, t, formName, errorIndex) {
		if (!errorIndex) {
			if (t.name) name = t.name;
			else alert("Hiányzik a name attributum!");
		}
		else name = errorIndex;
		xmlHttpRealTimeCheck = this.createXMLHttpRequest();
		xmlHttpRealTimeCheck.open("POST", dataSource + "&rt=" + name + "&formname=" + formName + "&ajax", true);
		xmlHttpRealTimeCheck.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttpRealTimeCheck.onreadystatechange = function() {Ajax.loadRealTimeMessage(xmlHttpRealTimeCheck, t);};
		xmlHttpRealTimeCheck.send(this.createPOSTQueryString(formName));
	},
	/**
	*	a real time form ellenorzos reszeknel hasznaljuk hasznaljuk, amikor van jelszo es jelszo ujra
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje a kimenetet
	* @param object t1 - az egyik passowrd mezo objektuma
	* @param object t2 - a masik password mezo objektuma
	*/
	/*realTimePW : function(dataSource, t1, t2) {
		if (t2.parentNode.id) {
			id = t2.parentNode.id;
		}
		else alert("Nem tudom, hogy melyik ID-vel ellátott területre kell adnom a választ!");
		if (t2.name) {
			name2 = t2.name;
		}
		else alert("Hiányzik a második jelszó name attributuma!");
		if (t1.name) {
			name1 = t1.name;
		}
		else alert("Hiányzik az első jelszó name attributuma!");
		xmlHttpRealTime = this.createXMLHttpRequest();
		xmlHttpRealTime.open("GET", dataSource + "&rt=" + id + "&" + name1 + "=" + escape(encodeURI(t1.value)) + "&"  + name2 + "=" + escape(encodeURI(t2.value)) + "&ajax", true);
		xmlHttpRealTime.onreadystatechange = function() {Ajax.loadRealTimeMessage(xmlHttpRealTime, id);};
		xmlHttpRealTime.send(null);
	},*/
	/**
	*	a real time url kopmapibilis name eloallitasa
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje a kimenetet
	* @param object t - a mezo objektuma
	*/
	realTimeName : function(dataSource, t, destName, formName) {
		if (t.name) {
			name = t.name;
		}
		else alert("Hiányzik a name attributum!");
			
		xmlHttpRealTimeCheck = this.createXMLHttpRequest();
		xmlHttpRealTimeCheck.open("POST", dataSource + "&rt=" + name + "&formname=" + formName + "&ajax", true);
		xmlHttpRealTimeCheck.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttpRealTimeCheck.onreadystatechange = function() {Ajax.loadRealTimeMessage(xmlHttpRealTimeCheck, t);};
		xmlHttpRealTimeCheck.send(this.createPOSTQueryString(formName));
		
		xmlHttpRealTimeName = this.createXMLHttpRequest();
		// EZ csak azert kel, mert van admin es, hogy a hozzadobott nev, az jol menjen at
		if (destName != "username_url" && document.forms[formName].username) {
			if (document.forms[formName].username.value) {
				xmlHttpRealTimeName.open("GET", dataSource + "&rt=" + destName + "&" + name + "=" + escape(encodeURI(t.value)) + "&username=" + document.forms[formName].username.value + "&formname=" + formName + "&ajax", true);
			}
			else { // van olyan form, amin van usernev, csak ures, amikor ujat veszel fel
				xmlHttpRealTimeName.open("GET", dataSource + "&rt=" + destName + "&" + name + "=" + escape(encodeURI(t.value)) + "&username=&formname=" + formName + "&ajax", true);
			}
		}
		else {	// ez az alap reg-es
			xmlHttpRealTimeName.open("GET", dataSource + "&rt=" + destName + "&" + name + "=" + escape(encodeURI(t.value)) + "&formname=" + formName + "&ajax", true);
		}
		xmlHttpRealTimeName.onreadystatechange = function() {Ajax.loadPart(xmlHttpRealTimeName, destName);};
		xmlHttpRealTimeName.send(null);
	},
	
	/**
	*	a megadott div-be irja a tartalmat
	*
	* @param XMLHttpRequest - xmlHttp a keres
	* @param object t - a form egy mezoje, aminek szulojebe megy a kimenet
	*/
	loadRealTimeMessage : function(xmlHttp, t) {
		if(xmlHttp.readyState == 4) {
			if(xmlHttp.status == 200) {
				text = xmlHttp.responseText;
				//alert(text);
				t.parentNode.parentNode.lastChild.innerHTML = text;
				this.makeJS(text);
			}
		}
	},
	/**
	*	a real time kattintos reszeknel hasznaljuk
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje a kimenetet
	* @param object t - a mezo objektuma
	* @param object id - DOM id amibe a kimenetet kell rakni
	* @param string warning - DOM id amibe a kimenetet kell rakni
	*/
	realTimeOnSubmit : function(dataSource, t, warningid) {		
		// az olyan textarea mezoket, amin van tiny, kulon kell kezelni, es a value-t bellitani
		childLen = t.length;
		for (i = 0; i < childLen; i++) {
			field = t[i];
			if (field.name) {
				if (field.type == "textarea") {
					if (tinyMCE.get(field.id)) {	// ha van ralove tinyMCE
						field.value = tinyMCE.get(field.id).getContent();
					}
				}
			}
		}
		// kuldes
		xmlHttpRealTimeOnSubmit = this.createXMLHttpRequest();
		xmlHttpRealTimeOnSubmit.open("POST", dataSource + "&rt=all&formname=" + t.name + "&ajax", true);
		xmlHttpRealTimeOnSubmit.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttpRealTimeOnSubmit.onreadystatechange = function() {
			if(xmlHttpRealTimeOnSubmit.readyState == 4) {
				if(xmlHttpRealTimeOnSubmit.status == 200) {
					text = xmlHttpRealTimeOnSubmit.responseText;
					//alert(text);
					if (text == '0') {
						WaitPlease.start("Űrlap küldése folyamatban...", "Űrlap küldése");
						t.submit();
					}
					else {
						WarnLightBox.start(warningid, text);
					}
				}
			}
		}
		//alert(this.createPOSTQueryString(t.name));
		xmlHttpRealTimeOnSubmit.send(this.createPOSTQueryString(t.name));
		return false;
	},
	
	/**
	*	beallitja az oldal scrollozasat
	*
	* @param string scrollTop - a tetotol mennyire ugorjon a scroll
	*/
	setScroll : function(scrollTop) {
		if (scrollTop) {
			if (self.pageYOffset) {
				scrollY = self.pageYOffset;
			}
				else if (document.documentElement && document.documentElement.scrollTop) {
				scrollY = document.documentElement.scrollTop;
			}
			else if (document.body) {
				scrollY = document.body.scrollTop;
			}
			if (scrollY > scrollTop) window.scrollTo(0, scrollTop);
		}
	},
	
	/**
	*	elkuld egy formot es content_text DOM id-vel jelzett helyre kerul a visszakuldott eredmeny
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje az adott oldalt
	* @param string formName - a HTML form name attributuma, amit fel kell dolgozni
	*/
	sendForm : function(dataSource, formName, scrollTop) {
		xmlHttp = this.createXMLHttpRequest();
		xmlHttp.open("POST", dataSource + "&ajax", true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.onreadystatechange = function() {Ajax.loadPart(xmlHttp, "content_text");};
		xmlHttp.send(this.createPOSTQueryString(formName));
		//this.loadMenu(dataSource); - nem kell ujratolteni, mert akkor elcseszodik a tooltip js-effect
		this.loadRoute(dataSource);
		this.loadLeftMenu(dataSource);
		//this.loadLogMenu(dataSource); - nem kell ujratolteni, mert akkor elcseszodik a tooltip js-effect
		this.loadLogin(dataSource);
		this.loadAjaxFooter(dataSource);
		this.setScroll(scrollTop);
	},
	
	/**
	*	elkuld egy formot es a megadott DOM id-vel jelzett helyre kerul a visszakuldott eredmeny
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje az adott oldalt
	* @param string formName - a HTML form name attributuma, amit fel kell dolgozni
	*/
	sendFormID : function(dataSource, formName, id) {
		xmlHttp = this.createXMLHttpRequest();
		xmlHttp.open("POST", dataSource + "&ajax", true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.onreadystatechange = function() {Ajax.loadPart(xmlHttp, id);};
		xmlHttp.send(this.createPOSTQueryString(formName));
	},
	
	/**
	*	elkuld egy loginformot es content_text DOM id-vel jelzett helyre kerul a visszakuldott eredmeny
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje az adott oldalt
	* @param string formName - a HTML form name attributuma, amit fel kell dolgozni
	*/
	/*sendLoginForm : function(dataSource, formName) {
		xmlHttp = this.createXMLHttpRequest();
		xmlHttp.open("POST", dataSource + "&ajax&log", true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.onreadystatechange = function() {Ajax.loadPart(xmlHttp, "loginbox");};
		xmlHttp.send(this.createPOSTQueryString(formName));
		this.loadMenu(dataSource);
		this.loadRoute(dataSource);
		this.loadLeftMenu(dataSource);
		this.loadLogMenu(dataSource);
		this.loadContentText(dataSource);
		this.loadAjaxFooter(dataSource);
	},*/
	
	/**
	*	elkuld egy formot es content_text DOM id-vel jelzett helyre kerul a visszakuldott eredmeny
	*
	* @param string dataSource - az URL amit el kell kuldeni, hogy lekerje az adott oldalt
	* @param string formName - a HTML form name attributuma, amit fel kell dolgozni
	*/
	sendLeftForm : function(dataSource, formName) {
		xmlHttpLeftForm = this.createXMLHttpRequest();
		xmlHttpLeftForm.open("POST", dataSource + "&ajax&leftmenu", true);
		xmlHttpLeftForm.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttpLeftForm.onreadystatechange = function() {Ajax.loadPart(xmlHttpLeftForm, "leftmenu");};
		xmlHttpLeftForm.send(this.createPOSTQueryString(formName));
	},
	
	/**
	*	az XMLHttpRequest keres kiepitese
	*
	* @return felepitett XMLHttp keres
	*/
	createXMLHttpRequest : function() {
		if (window.ActiveXObject) {
			return new ActiveXObject("Microsoft.XMLHTTP");
		}
		else if (window.XMLHttpRequest) {
			return new XMLHttpRequest();
		}
	},
	
	/**
	*	a megadott div-be irja a tartalmat
	*
	* @param XMLHttpRequest - xmlHttp a keres
	* @param string divID - a DOM id, amibe a tartalom kerul
	*/
	loadPart : function(xmlHttp, divID) {
		if(xmlHttp.readyState == 4) {
			if(xmlHttp.status == 200) {
				text = xmlHttp.responseText;
				//alert(text);
				document.getElementById(divID).innerHTML = text;
				this.makeJS(text);
			}
		}
	},
	
	/**
	*	a valaszban levo javascripteket kezeli
	*
	* @param string text - a HTML oldal forrasa
	*/
	makeJS : function(text) {
		js = "";
		var beginPos = 0;
		var endPos;
		while((beginPos = text.indexOf("<script", beginPos)) >= 0) {
			beginPos = text.indexOf(">", beginPos) + 1;
			endPos = text.indexOf("/script", beginPos) - 1;
			js += text.substr(beginPos, endPos - (beginPos));
			beginPos = endPos + 7;
		}
		eval(js);
	},
	
	/**
	*	osszeallitja a POST kerest a form mezoibol
	*
	* @param string formName - a HTML form name attributuma, amit fel kell dolgozni
	* @return string - az osszeallitott POST keres
	*/
	createPOSTQueryString : function(formName) {
		queryString = "";
		form = document.forms[formName];
		childLen = form.length;
		for (i = 0; i < childLen; i++) {
			field = form[i];
			if (field.name) {
				if (field.type == "checkbox") {
					if (field.checked) queryString += "&" + field.name + "=" + escape(encodeURI(field.value));
					else queryString += "&" + field.name + "=" + escape(encodeURI(""));
				}
				else if(field.type == "radio") {
					if (field.checked) queryString += "&" + field.name + "=" + escape(encodeURI(field.value));
				}
				else if(field.type == "select-one") {
					queryString += "&" + field.name + "=" + escape(encodeURI(field.options[field.selectedIndex].text));
				}
				else queryString += "&" + field.name + "=" + escape(encodeURI(field.value));
			}
		}
		//alert(queryString.substr(1));
		return queryString.substr(1);
	},
	
	/**
	*	a feltoltott kep nevet irja be rejtett mezobe
	*
	* @param string formName - a HTML form name attributuma, aminek rejtett mezojebe a feltoltott kep neve kerul
	* @param string map - a mappa amiben a feltoltott kep van
	* @param string image - a feltoltott kep neve
	*/
	setImgName : function(formName, map, image) {
		// ha van video, akkor azt el kell tuntetni
		if (document.getElementById("preview_video")) document.getElementById("preview_video").style.display = "none";
		
		
		if (document.forms[formName]) {
			if (document.forms[formName].img_name) document.forms[formName].img_name.value = image;
			// ha volt hiba-ellenorzes eltuntetjuk
			/*if (document.getElementById("img_error")) {
				document.getElementById("img_error").lastChild.firstChild.nodeValue = "";
				document.getElementById("img_error").firstChild.style.backgroundImage = "";
			}*/
			
			//if (document.forms[formName].img.parentNode.parentNode.lastChild.firstChild.nodeValue) document.forms[formName].img.parentNode.parentNode.lastChild.firstChild.nodeValue = "";
			//if (document.forms[formName].img.parentNode.parentNode.style.backgroundImage) document.forms[formName].img.parentNode.parentNode.style.backgroundImage = "";
		}
		var preview = document.getElementById("preview");
		preview.src = map + "/" + image;
		preview.style.display = "block";
		if (document.getElementById("preview_big")) {
			var preview_big = document.getElementById("preview_big");
			preview_big.src = map + "/big/" + image;
			preview_big.style.display = "block";
		}
		if (document.forms[formName].submit) {
			document.forms[formName].submit.style.display = "block";
		}
		// ha kepfeltoltes utan egybol myBoxban megy a cucc
		if(preview.parentNode.href) {
			hrefTmp = preview.parentNode.href;
			beg = 0;
			for (i = 1; i < 4; i++) {
				pos = hrefTmp.indexOf("'", beg);
				beg = pos + 1;
			}
			pos2 = hrefTmp.indexOf("'", pos + 1);
			kepnevOld = hrefTmp.substr(pos + 1, pos2 - (pos + 1));
			hrefTmp = hrefTmp.replace(kepnevOld, image);
			preview.parentNode.href = hrefTmp;
		}
		WaitPlease.stop();
	},
	
	/**
	*	a feltoltott kep nevet irja be rejtett mezobe
	*
	* @param string formName - a HTML form name attributuma, aminek rejtett mezojebe a feltoltott kep neve kerul
	* @param string map - a mappa amiben a feltoltott kep van
	* @param string image - a feltoltott kep neve
	*/
	setVideoName : function(formName, map, video) {
		// ha van kep, akkor azt el kell tuntetni
		document.getElementById("preview").style.display = "none";
		if (document.getElementById("preview_big")) document.getElementById("preview_big").style.display = "none";
		
		if (document.forms[formName]) document.forms[formName].video_name.value = video;
		document.getElementById("preview_video").style.display = "block";
		obj = "<object width='" + videoW + "' height='" + videoH + "' type='application/x-oleobject' codebase='http://www.microsoft.com/ntserver/netshow/download/en/nsmp2inf.cab#Version=5,1,51,415' classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'>";
		obj += "<param value='videos_site/" + video + "' name='url' />";
		obj += "<param name='autoStart' value='true' />";
		obj += "<embed src='videos_site/" + video + "' width='" + videoW + "' height='" + videoH + "' autostart='1' pluginspage='http://www.microsoft.com/windows/mediaplayer/download/default.asp' type='video/x-ms-asf-plugin'/>";
		obj += "</object>";
		document.getElementById("preview_video").innerHTML = obj;
	},
	
	/**
	*	...
	*
	* @param string ...
	*/
	loadMyBox : function(dataSource, imageName) {
		MyBox.init();
		MyBox.close();
		xmlHttpMyBox = this.createXMLHttpRequest();
		xmlHttpMyBox.open("GET", dataSource + "&ajax&mybox_set", true);
		xmlHttpMyBox.onreadystatechange = function() {Ajax.loadPart(xmlHttpMyBox, "myBoxSet");};
		xmlHttpMyBox.send(null);
		MyBox.preload(imageName);
		MyBox.setBG();
		MyBox.setEffectFrame();
	}
};

