myhref = document.location.href;
maxmediaid  = -1;
search  = null;
imgname = null; imgwidth = null;  imgheight = null;
nrcomments = -1;


var searchDivs       = new Array();
var searchDivsNames  = new Array();
var searchWindow = null;


//Hide status bar msg II script- by javascriptkit.com
//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use



if (document.layers)document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)



document.onmouseover=hidestatus
document.onmouseout=hidestatus
document.onmousedown=hidestatus
document.onmouseup=hidestatus
document.onmouseclick=hidestatus





function hidestatus(){
window.status='Digital Advertising'
return true
}






function pushimages() {

      for (var i=0; i<document.images.length; i++) {
        if (!document.images[i].complete) {
            document.images[i].src = document.images[i].src;
        }
      }

}

function loadmedia(categorie,order,chunk){
		document.location.href= "http://www.digital-advertising.ro/video/index.php?CATEGORIE="+categorie+"&ORDER="+order+"&CHUNK="+chunk; 
		
}


function loadmediacategorie(categorie,order){
   document.location.href="http://www.digital-advertising.ro/video/index.php?CATEGORIE="+categorie+"&ORDER="+order;
}


function continuemediasearch(search, order,chunk){
   document.location.href="http://www.digital-advertising.ro/video/index.php?SEARCH="+search+"&ORDER="+order+"&CHUNK="+chunk;
}




function loadtagsearch(tag){  
			   wstring = "!"+tag+"!";
			   lsearch = "( descriere like '"+wstring+"'";
               lsearch+=" or special1 like '"+wstring+"') ";			 
               //document.location.href="http://www.digital-advertising.ro/index.php?SEARCH="+escape(lsearch);
			   document.location.href="http://www.digital-advertising.ro/video/index.php?SEARCH="+escape(lsearch);
}



function loadmediasearch(){  
   if( trim(document.getElementById("xsearch").value) == ""){
      alert("nu ati introdus cuvint de cautare");
   }
   else{
	      if ( document.getElementById("descriere").checked || document.getElementById("tags").checked){
			   wstring = escape("!")+document.getElementById("xsearch").value+escape("!");
			   if(document.getElementById("descriere").checked){
                  lsearch = "( descriere like '"+wstring+"'";
			   }
			   else {
				  lsearch = "( 1!=1";
			   }
			   if(document.getElementById("tags").checked){
                  lsearch+=" or special1 like '"+wstring+"')";
			   }			  
               document.location.href="http://www.digital-advertising.ro/video/index.php?SEARCH="+escape(lsearch);
			  
	      }
		  else{
			  alert("bifaţi cel puţin o locatie de cautare !");
		  }	      
   }
}


function markOrder(curent){
	if (orderparam==curent){
		document.write("<img src='../images/ok.jpg'>");
	}
	else{
        document.write("<img src='../images/ok_estompat.jpg'>");
	}

}


function doRating(id,rate){
if( id != -1){

	if(rate == -1){ alert("selecteaza o nota, te rog..."); }
	else{		
		ratetarget.document.location.href = "http://www.digital-advertising.ro/_markrate.php?id="+id+"&rate="+rate;
		alert("mulţumesc pentru interes !");
		//location.reload();
	}
}
else { alert("această categorie nu are informaţii !");}
}


function showhidecomentariu(what){
	if(maxmediaid > 0){
	   if(what=='show'){
		  document.getElementById("comentarii_content").style.display="block";
	   }
	   else{
		  if(what == 'hide'){
			document.getElementById("comentarii_content").style.display="none";
		  }
	   }
	}
	else{
		alert("această categorie nu are informaţii !");
	}
}

function showhidesearch(what){
	   if(what=='show'){
		  document.getElementById("search_content").style.display="block";
	   }
	   else{
		  if(what == 'hide'){
			document.getElementById("search_content").style.display="none";
		  }
	   }
}


function showhidefeatured(what){
	   if(what=='show'){
		  document.getElementById("infasurator_comments").style.display="block";
	   }
	   else{
		  if(what == 'hide'){
			document.getElementById("infasurator_comments").style.display="none";
		  }
	   }
}



function showmedia(id,order){
	document.location.href="http://www.digital-advertising.ro/video/show.php?MEDIAID="+id+"&ORDER="+order;

}

function sendcomentariu(id){
   xnume  = document.getElementById("nume").value;
   xmesaj = document.getElementById("mesaj").value;
   if ( trim(xnume) != "" && trim(xmesaj) != "" ){
		//xcomentariu.document.location.href = "http://www.digital-advertising.ro/_comentariu.php?ID="+id+"&NUME="+escape(xnume)+"&MESAJ="+escape(xmesaj);
		document.xform.submit();
   }
   else{
        alert("Completează numele şi comentariul te rog...");
   }
}



function emailimagine(id){
   if(id != -1){
       work = "http://www.digital-advertising.ro/emailecard.php?id="+id;     
       window.open(work,'email', config='height=650,width=800, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no')
   }
   else{
	   alert("această categorie nu are informaţii !");
   }
}



function doYahoo(){
   document.location.href="ymsgr:im?+&msg="+myhref.replace("&","%2526");
}


function init(){
    pushimages();
	if(nrcomments <= 0){
		//showhidecomentariu('show');
	}
}



function hideSearch(){
	for(i=0; i<searchDivs.length; i++){
		//work = "document.getElementById('"+searchDivs[i]+"').style.display='none'";
		//eval(work);
		document.getElementById(searchDivs[i]).style.display='none';
	}
}


function showSearch(number){
	hideSearch();
	//work = "document.getElementById('"+searchDivs[number]+"').style.display='block'";
	//eval(work);
	document.getElementById(searchDivs[number]).style.display='block';
}

function spreadvalues(object, n){
	for(i=0; i<searchDivs.length; i++){
		if(i != n){
			work = "document.getElementById('"+searchDivs[i]+"_input').value = object.value";
			eval(work);
		}
	}

}


function goforit(hrefexpr, order){
	
	mysvalue = eval("document.getElementById('"+searchDivs[order]+"_input').value");
	if(mysvalue != '')
	{
	hrefexpr = hrefexpr.replace(/bobolot/, mysvalue);
	(window.open(hrefexpr,"")).focus();
	//searchWindow.focus();
	/*
	if(searchWindow)searchWindow.close();
	
	   searchWindow = window.open(hrefexpr,"mzsearch");
	   searchWindow.moveTo(0,0);
	   if (document.all){
          top.searchWindow.resizeTo(screen.availWidth,screen.availHeight);
       }
       else if (document.layers||document.getElementById)
       {
          if (top.searchWindow.outerHeight<screen.availHeight||top.searchWindow.outerWidth<screen.availWidth){
             top.searchWindow.outerHeight = screen.availHeight;
             top.searchWindow.outerWidth  = screen.availWidth;
          }
       }
	searchWindow.focus();	
	*/
	}
	else{
		alert("completeaza campul de cautare...");
	}
	
}


