function _ml2tag(D,L,N){
D=unescape(D)
L=unescape(L)
if(N && N !=''){
document.write(L + String.fromCharCode(64) + D)
} else {
var T = unescape('%3Ca%20hr%65f%3D%22ma%69l%74o%3A%25s%22%3E%25t%3C%2Fa%3E');
T=T.replace(/%t/,L+unescape('%40')+D);
document.write(T.replace(/%s/g,L + String.fromCharCode(64) + D));
}
}

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 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.replace(/\$\$/,"\r\n")) + escape("\r\n")
      location.href = mail_str;
}

var LBARbgColor  ;
var LBARColor

function highlite(foo2){
	if(LBARbgColor==undefined)
		LBARbgColor=foo2.style.backgroundColor;
	if(LBARColor==undefined)
		LBARColor = foo2.style.color;
		foo2.style.backgroundColor= "#ffffff";
}
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;


}


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 popWin(winurl,wintarget,ww,wh,windowStyle)
	{

	// popWin(windowUrl,windowTarget,winWidth,winHeight,{'ww':"winWidth",'wh':"winHeight",'posleft':null,'postop':null,'wscrollbars':null,'wtoolbar':null,'wstatus':null,'wresizeable':null,'wmenubar':null,'wlocation':null,'wfullscreen':0,'wdirectories':0,'personalbar':0,'wdependent':0,'wallwaysraised':0})


		if(parseInt(navigator.appVersion)>=4){

			if(windowStyle== undefined || !windowStyle )
					windowStyle= new Object();

			if(!document.oldPopupWindowTarget)
				document.oldPopupWindowTarget='';


			if(windowStyle['postop'] && windowStyle['postop'] != 'center')
				windowStyle['postop'] =Math.round( parseFloat(windowStyle['postop']), 4)


			if(windowStyle['centered']) {
				if(!windowStyle['postop'])
					windowStyle['postop']='center' ;

				windowStyle['posleft']  = 'center'
			}


			var parmsno = new Array('toolbar','status','menubar','location')
			var parmsyes = new Array('resizeable','scrollbars')

			for(var i=0;i<parmsno.length;i++){
				if(windowStyle[parmsno[i]]  == undefined ||windowStyle[parmsno[i]]  == null)
					windowStyle[parmsno[i]] = 'no'
			}
			for(var i=0;i<parmsyes.length;i++){
				if(windowStyle[parmsyes[i]] == undefined ||windowStyle[parmsyes[i]] == null)
					windowStyle[parmsyes[i]] = 'yes'
			}



			ww = parseFloat(ww ? ww : windowStyle['ww'] || 0 ) || 620;
			wh = parseFloat(wh ? wh : windowStyle['wh'] || 0 ) || 440;

			var screenW = parseInt(screen.width)||800
			var screenH = parseInt(screen.height)||600;

			if(0 < wh && wh < 1 ){
					wh = Math.round(screenH * wh, 0);
			};
			if(0 < ww && ww < 1 ){
					ww = Math.round(screenW * ww, 0);
			};


			if(windowStyle['postop']  == 'center' ){
				if(screenH - wh > 0) {
					windowStyle['postop'] = Math.round( (screenH - wh) * 0.5, 0)
					if(windowStyle['postop']<=0)
							windowStyle['postop']=1
					} else {
						windowStyle['postop'] = 20
						wh = screenH - windowStyle['postop']*2;
				}
			}

			else if ( parseFloat(windowStyle['postop'])>0&& parseFloat(windowStyle['postop'])< 1){

				var var_postop = parseFloat(windowStyle['postop'])
				if(var_postop <=0.001)
					var_postop =0.5

				if(screenH - wh > 0) {
					windowStyle['postop'] = Math.round( (screenH - wh) * var_postop , 0)
					if(windowStyle['postop']<=0)
						windowStyle['postop']=11
				} else {
					windowStyle['postop'] = 20
					wh = screenH - windowStyle['postop']*2;
				}
			}

			if(windowStyle['posleft']  == 'center' ) {
				if(screenW - ww > 0){
					windowStyle['posleft'] =  Math.round( (screenW -ww) * 0.5 ,0)
					if(windowStyle['posleft']<=0)
						windowStyle['posleft']=1
				} else {
					windowStyle['posleft'] = 20
					ww = screenW - windowStyle['posleft']*2;
				}

			};


			if(windowStyle['posleft'] == undefined ||windowStyle['posleft'] == null||!windowStyle['posleft']){windowStyle['posleft'] = 20;}
			if(windowStyle['postop'] == undefined ||windowStyle['postop'] == null||!windowStyle['postop']){windowStyle['postop'] = 20;}


			if( wintarget == undefined || wintarget == null|| !wintarget )
				wintarget = "popup" + parseInt(Math.random()*1000000)


			windowStyle['ww'] = Math.round(ww, 0).toString();
			windowStyle['wh'] = Math.round(wh, 0).toString();


			var	winstyle =	'width='		+ windowStyle['ww']			+
						', height='		+ windowStyle['wh']			+
						', left='		+ windowStyle['posleft']		+
						', top='			+ windowStyle['postop']		+
						', screenX='		+ windowStyle['posleft']		+
						', screenY='		+ windowStyle['postop']		;



		for (var ikey in windowStyle){
			if(ikey=='ww'||ikey=='wh'||ikey=='posleft'||ikey=='postop'||ikey== 'centered')
				continue;

			if(windowStyle[ikey] == undefined)windowStyle[ikey]='no';

			winstyle +=   ', ' + ikey + '=' +  windowStyle[ikey]
		}


//alert(winstyle)

		if(!document.newPopupWindow || document.newPopupWindow.closed || document.oldPopupWindowTarget != wintarget)
		{
			document.newPopupWindow = window.open(winurl,wintarget,winstyle);
		}
/*
		else if (document.newPopupWindow && document.oldPopupWindowTarget == wintarget
 		    && !document.newPopupWindow.closed &&  document.newPopupWindow.location){

			document.newPopupWindow = window.open(winurl,wintarget,winstyle, true);


 			document.newPopupWindow.resizeTo(ww,wh)
 			document.newPopupWindow.moveTo(windowStyle['posleft'],windowStyle['postop'])
 			document.newPopupWindow.location.target  = wintarget
 			document.newPopupWindow.location.href  = winurl

 		}
*/
		else{
			document.newPopupWindow.close();
			document.newPopupWindow = null;
			document.newPopupWindow = window.open(winurl,wintarget,winstyle);
		}
		//document.newPopupWindow.focus();
		if(window.focus) document.newPopupWindow.focus();
			document.oldPopupWindowTarget = wintarget;

	} else {
		if(!wintarget )
			wintarget = "popup" + parseInt(Math.random()*1000000);
		if(!ww)ww=615
		if(!wh)wh=455

		window.open(winurl,wintarget,'width='+ww+',height='+wh+',left=5,top=5,scrollbars=yes,status=no,toolbar=no,resizable=yes,menubar=yes,location=no');
	}


	return false;
}
function  targetNew(myURL, myTarget){
	return popWin(myURL,myTarget,null,null,{'ww':0.75,'wh':0.63,'posleft':'center','postop':0.15,'toolbar':0,'status':1,'menubar':0,'location':0,'directories':0,'scrollbars':1,'resizeable':1})
}





