/**
* Collection of javascripts
*
* @author Frank Fischli <frank.fischli@web-ix.ch>
* @copyright Copyright 2006, Frank Fischli
* @version 1.00, 02.08.2006
*/

/**
* Function to create a confirm box 
*/
function confirmBox(url_yes,url_no,question) {
   var name=confirm(question)
   if (name==true) {
      window.location=url_yes;
      }
   else {
      window.location=url_no;
      }
   }


/**
* Function to create a promt box 
*/
function promptBox(url_yes,url_no,question) {
   var name=prompt(question);
   if (name!=null && name!="") {
      window.location=url_yes+"&name="+name;
      }
   }


/**
* Function display E-Mail adresses
*/
function mail(n,d) {
   var nam = n;
   var domai = d;
   document.write('<a href="mailto:' + nam + '@' + domai + '">');
   document.write(nam + '@' + domai + '</a>');
   }


/**
* Function display E-Mail adresses in section
*/
function mailSection4(nurl,durl,nname,dname) {
   var nameurl = nurl;
   var domainurl = durl;
   var namename = nname;
   var domainname = dname;
   document.write('<a href="' + nameurl + '@' + domainurl + '">');
   document.write(namename + '@' + domainname + '</a>');
   }

function mailSection3(nurl,durl,nname) {
   var nameurl = nurl;
   var domainurl = durl;
   var namename = nname;
   document.write('<a href="' + nameurl + '@' + domainurl + '">');
   document.write(namename + '</a>');
   }





/**
* CHECK ALL CHECKBOXES IN A FORM
*/
function checkAll() {
   num = document.forms[0].length; 
   for (i = 0; i < (num-1); i++) {
      document.forms[0][i].checked = true;
      }
   }


/**
* UNCHECK ALL CHECKBOXES IN A FORM
*/
function uncheckAll() {
   num = document.forms[0].length; 
   for (i = 0; i < (num-1); i++) {
      document.forms[0][i].checked = false;
      }
   }




/**
* SHOW MESSAGE BOX
*/
function showMessageBox () {
   visible = document.getElementById('mb');
   visible.style.display = "inline";
   }

/**
* HIDE MESSAGE BOX
*/
function hideMessageBox () {
   visible = document.getElementById('mb');
   visible.style.display = "none";
   }

/**
* SHOW MANAGEMENT SMART LOGIN
*/
function showSmartLogin (id) {
   visible = document.getElementById(id);
   visible.style.display = "inline";
   }



/**
* SHOW LINK ACTIONS
*/
function showLinkActions (id) {
   display = document.getElementById("la"+id);
   if (display.style.display == "inline")
   	display.style.display = "none";
	else
   	display.style.display = "inline";
   }


/**
* HIDE LINK ACTIONS
*/
function hideLinkActions (id) {
   display = document.getElementById("la"+id);
   display.style.display = "none";
   }


/**
* CLOSE ANNOUNCEMENT WINDOW
*/
function closeAnnouncements () {
   display = document.getElementById("announcements");
   display.style.display = "none";
   }

/**
* OPEN QUICK HELP
*/
function openQuickHelp () {
   display = document.getElementById("quickHelp");
   display.style.display = "inline";
   }

/**
* CLOSE QUICK HELP
*/
function closeQuickHelp () {
   display = document.getElementById("quickHelp");
   display.style.display = "none";
   }


/**
* SHOW SECTION ACTIONS
*/
function showSectionActions (id) {
   display = document.getElementById("sa"+id);
   if (display.style.display == "inline")
   	display.style.display = "none";
	else
   	display.style.display = "inline";	
   }


/**
* SHOW USER SETTINGS
*/
function showUserSettings () {
   display = document.getElementById("userSettings");
   if (display.style.display == "inline")
   	display.style.display = "none";
	else
   	display.style.display = "inline";	
   }

/**
* SHOW LINK ACTIONS
*/
function showLinkDialog () {
   display = document.getElementById('linkDialog');
   if (display.style.display == "inline")
   	display.style.display = "none";
	else
   	display.style.display = "inline";	
   }

/**
* SHOW RECOMMENDATION DIALOG
*/
function recommendationDialog () {
   display = document.getElementById('recommendationDialog');
   if (display.style.display == "inline")
   	display.style.display = "none";
	else
   	display.style.display = "inline";	
   }


/**
* HIGHLIGHT FOOTER BUTTON
*/
function highlightButton (id, newSrc) {
   button = document.getElementById(id);
   button.src=newSrc;
   }

/**
* HIDE FOOTER BUTTON
*/
function hideButton (id, newSrc) {
   button = document.getElementById(id);
   button.src=newSrc;
   }







/**
* CHANGE ACTION OF A LINK FORM
*/
function changeFormAction (id) {
   /** Get handles */
   formHandle = document.getElementById("urlInputForm"+id);
   inputHandle = document.getElementById("urlInput"+id);
   url = inputHandle.value;

   /** Prepare URL */
   if (url.substring(0, 4) != 'http')
      url = 'http://'+url;

   /** Change form action */
   formHandle.action = url;
   }


/**
* CHANGE URL INPUT FORM
*/
function changeUrlInputForm (id) {
   /** Get handles */
   inputHandle = document.getElementById("urlInput"+id);

   if (inputHandle.value == 'Adresse eintippen...')
   	inputHandle.value = '';

   inputHandle.style.color = '#000000';
   }


/**
* CHANGE STARTPAGE ACCESS FORM
*/
function changeSPAccess () {
   /** Get handles */
   inputHandle = document.getElementById("SPAccessColl");

   if (inputHandle.value == 'Username & Go')
   	inputHandle.value = '';

   inputHandle.style.color = '#474747';
   }



/**
* OPENS TAB HELP IN ADD LINK FORM
*/
function openTabHelp () {
   inputHandle = document.getElementById("addLinkHelpTab");
   inputHandle.style.display = "inline";
   }


/**
* CLOSE TAB HELP IN ADD LINK FORM
*/
function closeTabHelp () {
   inputHandle = document.getElementById("addLinkHelpTab");
   inputHandle.style.display = "none";
   }


/**
* OPENS SECTION HELP IN ADD LINK FORM
*/
function openSectionHelp () {
   inputHandle = document.getElementById("addLinkHelpSection");
   inputHandle.style.display = "inline";
   }


/**
* CLOSE SECTION HELP IN ADD LINK FORM
*/
function closeSectionHelp () {
   inputHandle = document.getElementById("addLinkHelpSection");
   inputHandle.style.display = "none";
   }


/**
* OPENS SORT HELP IN ADD LINK FORM
*/
function openSortHelp () {
   inputHandle = document.getElementById("addLinkHelpSort");
   inputHandle.style.display = "inline";
   }


/**
* CLOSE SORT HELP IN ADD LINK FORM
*/
function closeSortHelp () {
   inputHandle = document.getElementById("addLinkHelpSort");
   inputHandle.style.display = "none";
   }



















