
function OpenCloseEn(){
enDiv=document.getElementById('enDiv').style.display;
if(enDiv=='none'){document.getElementById('enDiv').style.display='inherit';}
if(enDiv=='inherit'){document.getElementById('enDiv').style.display='none';}
}


function bookmark_us(url, title){

if (window.sidebar) // firefox
    window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
    var elem = document.createElement('a');
    elem.setAttribute('href',url);
    elem.setAttribute('title',title);
    elem.setAttribute('rel','sidebar');
    elem.click();
}
else if(document.all)// ie
    window.external.AddFavorite(url, title);
}


function opensubmenu(){
	document.getElementById('submenu').style.visibility='visible';
		document.getElementById('category').style.color='#333333';

}
function closesubmenu(){
	document.getElementById('submenu').style.visibility='hidden';
			document.getElementById('category').style.color='#FF4C00';

}

function navigateImg(img, thumb){
document.getElementById('imgLarge').src=thumb;
	
}

function openHelp(t){
document.getElementById("light").style.display='inherit';
document.getElementById("fade").style.display='inherit';
document.getElementById("light").style.width='700px';
document.getElementById("light").style.left='10%';
if (t=='price'){
document.getElementById("light").innerHTML = "<div style=\'height:268; \'><img src=\'helpPrice.png\' align=\'right\' style=\'padding-top:45px;\'/><h4>Ценовник</h4><p>Цената претставува важен дел од туристичката понуда. Во делот за цена можете да им објаснете на крајните потрошувачи колку се вкупните трошоци, дали постои начин на одложено плаќање и слично.</p><a style=\"position:absolute; top:25px; right:15px\" href =\"javascript:void(0)\" onclick=\"document.getElementById(\'light\').style.display=\'none\', document.getElementById(\'fade\').style.display=\'none\',  document.getElementById(\'light\').style.width=\'400px\', document.getElementById(\'light\').style.left=\'25%\'\" ><img src=\"close.png\" alt=\"Close\" width=\"12\" height=\"12\" border=\"0\" style=\"z-index:115;padding:0px;margin:0px;border:none\"  /></a></div>";
}
if (t=='text'){
document.getElementById("light").innerHTML = "<div style=\'height:268; \'><img src=\'helpText.png\' align=\'right\' style=\'padding-top:45px;\'/><h4>Опис</h4><p>Описот на понудата може да се однесува на се за што вие сметате дека клиентите се посебно заинтересирни.</p><p>Описот е важен бидејки фразите кои ќе ги употребите ќе се најдат на пребарувачот, и според нив ќе се рангираат резултатите на пребарувањата.</p><a style=\"position:absolute; top:25px; right:15px\" href =\"javascript:void(0)\" onclick=\"document.getElementById(\'light\').style.display=\'none\', document.getElementById(\'fade\').style.display=\'none\',  document.getElementById(\'light\').style.width=\'400px\', document.getElementById(\'light\').style.left=\'25%\'\" ><img src=\"close.png\" alt=\"Close\" width=\"12\" height=\"12\" border=\"0\" style=\"z-index:115;padding:0px;margin:0px;border:none\"  /></a></div>";
}
}



function showlogin(){
document.getElementById("light").style.display='inherit';
document.getElementById("fade").style.display='inherit';
document.getElementById("light").innerHTML = "<h4>Логирај се</h4><form action=\"login.php\" method=\"post\" enctype=\"multipart/form-data\" name=\"loginForm\" id=\"loginForm\"><p><label for=\"email\">Емаил</label><input name=\"email\"  id=\"email\" type=\"text\" size=\"30\" maxlength=\"30\"/></p><p><label for=\"email\">Лозинка</label><input name=\"pwd\"  id=\"pwd\" type=\"password\" size=\"30\" maxlength=\"30\"/></p><p><input name=\"submitL\"  id=\"submitL\" type=\"submit\" style=\"margin-left:120px\" value=\"Логирај\" /></p></form><a style=\"position:absolute; top:25px; right:15px\" href =\"javascript:void(0)\" onclick=\"document.getElementById(\'light\').style.display=\'none\', document.getElementById(\'fade\').style.display=\'none\'\" ><img src=\"close.png\" alt=\"Close\" width=\"12\" height=\"12\" border=\"0\" style=\"padding:0px;margin:0px;border:none\"  /></a><p><a href=\"javascript:void(0)\" onclick=\"document.getElementById(\'forgotP\').style.display=\'inherit\'\">Ја заборавив лозинката</a></p><div id=\"forgotP\" style=\"border-top:1px solid #dddddd;display:none;\"><form action=\"login.php?ref=3\" method=\"post\" enctype=\"multipart/form-data\" name=\"loginFormF\" id=\"loginFormF\"><p>Откако ќе претиснете испрати на вашата емаил адреса ќе биде испратена нова шифра.</p><p><label for=\"emailF\">Емаил</label><input name=\"emailF\"  id=\"emailF\" type=\"text\" size=\"30\" maxlength=\"30\"/></p><p><input name=\"submitLF\"  id=\"submitLF\" type=\"submit\" style=\"margin-left:120px\" value=\"Испрати\" /></p></form></div>";

}


