function loadjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
 }
 if (typeof fileref!="undefined")
  document.getElementsByTagName("head")[0].appendChild(fileref)
}

/*
loadjscssfile("myscript.js", "js") //dynamically load and add this .js file
loadjscssfile("javascript.php", "js") //dynamically load "javascript.php" as a JavaScript file
loadjscssfile("mystyle.css", "css") ////dynamically load and add this .css file
*/

/* LOAD MORE SCRIPTS */

//loadjscssfile("scripts/jquery.fancybox/jquery.fancybox.css", "css")
function runWizard() {
	loadWindow('','wizard/?TB_iframe=true&height=350&width=500&modal=true');
}

/* MAIN MENU */
$(document).ready(function () {
	if(navigator.appName.toLowerCase() == 'microsoft internet explorer') {
		var cssRule;
		var newSelector;
		for (var i = 0; i < document.styleSheets.length; i++)
			for (var x = 0; x < document.styleSheets[i].rules.length ; x++)
				{
				cssRule = document.styleSheets[i].rules[x];
				if (cssRule.selectorText.indexOf("LI:hover") != -1)
				{
					 newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
					document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
				}
			}
		
		var getElm = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<getElm.length; i++) {
			getElm[i].onmouseover=function() {
				this.className+=" iehover";
			}
			getElm[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" iehover\\b"), "");
			}
		}
	}
});

/* SEARCH */

function clearSearch(myObj) {
	if(myObj.value == $('#searchTrans').val()) {
		myObj.value = ''; 
		myObj.style.color = '#000'; 
		myObj.style.fontStyle = 'normal';
	}
}

function setSearch(myObj) {
	if(myObj.value == '') {
		myObj.value = $('#searchTrans').val();
		myObj.style.color = '#666666';
		myObj.style.fontStyle = 'italic';
	}
}

/* BOOKMARK */

function bookmark() {
	bookmarkurl="http://www.fotoo.hu"
	bookmarktitle="Fotoo.hu - geodézia - fotogrammetria - épületfelmérés -  CAFM"
	if (document.all)
	window.external.AddFavorite(bookmarkurl,bookmarktitle)
	else if (window.sidebar) // firefox
	window.sidebar.addPanel(bookmarktitle, bookmarkurl, "");
}
