var rotator;
var myAccordion;
var Sexy;

function confirmPersonalDelete(message,id) {
	var usr_reply = Sexy.confirm(message,
		{
			textBoxBtnOk : 'Igen',
			textBoxBtnCancel : 'Mégsem',
			onComplete: function(usr_reply) {
				if (usr_reply) {
					window.location.href='?page=classified&delete=' + id;
				}
			}
		});
}

function confirmPicDelete(el,message,hide_el) {
	if (el.get('checked')) {
		var usr_reply = Sexy.confirm(message,
			{
				textBoxBtnOk : 'Igen',
				textBoxBtnCancel : 'Mégsem',
				onComplete: function(usr_reply) {
					if (usr_reply) {
						el.set('checked','checked');
						if ($(hide_el)) {
							$(hide_el).setStyle('display','none');
						}
					}
				}
			});
	} else {
		if ($(hide_el)) {
			$(hide_el).setStyle('display','');
		}
	}
}
function lostPass() {
	var usr_reply = Sexy.prompt('Kérjük adja meg a regisztrációkor megadott e-email címét!','',
		{
			textBoxBtnOk : 'Küldés',
			textBoxBtnCancel : 'Mégsem',
			onComplete: function(user_email) {
				if (user_email) {
					new Request({
						url : 'ajax.php',
						onSuccess : function(responseText, responseXML) {
							Sexy.alert(responseText);
						}
					}).send('command=lostpass&email=' + user_email);
				}
			}
		});
}

function inactivateAd(ad_id) {
	var usr_reply = Sexy.confirm('Biztosan inaktiválni akarja a hirdetést?<br />Az újra aktiválás új megrendelésnek számít!',
		{
			textBoxBtnOk : 'Inaktiválás',
			textBoxBtnCancel : 'Mégsem',
			onComplete: function(usr_reply) {
				if (usr_reply) {
					new Request({
						url : 'ajax.php',
						onSuccess : function() {
							var uri = window.location.href;
							if (uri.indexOf('#')>=0) {
								window.location.href=uri.split("#")[0];
							} else {
								window.location.href=uri;
							}
						}
					}).send('command=inactivate&id=' + ad_id);
				}
			}
		});
}

function orderAds() {
	var adlist = '';
	
	$$('input.ordercheck').each(function(el){
		if (el.get('checked')) {
			if (adlist == '') {
				adlist = el.get('value');
			} else {
				adlist = adlist + ',' + el.get('value');
			}
		}
	});
	if (adlist != '') {
		new Request({
			url : 'ajax.php',
			onSuccess : function(responseText, responseXML) {
				Sexy.alert(responseText,{
					onComplete: function() {
						window.location.href = window.location.href.split("#")[0];
					}
				});
			}
		}).send('command=orderads&ids=' + adlist);
	}
}

function sendMyCv(ad_id) {
	var usr_reply = Sexy.confirm('Elküldhetjük az Ön önéletrajzát a hírdetőnek, vagy előbb átnézi a tárolt önéletrajzot?',
		{
			textBoxBtnOk : 'Küldés',
			textBoxBtnCancel : 'Átnézem',
			onComplete: function(usr_reply) {
				if (usr_reply) {
					window.location.href = '?page=showad&id=' + ad_id + '&sendcv=1';
				} else {
					window.location.href = '?page=cvprofile&ad_id=' + ad_id;
				}
			}
		});
}

function saveAd(ad_id) {
	new Request({
		url : 'ajax.php',
		onSuccess : function() {
			Sexy.alert('A hirdetést elmentettük, azt a Mentett képzéseim menüpont alatt lehet megtekinteni');
			refreshSaved('.savedlistdiv');
		}
	}).send('command=savead&id=' + ad_id);
}

function delSavedAd(ad_id) {
	new Request({
		url : 'ajax.php',
		onSuccess : function() {
			if ($('saved_' + ad_id)) {
				$('saved_' + ad_id).dispose();
			}
		}
	}).send('command=savead&id=-' + ad_id);
}

function refreshSaved(el_pattern) {
	new Request.HTML({
		url : 'ajax.php',
		onSuccess : function(responseTree, responseElements, responseHTML, responseJavaScript) {
			$$(el_pattern).each(function(el){
				var id=el.get('id');
				responseTree[0].replaces(el).set('id',id);
			});
		}
	}).send('command=savedads');
}