function inputShadow(e){
var targ
if (!e) var e = window.event
if (e.target) targ = e.target
else if (e.srcElement) targ = e.srcElement
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode
var tname
tname=targ.tagName
if(tname=="IMG"){
var target=e?e.target:event.srcElement;
target.style.border="2px solid #666666";

}
else {
document.getElementsByTagName("INPUT").style.border="1px solid #999999";
}
}


var xmlhttpE;

function showResultNewComment(htype, ad, text)
{


xmlhttpE=GetXmlHttpObject()
if (xmlhttpE==null)
  {
  alert ("Your browser does not support XML HTTP Request");
  return;
  }
var url="liveother.php";
url=url+"?htype="+htype+"&ad="+ad+"&text="+text;
url=url+"&sid="+Math.random();
if(htype=="comment" || htype=="commentU" || htype=="commentDel"){
xmlhttpE.onreadystatechange=stateChangedNewComment ;
}
if(htype=="f"){
xmlhttpE.onreadystatechange=stateChangedNewCommentF ;
}
if(htype=='research'){
xmlhttpE.onreadystatechange=stateChangedNewCommentR ;
}
 xmlhttpE.open("GET",url,true);
 xmlhttpE.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xmlhttpE.send(null);
}

function stateChangedNewComment()
{
if (xmlhttpE.readyState==4)
  {
  previous=document.getElementById("newCommentsBox").innerHTML;
  document.getElementById("newCommentsBox").innerHTML=previous+xmlhttpE.responseText;
  document.getElementById('loadNC').style.visibility='hidden';
  document.getElementById('csubmit').style.display='inherit';

  nc=document.getElementById("newcomment");
  nc.value='Напиши коментар';
  nc.style.color='#666666';
  document.getElementById("scomment").style.display="none";
  document.getElementById("newcomment").rows=2;
  }
}
function stateChangedNewCommentF()
{
if (xmlhttpE.readyState==4)
  {

	 
document.getElementById("messageBox").style.display='inherit';
  document.getElementById("messageBox").innerHTML=xmlhttpE.responseText;
  document.getElementById('loadFav0').style.visibility='hidden';

  }
}

function stateChangedNewCommentR()
{
if (xmlhttpE.readyState==4)
  {


	  document.getElementById("divResearch").innerHTML=xmlhttpE.responseText;

  }
}



function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

function limitText(limitField, limitCount, limitNum) {
if (limitField=='newcomment'){
limitField=document.getElementById('newcomment');	
}
if (limitField==''){
limitField=document.getElementById('');	
}
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {

		limitCount.value = limitNum - limitField.value.length;

	}
}
function newrow(value,e){

var browser=navigator.appCodeName;

unicode=e.keyCode;


vn=value.length/50;
var strTot = document.getElementById("newcomment").value.split("\n").length;
document.getElementById("newcomment").rows=strTot + vn +1;

}

function newrow1(value,e){
unicode=e.keyCode;	

if(unicode!=8){
for(i=0;i<1000;i++){
	if(i>5){
		
if (value.length==i){

document.getElementById("newcomment").value=value+"\n";
}}
i=i+49;
}	
}
}

function hideDiv(e){
		var browser=navigator.appName;

	if(browser=='Microsoft Internet Explorer'){
		if(document.getElementById("scomment")!=null){
		document.getElementById("scomment").style.display="inherit";
		}
	return;	
	}
var div=document.getElementById('sugboxdiv');
var target=e?e.target:event.srcElement;


if (target==document.getElementById('search')){
	if(document.getElementById('search').value!=""){
	document.getElementById('sugboxdiv').style.visibility='visible';
}}

if (target.parentNode!=document.getElementById('submenu') && target!=document.getElementById('submenu') && target!=document.getElementById('category')){
	document.getElementById('submenu').style.visibility='hidden';
}

if (target==document.getElementById('newcomment')){
	focuscom('focus');

}
if (target!=document.getElementById('newcomment') && target!=document.getElementById('newcomtable') && target!=document.getElementById('scomment') ){
	focuscom('blur');
}
}



function focuscom(f){
nc=document.getElementById("newcomment");

if (f=='focus'){
if(nc.value=='Напиши коментар'){
nc.value='';
nc.style.color='#000000';
document.getElementById("scomment").style.display="inherit";
}}

if (f=="blur"){
if(nc.value==''){
nc.value='Напиши коментар';
nc.style.color='#666666';
document.getElementById("scomment").style.display="none";
}}
}
function focuscomW(f,res){
nc=document.getElementById("newcomment"+res);
if (f=="focus"){
if(nc.value=='Напиши коментар'){
nc.value='';
nc.style.color='#000000';
document.getElementById("scomment"+res).style.display="inherit";
}}

if (f=="blur"){
if(nc.value==''){
nc.value='Напиши коментар';
nc.style.color='#666666';
document.getElementById("scomment"+res).style.display="none";
}}
}
document.onclick=hideDiv;
