/* ************************************************************
// JavaScript: www.famev.de/js/as.js
// ©2009 by Inico.com, LLC
// Last modified: 2009-07-31 18:31:18 UTC
// ************************************************************
*/


function _ml2tag(D,L,N,id){
	D=unescape(D)
	L=unescape(L)

	if(!id )
	id = 'id'+Math.ceil(10000000 * Math.random())

	if(N && N =='nolink'){
	document.write(L + String.fromCharCode(64) + D)
	} else {
	var T = unescape('%3Ca%20id=%27'+ id + '%27%20hr%65f%3D%22ma%69l%74o%3A%25s%22%3E%25t%3C%2Fa%3E');
	if(N)
	T=T.replace(/%t/,N);
	else
        T=T.replace(/%t/,L+ '&#'+'x40;' +D);

	document.write(T.replace(/%s/g,L + '&#'+'x40;' + D));

//	T=T.replace(/%t/,L+unescape('%40')+D);
//	document.write(T.replace(/%s/g,L + String.fromCharCode(64) + D));
	}
}

function swap_image(myRef) {
myRef.src = myRef.src.replace(/.(gif|png)$/,'_hi.$1') 
}
function swap_back(myRef) {
myRef.src = myRef.src.replace(/_hi.(gif|png)$/,'.$1') 
}

function rotateImage(ID,ar){
	foo =document.getElementById(ID);
	document.lastrand['counter']++;
	if(document.lastrand[ID]!=undefined){
	if(document.lastrand['counter'] % 11) {
	randIndex = document.lastrand[ID]+1
	} else {
	randIndex = document.lastrand[ID] + Math.ceil(3 * Math.random())
	}
	} else {
	randIndex = parseInt(Math.random() * ar.length)
	}
	randIndex = randIndex  % ar.length;
	document.lastrand[ID]= randIndex
	//window.status = document.lastrand['stlarch']
	foo.src = ar[randIndex];
}

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400,left = 100,top = 100');");
}

function writeStyle() {

	if(document.cookie.indexOf('inicoAMS_style=0')>=0){

	    document.write('<link rel="stylesheet" type="text/css" href="css/cbp_size0.css">\n');

	}else if (document.cookie.indexOf('inicoAMS_style=1')>=0){

	    document.write('<link rel="stylesheet" type="text/css" href="css/cbp_size1.css">\n');

	}else if (document.cookie.indexOf('inicoAMS_style=2')>=0){

	    document.write('<link rel="stylesheet" type="text/css" href="css/cbp_size2.css">\n');

	}else{

	    document.write('<link rel="stylesheet" type="text/css" href="css/cbp_size0.css">\n');

	}

}

function chooseStyle (newstyle){
    var expdate = new Date();
    expdate.setTime(expdate.getTime() + (1000*3600*24*365));
    document.cookie = 'inicoAMS_style=' + newstyle + '; expires=' + expdate.toGMTString() + '; path=';
    self.location = self.location.href;

}

function addBookmark(bookmarkurl,bookmarktitle)
{
      if (document.all) {
        window.external.AddFavorite(bookmarkurl,bookmarktitle);
      }
      else

      {
      	alert("Press Ctrl + D to add the current page to your bookmarks");
      }
}

function tellAfriend(S,B)
{
      mail_str = "mailto:?subject=" + escape(S);
      mail_str += "&body=" + escape(B) + "%0A%20%20"
      location.href = mail_str;
}

var LBARbgColor  ;
var LBARColor

function highlite(foo2,bgcolor,fgcolor){
	if(!bgcolor)
		bgcolor="#CABE8C"
	if(!fgcolor)
		fgcolor="navy"

	if(LBARbgColor !=undefined)
		LBARbgColor=foo2.style.backgroundColor;
	if(LBARColor!=undefined)
		LBARColor = foo2.style.color;

	foo2.style.color= fgcolor;
	foo2.style.backgroundColor= bgcolor;
}
function highnoon(foo2){
	if(LBARbgColor)
	foo2.style.backgroundColor= LBARbgColor;
	else
	foo2.style.backgroundColor= "transparent";

	if(LBARColor)
	foo2.style.backgroundColor= LBARColor;
	else
	foo2.style.color= foo2.style.defaultColor;

}

// functions below : (c) macromedia

function MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_validateForm() { //v3.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (val!=''+num) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

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];}}

}