function printAd(ad_id) {
	var WindowObject = window.open('details.html?id=' + ad_id + '&printandclose=1');
}

function loadSchool(school) {
	$$('#sbox-content input.schoolname')[0].set('value' , school.name);
	$$('#sbox-content input.schoolwing')[0].set('value' , school.wing);
	$$('#sbox-content input.schoolspec')[0].set('value' , school.spec);
	$$('#sbox-content input.schoolqualification')[0].set('value' , school.qualification);
	$$('#sbox-content select.schoolstart_year')[0].set('value' , school.startdate.split('-')[0]);
	$$('#sbox-content select.schoolstart_month')[0].set('value' , school.startdate.split('-')[1]);
	$$('#sbox-content select.schoolend_year')[0].set('value' , school.enddate.split('-')[0]);
	$$('#sbox-content select.schoolend_month')[0].set('value' , school.enddate.split('-')[1]);
	$$('#sbox-content textarea.schoolother')[0].set('value' , school.info);
}

function generateSchool(thisrow) {
	var trow = new Element('tr');
	trow.set('class',thisrow.get('class'));
	var school = new Object();
	school.name = $$('#sbox-content input.schoolname')[0].get('value');
	school.wing = $$('#sbox-content input.schoolwing')[0].get('value');
	school.spec = $$('#sbox-content input.schoolspec')[0].get('value');
	school.qualification = $$('#sbox-content input.schoolqualification')[0].get('value');
	school.startdate = $$('#sbox-content select.schoolstart_year')[0].get('value') + '-' + $$('#sbox-content select.schoolstart_month')[0].get('value');
	school.enddate = $$('#sbox-content select.schoolend_year')[0].get('value') + '-' + $$('#sbox-content select.schoolend_month')[0].get('value');
	school.info = $$('#sbox-content textarea.schoolother')[0].get('value');
	trow.grab(new Element('td',{ 'html': school.name }));
	trow.grab(new Element('td',{ 'html': school.qualification }));
	trow.grab(new Element('td',{ 'html': school.startdate }));
	trow.grab(new Element('td',{ 'html': school.enddate }));
	var edit = new Element('a',{ 'href': '#education_edit', 'class' : 'edit boxed' , 'rel' : '{handler: \'clone\'}', 'html' : 'megmutat / javít' });
	attachSqueezeBox(edit);
	var data_input = new Element('input' , {'type' : 'hidden', 'name' : 'data[cv_schools][]' } );
	data_input.set('value',JSON.encode(school));
	trow.grab(new Element('td',{ 'html':'<br /><a href="javascript:void(0);" onclick="deleteRow(this);">törlés</a>' }).grab(edit,'top').grab(data_input));
	
	return trow;
}

function loadCompany(company) {
	$$('#sbox-content input.companyname')[0].set('value' , company.name);
	$$('#sbox-content input.companyposition')[0].set('value' , company.position);
	$$('#sbox-content select.companylevel')[0].set('value' , company.level);
	$$('#sbox-content select.companystart_year')[0].set('value' , company.startdate.split('-')[0]);
	$$('#sbox-content select.companystart_month')[0].set('value' , company.startdate.split('-')[1]);
	$$('#sbox-content select.companyend_year')[0].set('value' , company.enddate.split('-')[0]);
	$$('#sbox-content select.companyend_month')[0].set('value' , company.enddate.split('-')[1]);
	$$('#sbox-content textarea.companyother')[0].set('value' , company.info);
}

function generateCompany(thisrow) {
	var trow = new Element('tr');
	trow.set('class',thisrow.get('class'));
	var company = new Object();
	company.name = $$('#sbox-content input.companyname')[0].get('value');
	company.position = $$('#sbox-content input.companyposition')[0].get('value');
	company.level = $$('#sbox-content select.companylevel')[0].get('value');
	company.startdate = $$('#sbox-content select.companystart_year')[0].get('value') + '-' + $$('#sbox-content select.companystart_month')[0].get('value');
	company.enddate = $$('#sbox-content select.companyend_year')[0].get('value') + '-' + $$('#sbox-content select.companyend_month')[0].get('value');
	company.info = $$('#sbox-content textarea.companyother')[0].get('value');
	trow.grab(new Element('td',{ 'html': company.name }));
	trow.grab(new Element('td',{ 'html': company.position }));
	trow.grab(new Element('td',{ 'html': company.startdate }));
	trow.grab(new Element('td',{ 'html': company.enddate }));
	var edit = new Element('a',{ 'href': '#companies_edit', 'class' : 'edit boxed' , 'rel' : '{handler: \'clone\'}', 'html' : 'megmutat / javít' });
	attachSqueezeBox(edit);
	var data_input = new Element('input' , {'type' : 'hidden', 'name' : 'data[cv_companies][]' } );
	data_input.set('value',JSON.encode(company));
	trow.grab(new Element('td',{ 'html':'<br /><a href="javascript:void(0);" onclick="deleteRow(this);">törlés</a>' }).grab(edit,'top').grab(data_input));
	
	return trow;
}

