// JavaScript Document


function twitlogin() {
	var tlogin = document.getElementById('tlogin').value;
	var tpassword = document.getElementById('tpassword').value;
	var tservice = document.getElementById('tservice').value;
	new Ajax.Updater('tdivinner','twitlogin.php?tlogin='+tlogin+'&tpassword='+tpassword+'&tservice='+tservice+'&l=y', {
  method: 'get'});
alert("login: "+tlogin+" \n pwd: "+tpassword+" \n service= "+tservice+" \n \n Deze data wordt in een tijdelijke sessie opgeslagen en automatisch verwijderd wanneer je je browser compleet afsluit. \n \n NB: als je een typefout hebt gemaakt moet je de hele pagina verversen en je gegevens opnieuw invoeren. Ook als je wilt wisselen tussen Jaiku en Twitter...");
}

function twitpost() {
	document.getElementById('tmessage').disabled=true;
	document.getElementById('twitpostimg').innerHTML = '<img src=\'./images/twitpost-posting.gif\' height=\'15\' width=\'100\' border=\'0\' hspace=\'10\'>'; 
	var tmessage = escape((document.getElementById('tmessage').value));
	new Ajax.Updater('tdivinner','twitpost.php?tmessage='+tmessage+'', {
  method: 'get'});
  	 //alert("you just gave me text: "+tmessage+"    !");

  } // end twitpost
  
function updatetwitloc() {

new Effect.Appear('tdiv', {duration:1, fps:25, from:0.0, to:1.0});
new Ajax.Updater('tdivinner','twitupdateloc.php', {
method: 'get'});

}

function twitupdatesettings() {
	document.getElementById('twitpostimg').innerHTML = '<img src=\'./images/twitpost-posting.gif\' height=\'15\' width=\'100\' border=\'0\' hspace=\'10\'>'; 
	var tlogin = escape((document.getElementById('tlogin').value));
	var tpassword = escape((document.getElementById('tpassword').value));
//	var tlocname = escape((document.getElementById('tlocname').value));		

new Ajax.Updater('tdivinner','twitupdatesettings.php?tlogin='+tlogin+'&tpassword='+tpassword+'', {
method: 'get'});

}

function twitinlogscreen() {
new Effect.Appear('tdiv', {duration:1, fps:25, from:0.0, to:1.0});
new Ajax.Updater('tdivinner','twitloginscreen.php', {
method: 'get'});
}

     //<![CDATA[
   var myStartEffect = function(element) {
     element._opacity = Element.getOpacity(element);
     new Effect.Opacity(element, {duration:0.0, from:element._opacity, to:0.7});
   }
   //]]>

  function changeLoginText1(){
  document.getElementById('twltwu').innerHTML = 'twitter-username'; 
  document.getElementById('twltwp').innerHTML = 'twitter-password';
  document.getElementById('servicelogo').innerHTML = '<img src="images/twitdiv-twitlogo.gif" width="67" height="34" />';
  }
  
  function changeLoginText2(){
  document.getElementById('twltwu').innerHTML = 'jaiku-username'; 
  document.getElementById('twltwp').innerHTML = 'jaiku-<a href=\'http://api.jaiku.com\' target=\'_blank\'>api-key</a>';
  document.getElementById('servicelogo').innerHTML = '<img src="images/twit-jaikulogo.gif" width="40" height="34" />';
  }
  
  function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		document.getElementById('tcountdown').innerHTML = limitNum - limitField.value.length;
	}
}

///channels here
function chGeluid() {
document.getElementById('channel').innerHTML = '<iframe align=center src=channel-geluid.php frameBorder=0 width=100% scrolling=no height=100% name=channelbox></iframe>';
}
  
  function chWeerstation() {
document.getElementById('channel').innerHTML = '<iframe align=center src=channel-weerstation.php frameBorder=0 width=100% scrolling=no height=100% name=channelbox></iframe>';
}

  function chFlickr() {
document.getElementById('channel').innerHTML = '<iframe align=center src=channel-flickr.php frameBorder=0 width=100% scrolling=no height=100% name=channelbox></iframe>';
}

  function chBuienradar() {
document.getElementById('channel').innerHTML = '<iframe align=center src=channel-buienradar.php frameBorder=0 width=100% scrolling=no height=100% name=channelbox></iframe>';
}

  function chKyte() {
document.getElementById('channel').innerHTML = '<iframe align=center src=channel-kyte.php frameBorder=0 width=100% scrolling=no height=100% name=channelbox></iframe>';
}

function ch3voor12() {
document.getElementById('channel').innerHTML = '<iframe align=center src=channel-3voor12.php frameBorder=0 width=100% scrolling=no height=100% name=channelbox></iframe>';
}
 
 function ch3FM() {
document.getElementById('channel').innerHTML = '<iframe align=center src=channel-3FM.php frameBorder=0 width=100% scrolling=no height=100% name=channelbox></iframe>';
}

////about function

function togAbout() {
Effect.toggle('about','appear'); return false;
}


///tabbed pane voor about

function synchTab(frameName) {

  var elList, i;

  // Exit if no frame name was given.

  if (frameName == null)
    return;

  // Check all links.

  elList = document.getElementsByTagName("A");
  for (i = 0; i < elList.length; i++)

    // Check if the link's target matches the frame being loaded.

    if (elList[i].target == frameName) {

      // If the link's URL matches the page being loaded, activate it.
      // Otherwise, make sure the tab is deactivated.

      if (elList[i].href == window.frames[frameName].location.href) {
        elList[i].className += " activeTab";
        elList[i].blur();
      }
      else
        removeName(elList[i], "activeTab");
    }
}

function removeName(el, name) {

  var i, curList, newList;

  if (el.className == null)
    return;

  // Remove the given class name from the element's className property.

  newList = new Array();
  curList = el.className.split(" ");
  for (i = 0; i < curList.length; i++)
    if (curList[i] != name)
      newList.push(curList[i]);
  el.className = newList.join(" ");
}

 function Venster(URL) {
    venster = window.open(URL, 'popupvenster', 'width=320, height=380, resizable=no, menubar=no, scrollbars=no, status=no, toolbar=no');
    }