

function checkToSkipProjectsPage() {
    var selection, containerElement;	
    var i, count;    
	try {	
		containerElement = getMultibrowserElementById('projects_ProjectsStyle');
		if(containerElement) {
			selection = containerElement.getElementsByTagName('A');
			// try using selection as an array
			count= selection.length; 
			if(count<=2){ // note: each project has two a href's displayed
				// need to continue into next page
				
				//alert('SkipProjectsPage');
				clearDisplay();
				//selection[0].click(); //MSIE4+	ELS 2005 1212
				if ( selection[0].href ) document.location.href = selection[0].href; //FireFox, Netscape, MSIE4+
			}
		} 
	} catch (e){}
}

function checkToSkipDesktopPage() {
    var selection, containerElement;	
    var i, count;    
	//try {
		containerElement = getMultibrowserElementById('desktop_Content');		
		if(containerElement) {
			selection = containerElement.getElementsByTagName('A');
			// try using selection as an array
			count= selection.length; 
			if(count<=2){ // note: each project has two a href's displayed
				// need to continue into next page
				
				//alert('SkipDesktopPage');
				clearDisplay();
				//selection[0].click(); //MSIE4+
				if ( selection[0].href ) document.location.href = selection[0].href; //FireFox, Netscape, MSIE4+
			}
		} 
	//} catch (e){}
}

function clearDisplay() {
	try {
		hideMultibrowserElementById('mstr_VerticalDocks');
		hideMultibrowserElementById('mstrWeb_dockBottom');
		hideMultibrowserElementById('mstrWeb_footer');
		hideMultibrowserElementById('mstrWeb_cssanalyzer');
			
		// write a Wait message:
		document.write('<br>&nbsp; &nbsp; &nbsp; <b>One moment please</b>, next page is loading...');
			
	} catch(e){}
}

function register_NavigationSkipScripts() {
  var func1 = checkToSkipProjectsPage;
  var func2 = checkToSkipDesktopPage;
  register_onLoad(func1);
  register_onLoad(func2);
}

function hideMultibrowserElementById(sID) {
	var element;
	element = getMultibrowserElementById(sID);	
	if(element) {
		if(element.style) {//DOM & proprietary DOM
			element.style.visibility = 'hidden';
			element.style.display = 'none';
		}
	} else {
        if( element.visibility ) { //Netscape
            element.visibility = 'hide';
        } else {
             //don't go any further
        }
    }
}

// some ELS standard parts...:
// these functions could be defined in more ELS script files - if changed, please replace also in other files

function getMultibrowserElementById(sID,oDoc) { 
    if( !oDoc ) { oDoc = document; } // init at document level, used for recursive for netscape
    if( document.layers ) { //Netscape layers
		//alert('document.layers');
        if( oDoc.layers[sID] ) { return oDoc.layers[sID]; } else {
            //repeatedly run through all child layers
            for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
                //on success, return that layer, else return nothing
                y = getMultibrowserElementById(sID,oDoc.layers[x].document); }
            return y; } }
    if( document.getElementById ) { //DOM; IE5, NS6, Mozilla, Opera
		//alert('document.getElementById');
        return document.getElementById(sID); }
    if( document.all ) { //Proprietary DOM; IE4
		//alert('document.all');
        return document.all[sID]; }
    if( document[sID] ) { //Netscape alternative
		//alert('document[xxx]');
        return document[sID]; }
    return false;
}

function register_onLoad(func) {
  var oldonload = window.onload;  
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

///// activation of script:
//window.onload fires after all content (including images) has been loaded
//register_NavigationSkipScripts(); // uses the windows.onload

// activate now: (this js is now called AFTER <body> is complete
checkToSkipProjectsPage();
checkToSkipDesktopPage();