function loadTraining(training) {
	$$('#sbox-content input.trainingname')[0].set('value' , training.name);
	$$('#sbox-content input.trainingqualification')[0].set('value' , training.qualification);
	$$('#sbox-content select.trainingdate_year')[0].set('value' , training.date.split('-')[0]);
	$$('#sbox-content select.trainingdate_month')[0].set('value' , training.date.split('-')[1]);
	$$('#sbox-content textarea.trainingother')[0].set('value' , training.info);
}

function generateTraining(thisrow) {
	var trow = new Element('tr');
	trow.set('class',thisrow.get('class'));
	var training = new Object();
	training.name = $$('#sbox-content input.trainingname')[0].get('value');
	training.qualification = $$('#sbox-content input.trainingqualification')[0].get('value');
	training.date = $$('#sbox-content select.trainingdate_year')[0].get('value') + '-' + $$('#sbox-content select.trainingdate_month')[0].get('value');
	training.info = $$('#sbox-content textarea.trainingother')[0].get('value');
	trow.grab(new Element('td',{ 'html': training.name }));
	trow.grab(new Element('td',{ 'html': training.qualification }));
	trow.grab(new Element('td',{ 'html': training.date }));
	var edit = new Element('a',{ 'href': '#training_edit', 'class' : 'edit boxed' , 'rel' : '{handler:\'clone\'}', 'html' : 'megmutat / javít' });
	attachSqueezeBox(edit);
	var data_input = new Element('input' , {'type' : 'hidden', 'name' : 'data[cv_training][]' } );
	data_input.set('value',JSON.encode(training));
	trow.grab(new Element('td',{ 'html':'<br /><a href="javascript:void(0);" onclick="deleteRow(this);">törlés</a>' }).grab(edit,'top').grab(data_input));
	
	return trow;
}

function myGetParent(element,tagName) {
	if (typeof(element.parentNode) != 'object') {
		return (null);
	} else if (element.parentNode.tagName.toLowerCase() == tagName) {
		return(element.parentNode);
	} else {
		return(myGetParent(element.parentNode,tagName));
	}
}

function deleteRow(element) {
	Sexy.confirm('Biztos, hogy törlhetem?',{
		textBoxBtnOk : 'Igen',
		textBoxBtnCancel : 'Mégsem',
		onComplete: function(usr_reply) {
			if (usr_reply) {
				if (typeof(element.getParent)!='undefined') {
					var parent = element.getParent('tr');
				} else {
					var parent = myGetParent(element,'tr');
				}
				parent.setStyle('display','none');
				parent.empty();
				parent.destroy();
			}
		}
	});
}

function dordRow(el,addremove) {
	var add = true;
	
	if ($defined(addremove)) {
		add = addremove;
	} else {
		add = (el.get('value')!='');
	}
	if (typeof(el.getParent)!='undefined') {
		var parent = el.getParent('div');
	} else {
		var parent = myGetParent(el,'div');
	}
	if (!add) {
		if (typeof(parent.hasClass)!='undefined') {
			if (!parent.hasClass('locked')) {
				parent.destroy();
			} else {
				parent.getChildren('input').each(function(el){el.set('value','');});
				parent.getChildren('select').each(function(el){el.set('value','');});
			}
		} else {
			parent.parentNode.removeChild(parent);
		}
	} else {
		if (typeof(parent.clone)!='undefined') {
			var new_el = parent.clone();
			parent.removeClass('candupe');
			new_el.removeClass('locked');
			new_el.inject(parent,'after');
		} else {
			var new_el = parent.cloneNode(true);
			parent.appendChild(new_el);
		}
		if ($defined(myAccordion)) {
			var panel = myAccordion.previous;
			if (panel!=0) {
				myAccordion.display(0);
			} else {
				myAccordion.display(1);
			}
			myAccordion.display.delay(10,myAccordion,panel);
		}
	}
}

