//--- javascript file tharros_main_v3.js for www.tharros.info ---

//--- ad the following line to the page
//--- <script type="text/javascript" src="js2/tharros_main.js"></script>
//--- date: 08 november 2010
//--- author if not indicated otherwise: T. Kriek 
//--- The tharros_main_v3 javascript file contains the main script used on all pages

//--- functions for counter software ---
function dbcounter(){
var mydate=new Date();
var nNoCache = mydate.getTime();
document.write('<img src="Enterref.php?nc='+nNoCache+'&np='+navigator.platform+'&na='+navigator.appName+'&wl='+window.location+'&ur='+document.referrer+'" style="visibility: hidden; height: 0">');
}

function forumcounter(){
var mydate=new Date();
var nNoCache = mydate.getTime();
document.write('<img src="Enterref3.php?nc='+nNoCache+'&np='+navigator.platform+'&na='+navigator.appName+'&wl='+window.location+'&ur='+document.referrer+'" style="visibility: hidden; height: 0">');
}

function showstats(strId, strLng){ 
var mydate=new Date();
var nNoCache = mydate.getTime();
document.write('<img src="http://www.motya.info/Enterref.php?nc='+nNoCache+'&np='+navigator.platform+'&na='+navigator.appName+'&wl='+window.location+'&ur='+document.referrer+'" style="visibility: hidden; height: 0">');
document.write('<script src="http://www.motya.info/DbDspCounter.php?id='+strId+'&lng='+strLng+'"><\/script>');
}

function showstats2(strId, strLng){ 
var mydate=new Date();
var nNoCache = mydate.getTime();
document.write('<img src="http://www.motya.info/Enterref3.php?nc='+nNoCache+'&np='+navigator.platform+'&na='+navigator.appName+'&wl='+window.location+'&ur='+document.referrer+'" style="visibility: hidden; height: 0">');
document.write('<script src="http://www.motya.info/DbDspCounter.php?id='+strId+'&lng='+strLng+'"><\/script>');
}


/***********************************************
* Dolphin Tabs Menu- by JavaScript Kit (www.javascriptkit.com)
* This notice must stay intact for usage
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more
***********************************************/

var dolphintabs={
	subcontainers:[], last_accessed_tab:null,

	revealsubmenu:function(curtabref){
	this.hideallsubs()
	if (this.last_accessed_tab!=null)
		this.last_accessed_tab.className=""
	if (curtabref.getAttribute("rel")) //If there's a sub menu defined for this tab item, show it
	document.getElementById(curtabref.getAttribute("rel")).style.display="block"
	curtabref.className="current"
	this.last_accessed_tab=curtabref
	},

	hideallsubs:function(){
	for (var i=0; i<this.subcontainers.length; i++)
		document.getElementById(this.subcontainers[i]).style.display="none"
	},


	init:function(menuId, selectedIndex){
	var tabItems=document.getElementById(menuId).getElementsByTagName("a")
		for (var i=0; i<tabItems.length; i++){
			if (tabItems[i].getAttribute("rel"))
				this.subcontainers[this.subcontainers.length]=tabItems[i].getAttribute("rel") //store id of submenu div of tab menu item
			if (i==selectedIndex){ //if this tab item should be selected by default
				tabItems[i].className="current"
				this.revealsubmenu(tabItems[i])
			}
		tabItems[i].onmouseover=function(){
		dolphintabs.revealsubmenu(this)
		}
		} //END FOR LOOP
	}

}

//--- function ShowDate(lng): show date on page ---

function ShowDate(lng){
/*Current date script credit: 
JavaScript Kit (www.javascriptkit.com)
Over 200+ free scripts here!
adapted by T. Kriek for more languages
*/
var mydate=new Date()
var year=mydate.getYear()
if (year<1000){
year+=1900}
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10){
daym="0"+daym}
if (lng=="nl"){
var dayarray=new Array("zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag")
var montharray=new Array("januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december")}
else if (lng=="it"){
var dayarray=new Array("domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato")
var montharray=new Array("gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre")}
else {
var dayarray=new Array("sunday","monday","tuesday","wednesday","thursday","friday","saturday")
var montharray=new Array("january","february","march","april","may","june","july","august","september","october","november","december")}
document.write( dayarray[day]+", "+daym+" "+montharray[month]+", "+year+"&nbsp;" )
}

//--- function AddVote(lng): add Vote widget ---

function AddVote( lng ){
var txt1,txt2,txt3,txt4
if (lng=='nl') {
txt1 = "Beoordeel deze site!";
txt2 = "Goed!" ;
txt3 = "Neutraal" ;
txt4 = "Kan beter" ;
}
else if (lng=='it'){
txt1 = "Il tuo giudizio!";
txt2 = "Buono!" ;
txt3 = "No comment" ;
txt4 = "Potrebbe meglio" ;
}
else {
txt1 = "&nbsp;Judge this site!&nbsp;";
txt2 = "Good!" ;
txt3 = "Neutral" ;
txt4 = "Could be better" ;
};
document.writeln(' <center><table><tr><td><a href="ShowVote.php?lng='+lng+'" class="copyright">'+txt1+'<\/a><\/td><\/tr> ');
document.writeln(' <tr><td class="hlred"><div id="foottxt">&nbsp;<\/div><\/td><\/tr> ');
document.writeln(' <tr><td class="mc"><table><tr> ');
document.writeln(' <td><a href="AddVote.php?id=3&lng='+lng+'" target="_self"> ');
document.writeln(' <img src="images/main/icon_smile.gif" width="15" title="'+txt2+'" alt="'+txt2+'" onmouseover="writefoottxt('+"'"+txt2+"'"+')" onmouseout="writefoottxt('+"'&nbsp;'"+')"><\/a><\/td> ');
document.writeln(' <td><a href="AddVote.php?id=2&lng='+lng+'" target="_self"> ');
document.writeln(' <img src="images/main/icon_neutral.gif" width="15" title="'+txt3+'" alt="'+txt3+'" onmouseover="writefoottxt('+"'"+txt3+"'"+')" onmouseout="writefoottxt('+"'&nbsp;'"+')"><\/a><\/td> ');
document.writeln(' <td><a href="AddVote.php?id=1&lng='+lng+'" target="_self"> ');
document.writeln(' <img src="images/main/icon_sad.gif" width="15" title="'+txt4+'" alt="'+txt4+'" onmouseover="writefoottxt('+"'"+txt4+"'"+')" onmouseout="writefoottxt('+"'&nbsp;'"+')"><\/a><\/td> ');
document.writeln(' </tr><\/table><\/td><\/tr><\/table><\/center> ');
}