////// _Cookie


Array.prototype.mapKeys = function() {
    var c = new Array();
    for (var i = 0; i < this.length; i++) {
        var p = this[i].split(":");
        if (typeof p[0] != "undefined") c[p[0]] = p[1];
    };
    return c
};

Array.prototype.unmapKeys = function() {
    var c = new Array();
    var i = 0;
    for (attr in this) {
        var t = typeof this[attr];
        if (t != "string" && t != "number") continue;
        c[i] = attr + ":" + this[attr];
        i++;
    };
    return c
};



var __js_Cookie = {
    // Data for the highlevel functions
    base : "CBPSEARCH",
    days : 1,
    splitter : "|",
    path : "/",
    secure : false,
    // Official specs allows 4000 Bytes/Cookie and 20 Cookies/Page
    maxstr : 4000,
    maxarr : 10,
    maxarrhard : 20,

    set : function(name, value) {
        if (name == null || typeof name == "undefined" || value==null || typeof value == "undefined") return;

        var c = this.get_sub().split(this.splitter)
        var n = [];

        // copy other values
        for (var i = 0; i < c.length; i++) {
            if (c[i] == "") continue;
            var d = c[i].split(":");
            if (d[0] != name) n.push(c[i]);
        };

        // add new value pair
        n.unshift(name + ":" + value);
        // copy to destination array
        d = n;

        // Neue Daten optimiert abspeichern
        var s = "";
        var j = 0;

        for (var i = 0; i < d.length; i++) {
            // ignore some erroneous values
            if (d[i] == null || typeof d[i] == "undefined") continue;

            // Too big
            if ((s.length + d[i].length) > this.maxstr) {
                this.create(this.base + this.norm_sub(j), s, this.days);
                s = d[i];
                j++;

                if (j>this.maxarr) break;
            } else {
                if(s != "") s+= this.splitter;
                s += d[i];
            };
        };

        // Save remaining values
        if (s!="" && j <= this.maxarr) {
            this.create(this.base + this.norm_sub(j), s, this.days);
            j++;
        };

        for (var i = j; i < this.maxarrhard; i++) this.erase(this.base + this.norm_sub(i));

        return true
    },

    get : function(name) {
        var c = this.prep_sub()[name];
        if (c && typeof c != "undefined") return c;
        return null
    },

    norm_sub : function(i) {
        return String(i < 10 ? "0" + i : i)
    },

    get_sub : function() {
        var s = "";

        for (var i = 0; i < this.maxarrhard; i++) {
            var r = this.read(this.base + this.norm_sub(i))
                if (r) s += r;
        };

        return s
    },

    prep_sub : function() {
        return this.get_sub().split(this.splitter).mapKeys();
    },

    // Low Level Internal Functions
  create : function(name, value, days, spath ) {
         if (days) {
             var date = new Date();
             date.setTime(date.getTime() + (days * 86400 * 1000));
             var expires = "; expires=" + date.toGMTString();
         } else {
             var expires = "";
         };

            if(spath)
              var setpath ="; path=" + this.path;


         if(self.location.protocol && self.location.protocol =='https:')
         	this.secure = true;


         if(!setpath && this.path)
         var setpath ="; path=" + this.path;

	if(this.secure)
		var _secure = "; secure";
	else
		var _secure ="";

         document.cookie = name + "=" + value + expires +   setpath + _secure;

    },
    read : function(name) {
        var ne = name + "=";
        var ca = document.cookie.split(";");

        for (var i = 0; i < ca.length; i++) {
            var c = ca[i];

            while (c.charAt(0) == " ")
                c = c.substring(1, c.length);

            if (c.indexOf(ne) == 0)
                return c.substring(ne.length, c.length)
        };

        return null
    },

    erase : function(name) {
    	if (this.read(name) != null)
	    this.create(name, "", -1);
	     this.create(name, "", -1);
    }
};




function _gebi (H)
{
	try { return document.getElementById(H); }
	catch (e)
	{
	}
	return false
}