function attachSqueezeBox(el) {
	SqueezeBox.assign(el, {
		size: {x: 650, y: 500},
		parse: 'rel',
		onOpen : function() {
			// this.element contais the element
			var popupwin = this;
			var opener = this.element;
			var thisrow = opener.getParents('tr');
			var thistable = opener.getParents('table').getChildren('tbody');
			if (opener.hasClass('edit')) {
				// load data from the editor
				var dataelem = popupwin.element.getParent('td').getChildren('input');
				var data = JSON.decode(dataelem[0].get('value'));
				if (opener.get('href')=='#education_edit') {
					loadSchool(data);
				} else if (opener.get('href')=='#training_edit') {
					loadTraining(data);
				} else if (opener.get('href')=='#companies_edit') {
					loadCompany(data);
				}
				$$('#sbox-content button.tovabb').addEvent('click',function(){
					popupwin.close();
				});
			}
			// attach save handler
			$$('#sbox-content button.tovabb').addEvent('click',function(){
				// construct a new row at the bottom of the table
				var trow;
				
				if (opener.get('href')=='#education_edit') {
					trow = generateSchool(thisrow);
				} else if (opener.get('href')=='#training_edit') {
					trow = generateTraining(thisrow);
				} else if (opener.get('href')=='#companies_edit') {
					trow = generateCompany(thisrow);
				}
				//companies_edit
				if (!opener.hasClass('edit')) {
					thisrow.toggleClass('csik');
					trow.inject(thisrow[0],'before');
				} else {
					trow.replaces(thisrow[0]);
				}
				popupwin.close();
				if ($defined(myAccordion)) {
					var panel = myAccordion.previous;
					myAccordion.display(0);
					myAccordion.display.delay(10,myAccordion,panel);
				}
			});
		}
	});
}

