 function pridaj(id,akcia){
	 window.open('libs/cars_edit.php?carid='+id+'&action='+akcia,'mywindow','scrollbars=1, resizable=1, width=800,height=600')
 };
 
 function obrazky(id){
 	 window.open('libs/pics_edit.php?carid='+id,'mywindow','width=500,height=500')
 };
 
 function zmaz_obrazok(id,akcia){
 	 location.href='libs/cars_edit.php?carid='+id+'&action='+akcia;
 };
 
 function podstranka_edit(id){
 	 location.href="index.php?pid="+id;
 };
 
 
  
 tinyMCE.init({
				// General options
		mode : "exact",
		theme : "advanced",
		elements: "elm1, elm2",
		extended_valid_elements :"iframe[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name], div[class|background|background-color|background-image]/[*], img[name,src,id,alt], script[charset|defer|language|src|type]",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
       // plugins : "paste,advimage,advlink,table,fullscreen",
		
		// Theme options
		theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,image,code,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,|,sub,sup,|,charmap,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
		theme_advanced_toolbar_location : "bottom",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Example content CSS (should be your site CSS)
		content_css : "CSS/tinystyle.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		file_browser_callback : "ajaxfilemanager",

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}  
		});

		
		function ajaxfilemanager(field_name, url, type, win) {
						var ajaxfilemanagerurl = "tinymce/jscripts/tiny_mce/plugins/ajaxfilemanager/ajaxfilemanager.php";
						switch (type) {
							case "image":
								break;
							case "media":
								break;
							case "flash": 
								break;
							case "file":
								break;
							default:
								return false;
						}
			            tinyMCE.activeEditor.windowManager.open({
			                url: "tinymce/jscripts/tiny_mce/plugins/ajaxfilemanager/ajaxfilemanager.php",
			                width: 800,
			                height: 440,
			                inline : "yes",
			                close_previous : "no"
			            },{
			                window : win,
			                input : field_name
						});
					}

		
		function insertHTML() {
	    tinyMCE.execInstanceCommand("elm1","mceInsertContent",false,'<iframe width="425" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=sk&amp;geocode=&amp;q=Drie%C5%88ov%C3%A1+34,+Bratislava&amp;sll=37.0625,-95.677068&amp;sspn=60.376022,135.263672&amp;ie=UTF8&amp;hq=&amp;hnear=Drie%C5%88ov%C3%A1+1712%2F34,+82102+Bratislava+-+Ru%C5%BEinov-Ru%C5%BEinov,+Slovakia&amp;ll=48.166257,17.165279&amp;spn=0.020036,0.036478&amp;z=14&amp;iwloc=A&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=Drie%C5%88ov%C3%A1+34,+Bratislava&amp;sll=37.0625,-95.677068&amp;sspn=60.376022,135.263672&amp;ie=UTF8&amp;hq=&amp;hnear=Drie%C5%88ov%C3%A1+1712%2F34,+82102+Bratislava+-+Ru%C5%BEinov-Ru%C5%BEinov,+Slovakia&amp;ll=48.166257,17.165279&amp;spn=0.020036,0.036478&amp;z=14&amp;iwloc=A" target="_blank" style="color:#0000FF;text-align:left">Zobraz veľkú mapu</a></small>');
		}
		
		function insertButton() {
	    tinyMCE.execInstanceCommand("elm1","mceInsertContent",false,'<table border="0"><tbody><tr><td><div class="rbroundbox"><div class="rbtop"><div>&nbsp;</div>&nbsp;</div><div id="rbcontent">TLAČ&Iacute;TKO</div><div class="rbbot"><div>&nbsp;</div>&nbsp;</div></div></td></tr></tbody></table><p></p>');
		}
		
		//onmouseover=\'document.getElementById("'+id+'").src="images/list_style_menu_hover.gif"\' onmouseout=\'document.getElementById("'+id+'").src="images/list_style_clear.gif"\'
		
		function onmover(list_id){
		 if (pid!=list_id) 
		 	{
		 		document.getElementById(list_id).src="images/list_style_menu_hover.gif";
			}
		};
		
		function onmout(list_id){
			 if (pid!=list_id) 
		 	{
		 		document.getElementById(list_id).src="images/list_style_clear.gif";
			}
		};
		
		
		function pridajodkaz() {
		//<li><img id="1" src="images/list_style_menu_hover.gif" alt="" /> aaa</li>
		id = document.getElementById("odkaz").value;
		txt = document.getElementById(id).innerHTML;
		//y = document.getElementById().innerHTML;
		tinyMCE.execInstanceCommand("elm2","mceInsertContent",false, '<table><tr><td width=10><li><a href="'+id+'" onmouseover="onmover(\''+id+'\')" onmouseout="onmout(\''+id+'\')"><img id='+id+' src="images/list_style_clear.gif" /></a></td><td width=130><a href="'+id+'" onmouseover="onmover(\''+id+'\')" onmouseout="onmout(\''+id+'\')">'+txt+'</a></li></td></tr></table>');
		}

	function action(typ,pid,mode) {
		
		switch (mode)
			{
			case "": mode_param="&mode=mainpage";break;
			case 1: mode_param="&mode=mainpage";break;
			case 2: mode_param="&mode=subpage";break;
			};
		
		
		switch (typ)
			{
			case 1: 
				location.href="libs/edit.php?pid="+pid+"&action=back";
				break;
			case 2: 
				location.href="libs/edit.php?pid="+pid+"&action=next";
				break;
			case 3: 
				location.href="libs/edit.php?pid="+pid+"&action=delete"+mode_param;
				break;
			case 4:
				location.href="libs/edit.php?pid="+pid+"&action=new"+mode_param;	
				break;
			case 5:
				location.href="module_admin.php?modulemove=left&pid="+pid+"&moduleid="+mode;
			} 
	}
	
	function modules_action(typ, pid) {
		switch (typ)
		{
			case 4: location.href="index.php?pid=moduly&modulid="+pid;
				break;
		};
	}
	