//--- function writefoottxt(html): change text in foottextline ---

function writefoottxt(html){
        if (document.getElementById){
        document.getElementById("foottxt").innerHTML=html}
        else{
        foottxt.innerHTML=html}
      }

//--- function clk(id): count clicks on external url's ---
	  
	clk = function(a){
	var mydate=new Date();
	var nNoCache = mydate.getTime();
	if (document.images){
		(new Image).src = "CntExtClicks.php?nc="+nNoCache+"&id="+a ;
	}
	return true;}
	
//--- function clks(id): count clicks on external url's ---
	  
	clks = function(a){
	var mydate=new Date();
	var nNoCache = mydate.getTime();
	if (document.images){
		(new Image).src = "CntSrvClicks.php?nc="+nNoCache+"&id="+a ;
	}
	return true;}

//--- function movePointer: move a pointer around
function movePointer(xCoord, yCoord, strEl) {
   var w3c=(document.getElementById)?true:false;
   var ns4=(document.layers)?true:false;
   var ie4=(document.all && !w3c)?true:false;

   thisEl=(ns4)?document.layers[strEl]:(ie4)?document.all[strEl]:document.getElementById(strEl);
   if (document.getElementById){
      document.getElementById(strEl).style.top=xCoord;
	  document.getElementById(strEl).style.left=yCoord}
   else{
      thisEl.style.top=xCoord;
	  thisEl.style.left=yCoord}
   }

//--- function movein(html): change image in menubox ---

function movein(html, strEl){
   var w3c=(document.getElementById)?true:false;
   var ns4=(document.layers)?true:false;
   var ie4=(document.all && !w3c)?true:false;

   thisEl=(ns4)?document.layers[strEl]:(ie4)?document.all[strEl]:document.getElementById(strEl);
      if (document.getElementById){
   	     document.getElementById(strEl).innerHTML=html}
      else{
         thisEl.innerHTML=html}
      }

//--- loadImages() used for the image while loading the page
//--- Original:  Gilbert Davis 
//--- This script and many more are available free online at
//--- The JavaScript Source!! http://javascript.internet.com

function loadImages() {
   if (document.getElementById) {  // DOM3 = IE5, NS6
      document.getElementById('hidepage').style.visibility = 'hidden';
   }	
   else {
      if (document.layers) {  // Netscape 4
         document.hidepage.visibility = 'hidden';
      }
      else {  // IE 4
         document.all.hidepage.style.visibility = 'hidden';
      }
   }
} 

//--- function recommended(nRecs,divId,lshowLink, strText1, strText2): show recommendations and link to add a recommendation ---

function recommended(nRecs,nId,lshowLink, strText1, strText2, strType){ 
	var divId = "serv"+nId ;
	var w3c=(document.getElementById)?true:false;
   	var ns4=(document.layers)?true:false;
   	var ie4=(document.all && !w3c)?true:false; 
	var html = '' ;
	thisEl=(ns4)?document.layers[divId]:(ie4)?document.all[divId]:document.getElementById(divId); 
	if(nRecs > 10){
		strImage = "thumbrup.png" ;
	}else{
		strImage = "thumbsup.png" ;
	}
	html += '<img src="images/main/'+strImage+'" style="width: 14px;height: 14px" alt="ok">&nbsp;';
   	if(nRecs > 0){
		html += (nRecs)+' '+strText1+'&nbsp;&nbsp;'  ;
	}
	if(lshowLink == 1){
		html += '<a href="javascript:recommend('+nRecs+','+"'"+nId+"','"+strText1+"','"+strText2+"','"+strType+"')"+'" class="forumlink">'
		html += strText2 ;
		html += '</a>' ;
	} 
	if (document.getElementById){
    	document.getElementById(divId).innerHTML = html;
	}else{
    	thisEl.innerHTML = html;
	}
} 

//--- function recommend(nRecs,divId,strText1, strText2): count recommendations ---
	  
	recommend = function(nRecs,nId,strText1, strText2, strType){
	var mydate=new Date();
	var nNoCache = mydate.getTime();
	if (document.images){
		(new Image).src = "CntRecClicks.php?nc="+nNoCache+"&type="+strType+"&id="+nId ; //"CntExtClicks.php?nc="+nNoCache+"&id="+a ;
		nRecs += 1 ;
		recommended(nRecs,nId,0, strText1, strText2, strType);
	}
	//return ;
}

//--- function clearText(field) clears the input default value ---

function clearText(field){

    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;

}