function startFrontpageBox(restart) {
	var current_item;
	var direction = 0;

	function activateItem(obj) {
	
		function fillNewItem(new_item,grab_to,content) {
			var link_item = new_item;
			link_item.getFirst('a').setProperty('href',link);
			
			if (content.picture.url!='') {
				link_item.getFirst('a').getFirst('img').setProperty('src',content.picture.url);
				link_item.getFirst('a').getFirst('img').setProperty('alt',content.title);
				link_item.getFirst('a').getFirst('img').setProperty('width','275');
				link_item.getFirst('a').getFirst('img').setProperty('height',content.picture.height);
				link_item.getFirst('a').getFirst('img').setStyle('display','block');
			} else {
				link_item.getFirst('a').getFirst('img').setStyle('display','none');
			}
			link_item.getFirst('h2').getFirst('a').set('text',content.title);
			link_item.getFirst('h2').getFirst('a').setProperty('href',link);
			link_item.getFirst('p').getFirst('a').set('html',content.lead); // .replaceAll('[','<').replaceAll(']','>')
			link_item.getFirst('p').getFirst('a').setProperty('href',link);
			
			if ($defined(grab_to)) {
				grab_to.grab(newdiv,'top');
			}
			var visible = 0;
		}
	
		var notran = $defined(current_item);
		deActivateItems();
		if ($type(obj)=='element') {
			if (obj.tagName != 'LI') {
				$try(function(){
					obj = obj.getParent('li');
				});
			}
			if (($defined(obj)) && (obj.tagName=='LI')) {
				current_item=obj;
				obj.addClass('highlighted');
				if (obj.getFirst('var')) {
					var link = obj.getFirst('a').getProperty('href');
					var content = JSON.decode(obj.getFirst('var').get('text'));
					if (!notran) {
						fillNewItem($('currentTopStory'),null,content);
					} else {
						var newdiv = $('currentTopStory').clone();
						newdiv.setStyle('z-index',1);
						newdiv.setStyle('opacity',0);
						
						fillNewItem(newdiv,$('currentTopStory').getParent(),content);
		
						$('currentTopStory').get('tween',{property:'opacity',duration:'long'}).start(0);
						var myFx = newdiv.get('tween',{property:'opacity',duration:'long',onComplete:function() {
								$('currentTopStory').dispose();
								newdiv.setStyle('opacity',1);
								newdiv.set('id','currentTopStory');
								newdiv.setStyle('z-index',0);
							}
						});
						myFx.start(1);
					}			
				}
			}
		}
	}
	
	function deActivateItems() {
		$$('li.highlighted').removeClass('highlighted');
	}

	function rotateItem(direction) {
		// activates the next item in frontpagebox list part
		// get the next item
		if (direction!=-1) {
			if ($defined(current_item)) {
				var next_item = current_item.getNext('li');
			}
			if (!$defined(next_item)) {
				var next_item = $('frontpage_list').getFirst('ul').getFirst('li');
			}
		} else {
			if ($defined(current_item)) {
				var next_item = current_item.getPrevious('li');
			}
			if (!$defined(next_item)) {
				var next_item = $('frontpage_list').getFirst('ul').getLast('li');
			}
		}
		activateItem(next_item);
	}

	if (!$defined(restart)) {
		// add event to list column
		$$('#frontpage_list ul li a').addEvent('mouseenter',function(event) {
			$clear(rotator);
			rotator = activateItem.delay(500,event.target,event.target);
		});
		$$('#frontpage_list ul li a').addEvent('mouseleave',function(event) {
			$clear(rotator);
		});
	}
	// start the rotator
	rotateItem.run(false);
	rotator = rotateItem.periodical(10000,null,1);
	
	if (!$defined(restart)) {
		$('frontpagebox').addEvent('mouseenter',function(){
			$clear(rotator);
		}).addEvent('mouseleave',function(){
			rotator = rotateItem.periodical(10000,null,1);
		});
		$$('#frontpagebox div.navigator').addEvent('mousedown',function(e) {
			if (e.client.x - e.target.getCoordinates().left>=30) {
				e.target.setStyle('background-position','bottom left');
				direction=1;
			} else {
				e.target.setStyle('background-position','center left');
				direction=-1;
			}
			$clear(rotator);
		}).addEvent('mouseup',function(e){
			e.target.setStyle('background-position','top left');
			if (direction!=0) {
				rotateItem(direction);
			}
			direction=0;
		});
		
		// hide partially invisibles
		if (newslist = $('frontpage_list').getFirst('ul')) {
			$each(newslist.getChildren('li'),function(item,idx,obj){
				coords = item.getCoordinates($('currentTopStory'));
				if (coords.bottom>413) {
					item.dispose();
				}
			});
		}
	}
}

function openSqueezeBox(el,options) {
	var height = 0;
	var width = 0;
	
	$try(function(){
		width = options.size.x;
		height = options.size.y;
	});

	if (width == 0) { width = 500; }
	if (height == 0) { height = 400; }
	
	if (width > window.getWidth() * 0.9) {
		width = window.getWidth() * 0.9;
		options.iframeOptions.scrolling = 'yes';
	}
	if (height > window.getHeight() * 0.9) {
		height = window.getHeight() * 0.9;
		options.iframeOptions.scrolling = 'yes';
	}
	
	options.size = {'x' : width, 'y' : height};
	return SqueezeBox.fromElement(el,options);
}

function setupSudoku() {
	if ($('sudokuBox')) {
		$('sudokuBox').addEvent('click',function(e){
			window.location.href = window.location.href.split('#')[0] + '#sudoku';
			openSqueezeBox($('sudokuBox'),{handler:'iframe',size:{x:620,y:550},url:'http://www.metropol.hu/service/sudoku2/index.html',iframeOptions:{scrolling:'no'}});
		});
		if (window.location.href.split('#').getLast()=='sudoku') {
			$('sudokuBox').fireEvent('click');
		}
	}
}

function startExtendedSearch() {
	$$('#extended_search fieldset').each(function(el){
		el.addEvent('click',function(e){
			if ((e.target.tagName!='INPUT') && ((e.target.tagName!='LABEL'))) {
				if (el.getChildren('ul').getStyle('display')=='none') {
					if ($('hideme')) {
						$('hideme').setStyle('display','none');
						$('hideme').set('id','');
					}
					el.getChildren('ul').setStyle('display','block');
					el.getChildren('ul').set('id','hideme');
				} else {
					el.getChildren('ul').setStyle('display','none');
				}
			}
		});
	});
}

