//<![CDATA[

///////////////////////////////// FUNCTIONS ////////////////////////////////////


function openWin(path,winW,winH) {
	var iMyWidth;
	var iMyHeight;
    iMyWidth = (window.screen.width/2) - ((winW/2)+ 10); 
	iMyHeight = (window.screen.height/2) - ((winH/2) + 50); 
	var win2 = window.open(path,'',"status,toolbar=0,height="+winH+",width="+winW+",resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");
    win2.opener=window;
    win2.focus();
    return false;
}

// CSS Browser Selector   v0.1.7
// Documentation:         http://rafael.adm.br/css_browser_selector
// License:               http://creativecommons.org/licenses/by/2.5/
// Author:                Rafael Lima (http://rafael.adm.br)
// Contributors:          http://rafael.adm.br/css_browser_selector#contributors
/*  CLASSES
    * ie - Internet Explorer
    * ie6 - Internet Explorer 6
    * ie5 - Internet Explorer 5
    * gecko - Mozilla, Firefox, Camino
    * opera - Opera
    * konqueror - Konqueror
    * webkit or safari - Safari, NetNewsWire, OmniWeb, Shiira
*/
var css_browser_selector = function() {
	var ua = navigator.userAgent.toLowerCase();
	var h = document.getElementsByTagName('html')[0];
	var c = h.className;

	if(ua.indexOf('msie') != -1 && !(ua.indexOf('opera') != -1) && (ua.indexOf('webtv') == -1) ) h.className='ie'+' ie'+ua.charAt(ua.indexOf('msie')+5)+' '+c;
	else if(ua.indexOf('gecko/') != -1) h.className=('gecko '+c);
	else if(ua.indexOf('opera') != -1) h.className=('opera '+c);
	else if(ua.indexOf('konqueror') != -1) h.className=('konqueror '+c);
	else if(ua.indexOf('applewebkit/') != - 1) h.className=('webkit safari '+c);
	else if(ua.indexOf('mozilla/') != -1) h.className=('gecko '+c);
}.apply(this);

///////////////////////////////// editable /////////////////////////////////////

imgs = 4;
i=1;
function slideshow(){
	i++;
	if(i>imgs)i=1;
	crossfade(document.getElementById('foto'), 'img/foto'+i+'.jpg', '1', '');
}

///////////////////////////////// onload ///////////////////////////////////////



function imgMod_align(){
    var img = document.getElementsByTagName('img');
    for(i=0;i<img.length;i++){
        var attr = img[i].getAttribute('align');
        if(attr){
            if(attr=="left"){
                if(!img[i].className) img[i].className = 'alignLeft'; 
                else img[i].className += ' alignLeft';
            }else if(attr=="right"){
                if(!img[i].className) img[i].className = 'alignRight'; 
                else img[i].className += ' alignRight';
            }    
        }
    }
}

function aMod_externalLink(){    
    var as,i,islink;
    // grab all links, and loop over them
    as=document.getElementsByTagName('a');
    for(i=0;i<as.length;i++){
        // take the link's href
        islink=as[i].href; 
        // and check if it contains the current location 
        var host = new String(window.location.hostname);
        rExp = /www./gi;
        domain = host.replace(rExp, "");

        if(islink.indexOf(domain)==-1 && islink.indexOf('javascript:')==-1){
            if(!as[i].getAttribute('title'))as[i].setAttribute('title',islink);
            as[i].setAttribute("target","_blank"); 
        } 
    }
}
function addEvent( obj, type, fn )
{
	if (obj.addEventListener)
		obj.addEventListener( type, fn, false );
	else if (obj.attachEvent)
	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}


///////////////////////////////// SCRIPTS //////////////////////////////////////

if(document.getElementById && document.createTextNode){
    	window.onload=function (){
    		aMod_externalLink();   		
    		//setInterval("slideshow();",6000);
	}
}  



//]]>
