// JavaScript Document
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function targetBlank (url) {
	blankWin = window.open(url,'_blank','menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=no,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes');
}

// Anti-Spam Email Displayer- By JavaScriptKit.com
// Visit JavaScript Kit (http://javascriptkit.com) for this script and more.
// This notice must stay intact for use

var contacts=new Array()
//Specify text and corresponding email address.
//Use [at] and [dot] in place of "@" and "." for anti spam purpose:
contacts[0]=["<img src=\"images/et_p.gif\" alt=\"mail [&auml;t] robertsimon [punkt] net\" width=\"73\" height=\"73\" id=\"email1\" onmouseover=\"MM_swapImage('email1','','images/et_a.gif',1)\" onmouseout=\"MM_swapImgRestore()\" />", "mail[at]robertsimon[dot]net"]

//Specify caption text to display within SELECT menu. Only applicable if you're using the form option:
var dropmenucaption="CONTACT US FORM "

function displaycontact(emailarray, cssclass, displaymethod, extrainfo){
if (displaymethod=="text"){
//document.write('<span class="' + cssclass + '">\n')
if (typeof emailarray[0]=="object"){ //if array passed consists of multiple elements
for (i=0; i<emailarray.length; i++){
var seperator=(i<emailarray.length-1)? extrainfo : ""
document.write('<a href="Tmailto:' + modifyemail(emailarray[i][1])+ '">'+ emailarray[i][0] + '</a>' + seperator)
}
}
else //else if it is a single array element
document.write('<a href="mailto:' + modifyemail(emailarray[1])+ '">'+ emailarray[0] + '</a>')
//document.write('</span>')
}
else if (displaymethod=="form"){
document.write('<form>\n')
document.write('<select size="' + extrainfo + '" onChange="jumptooption(this)" class="' + cssclass + '">\n')
document.write('<option value="caption">' + dropmenucaption + '</option>\n')
for (i=0; i<emailarray.length; i++)
document.write('<option value="mailto:' + modifyemail(emailarray[i][1]) +'">' + emailarray[i][0] + ' </option>\n')
document.write('</select></form>\n')
}
}

function modifyemail(emailitem){
var modified=emailitem.replace(/\[at]/gi, "@")
modified=modified.replace(/\[dot]/gi, ".")
return modified
}

function jumptooption(themenu){
if (themenu.options[themenu.selectedIndex].value !="caption")
location=themenu.options[themenu.selectedIndex].value
}

//USAGE INSTRUCTION. displaycontact(1st paramter, "2nd paramter", "3rd paramter", "4th paramter")
//1st parameter: Input the name of the array containing the list of email addresses. To display one single email, input the corresponding array element. 
//2nd parameter: Input the CSS Classname that is to be applied. Enter arbitrary name for none.
//3rd parameter: Input either "form" or "text." Former will display email in drop down menu. Later in plain text. Only "text" mode supports displaying of single email address!
//4th parameter: If in "form" mode, enter an integer to control the height of the <SELECT> tag. If "text" mode, enter any string to act as a divider between each email text. For example "|", "<br />" etc.

//SAMPLE USAGES (uncomment below to see)
//displaycontact(contacts, "textstyle", "text", " | ")

//displaycontact(contacts, "formstyle", "form", "1")

//displaycontact(contacts[2], "textstyle", "text", "")