function checkLength(obj,maxlength,indicator) {
	var cur_length = obj.value.length;
	if (cur_length>maxlength) {
		obj.value = obj.value.substring(0,maxlength);
		// hibajelzés!
		cur_length = maxlength;
		$(indicator+'_err').setStyle('display','inline');
	} else {
		$(indicator+'_err').setStyle('display','none');
	}
	$(indicator).set('value',maxlength - cur_length);
}

window.addEvent('domready',function() {
	// start article display box if present
	if ($defined($('currentTopStory'))) {
		startFrontpageBox();
	}
	if ($('extended_search')) {
		startExtendedSearch();
	}
	attachSqueezeBox($$('a.boxed'));
	if ($$('.tabs').length > 0) {
		var tab_str = window.location.href.split('#tab=');
		if ((typeof tab_str === 'object') && (tab_str.length>1)) {
			var tab=tab_str[1].toInt();
		} else {
			var tab=0;
		}
		var tabs = new _mpol.Tabs('.tabs','.tabpanel',{
			autoplay: false,
			startIndex : tab,
			transitionDuration:500,
			slideInterval:6000,
			hover:true,
			onShowSlide: function(slideIndex) {
				window.location.href=window.location.href.split("#tab")[0] + "#tab=" + slideIndex;
				this.slides[slideIndex].getChildren('form')[0].set('action',window.location.href);
				$('tab_input').set('value',slideIndex);
			}
		});
	}
	if ($$('.toggler').length > 0) {
		var sheet_str = window.location.href.split('#sheet=');
		if ((typeof sheet_str === 'object') && (sheet_str.length>1)) {
			var sheet=sheet_str[1].toInt();
		} else {
			var sheet=0;
		}
		if ($('sheet_input')) {
			$('sheet_input').set('value',sheet);
		}
		myAccordion = new Accordion($$('.toggler'), $$('.element'), {
			display: sheet,
			alwaysHide: false,
			onComplete: function(element) {
				this.elements.each(function(el,index) {
					if (index != this.previous) {
						el.setStyle('height','1px');
					}
				},this);
				window.location.href=window.location.href.split("#sheet")[0] + "#sheet=" + this.previous;
				if (element.getParents('form')[0]) {
					element.getParents('form')[0].set('action',window.location.href);
				}
				if ($('sheet_input')) {
					$('sheet_input').set('value',this.previous);
				}
			},
			onBackground: function(toggler, element) {
				toggler.removeClass('aktiv');
			},
			onActive: function(toggler, element) {
				toggler.addClass('aktiv');
			}
		});
	}
	if ($defined($('mysavedads'))) {
		$('mysavedads').addEvent('mouseenter',function() {
			$('mysavedadsshowhide').setStyle('display','block');
			refreshSaved('.savedlistdiv');
		}).addEvent('mouseleave',function() {
			$('mysavedadsshowhide').setStyle('display','none');
		});
	}
	$$('input.clickempty').addEvent('focus',function(e){
		if (this.hasClass('password')) {
			if (Browser.Engine.trident) {
				var el = new Element('input',{type:'password'});
				el.set('class',this.get('class'));
				el.set('name',this.get('name'));
				el.removeClass('clickempty');
				el.replaces(this);
				(function() { el.focus(); }).delay(100);
			} else {
				this.set('type','password');
			}
		}
		this.removeEvents('click').removeClass('clickempty').set('value','');
	});
	$$('input.clearonload').each(function(el){
		el.set('value','');
	});
	setupSudoku();
	$$('input.inactive').addEvent('focus',function(e){
		e.target.value='';
		e.target.removeClass('inactive');
		e.target.removeEvents('focus');
	});
	if ($defined($('katica_part'))) {
		$('katica_part').setStyle('display','');
		$('katica_part').addEvent('click',function(){
			var part_name = $('katica_part').get('alt');
			new Request({
				url : 'ajax.php',
				onSuccess : function(){
					openSqueezeBox($('logo'),{handler:'iframe',size:{x:420,y:260},url:'katica_index.php?part=' + part_name,iframeOptions:{scrolling:'no'}});
				}
			}).send('command=add_katica_part&part=' + part_name);
			$('katica_part').dispose();
		});
		if (window.location.href.indexOf('#showplay')!=-1) {
			openSqueezeBox($('katica_part'),{handler:'iframe',size:{x:420,y:260},url:'katica_index.php',iframeOptions:{scrolling:'no'}});
			window.location.href = window.location.href.replace('#showplay','#');
		}
	}
});
