function showTime(){
	var time = new Date();
	var day = time.getDate();
	var nday = time.getDay();
	var month = time.getMonth() + 1;
	var year = time.getFullYear();
	var hour = time.getHours();
	var minute = time.getMinutes();
	var second = time.getSeconds();
	var temp = annapaev(nday)+" " + ((day < 10) ? "0" : "") + day;
	temp += ((month < 10) ? ".0" : ".") + month +"."+ year + " ";
	temp += ((hour < 10) ? "0" : "") + hour;
	temp += ((minute < 10) ? ":0" : ":") + minute;
	temp += ((second < 10) ? ":0" : ":") + second;
	try{
		document.forms[1].clock.value = temp;
	}catch(e){}
	id = setTimeout("showTime()",1000);
}
function annapaev(id)
{
	if (id==1){return "Esmaspäev";}	if (id==2){return "Teisipäev";}	if (id==3){return "Kolmapäev";}
	if (id==4){return "Neljapäev";}	if (id==5){return "Reede";}	if (id==6){return "Laupäev";}
	if (id==7){return "Pühapäev";} if (id==0){return "Pühapäev";}
	}
showTime();

function RawSearchControl(Squery){var Squery=Squery;
this.searcherform=document.getElementById("otsin");
this.results=document.getElementById("results");
this.cursor=document.getElementById("cursor");
this.searchform=document.getElementById("searchform");
this.activeSearcher="web";
this.searchers=new Array();
var searcher=new google.search.WebSearch();
searcher.setUserDefinedClassSuffix("siteSearch");
searcher.setSiteRestriction("http://www.hiiumaa.ee");
searcher.setResultSetSize(GSearch.LARGE_RESULTSET);
searcher.setNoHtmlGeneration();
searcher.setSearchCompleteCallback(this,RawSearchControl.prototype.searchComplete,[searcher,Squery]);
this.searchers["web"]=searcher;
searcher=new google.search.LocalSearch();
searcher.setNoHtmlGeneration();
searcher.setCenterPoint("98074");
searcher.setResultSetSize(GSearch.LARGE_RESULTSET);
searcher.setSearchCompleteCallback(this,RawSearchControl.prototype.searchComplete,[searcher,Squery]);
this.searchers[this.activeSearcher].execute(Squery);
};
RawSearchControl.prototype.computeActiveSearcher=function(){this.activeSearcher="web";
return;
};
RawSearchControl.prototype.onSubmit=function(form){this.computeActiveSearcher();
if(form.input.value){this.searchers[this.activeSearcher].execute(form.input.value);
}return false;
};
RawSearchControl.prototype.onClear=function(form){this.clearResults();
};
RawSearchControl.prototype.searchComplete=function(searcher,Squery){this.clearResults();
if(searcher.results&&searcher.results.length>0){for(var i=0;
i<searcher.results.length;
i++){var result=searcher.results[i];
result.title=result.titleNoFormatting;
//result.visibleUrl=result.url;
}for(var i=0;
i<searcher.results.length;
i++){var result=searcher.results[i];
searcher.createResultHtml(result);
if(result.html){div=result.html.cloneNode(true);
}else{div=createDiv("** failure to create html **");
}div.firstChild.innerHTML=div.firstChild.innerHTML;
this.results.appendChild(div);
}

if(searcher.cursor)
{
    var cursorNode=createDiv(null,"gsc-cursor");       

        cursorNode.innerHTML = "<STYLE>.gsc-cursor-box {border-top: #808080 1px solid;}</STYLE><div class=label>Lk:</div>";
        

for(var i=0;
i<searcher.cursor.pages.length;
i++){var className="testclass";
if(i==searcher.cursor.currentPageIndex){className=className+" testclass-current-page";
}var pageNode=createDiv(searcher.cursor.pages[i].label,className);
pageNode.onclick=methodClosure(this,this.gotoPage,[searcher,i],i,Squery);
cursorNode.appendChild(pageNode);
}this.cursor.appendChild(cursorNode);
}}else{document.getElementById('results').innerHTML='No results!';
}};
RawSearchControl.prototype.gotoPage=function(searcher,page){searcher.gotoPage(page);
};
RawSearchControl.prototype.clearResults=function(){removeChildren(this.results);
removeChildren(this.cursor);
};





function removeChildren(parent){while(parent.firstChild){parent.removeChild(parent.firstChild);
}};
function createDiv(opt_text,opt_className){var el=document.createElement("div");
if(opt_text){el.innerHTML=opt_text;
}if(opt_className){el.className=opt_className;
}return el;
};
function methodClosure(object, method, opt_argArray){return function(){return method.apply(object, opt_argArray);
}};
function createLink(href,opt_text,opt_target,opt_className,opt_divwrap){
    var el=document.createElement("a");
    el.href=href;
if(opt_text){el.innerHTML=opt_text;
}if(opt_className){el.className=opt_className;
}if(opt_target){el.target=opt_target;
}if(opt_divwrap){var div=this.createDiv(null,opt_className);
div.appendChild(el);
el=div;
}return el;
}

