// Set event handler to initialize API
var isCSS, isW3C, isIE4, isIE6CSS, isNN4, isNN6; 
var widthWindow, heightWindow;
var heightHTML;

window.onresize = checkIBrowser;

// let all IBrowsers establish content objects
function checkIBrowser() {
	if (document.images) {
		isCSS = (document.body && document.body.style) ? true : false;
		isW3C = (isCSS && document.getElementById) ? true : false;
		isIE4 = (isCSS && document.all) ? true : false;
		isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false;
		isNN4 = (document.layers) ? true : false;
		isNN6 = (document.getElementById && !document.all) ? true : false;
		isOPE = (window.opera) ? true : false;
		
		// set content's size
		if (isW3C) {
    	    offY = (isNN6)? 40 : (isOPE)? 40 : 0;
		    if (getRawObject("spanmain").scrollHeight > getRawObject("spanlink").scrollHeight) {
		        getObject("spanlink").height = getRawObject("spanmain").scrollHeight + "px";
		    }
		    else {
		        getObject("divpage").height = getRawObject("spanlink").scrollHeight - 176 - 56 - offY + "px";
		    }
		}
		return true;
	}
	else
		return false;
}

// Set the background color of an object
function setBGColor(obj, color) {
	var theObj = getObject(obj);
	if (theObj) {
		if (isNN4) {
			theObj.bgColor = color;
		} else if (isCSS) {
			theObj.backgroundColor = color;
		}
	}
}

// Convert object name string or object reference
// into a valid style (or NN4 layer) reference
function getObject(obj) {
	var theObj = getRawObject(obj);
	if (theObj && isCSS) {
		theObj = theObj.style;
	}
	return theObj;
}

// Convert object name string or object reference
// into a valid element object reference
function getRawObject(obj) {
	var theObj;
	if (typeof obj == "string") {
		if (isW3C) {
			theObj = document.getElementById(obj);
		} else if (isIE4) {
			theObj = document.all(obj);
		} else if (isNN4) {
			theObj = seekLayer(document, obj);
		}
	} else {
		// pass through object reference
		theObj = obj;
	}
	return theObj;
}

// Set the visibility of an object to visible - true or hidden - false
function showHideObject(obj, sw) {
    var theObj = getObject(obj);
    if (theObj) {
    	if (sw)
        	theObj.visibility = "visible";
        else
        	theObj.visibility = "hidden";
    }
}

// change cursor style
function cursorStyle(img) {
	if (isCSS) {
		if (isNN4 || isNN6)
			img.style.cursor='pointer';
		else
			img.style.cursor='hand';
	}
	return;
}

function rendertable(){
YAHOO.util.Event.addListener(window, "load", function() {
    YAHOO.example.EnhanceFromMarkup = function() {
        var myColumnDefs = [
            {key:"peripheral",label:"Peripheral", sortable:true, width:100},
            {key:"description",label:"Description", sortable:true, width:140},
            {key:"qong",label:"Qong", sortable:true, width:40, className:"align-center"},
            {key:"neptune",label:"Neptune", sortable:true, width:50, className:"align-center"},
            {key:"aria",label:"Aria", sortable:true, width:30, className:"align-center"}
        ];

        var myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get("accounts"));
        myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
        myDataSource.responseSchema = {
            fields: [{key:"peripheral"},
                    {key:"description"},
                    {key:"qong"}, 
                    {key:"neptune"}, 
                    {key:"aria"}
            ]
        };
        var myDataTable = new YAHOO.widget.DataTable("markup", myColumnDefs, myDataSource,
                {caption:"Available FPGA IP Cores for DAVE CPU Modules",
                sortedBy:{key:"peripheral",dir:"desc"}}
        );
        
        return {
            oDS: myDataSource,
            oDT: myDataTable
        };
    }();
});}



// Piero, 08-01-2008
// Apertura popup window pił evoluta

function popImage(imageURL,imageTitle){

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 800;
defaultHeight = 650;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;


if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(300,300);');
writeln('width=300-(document.body.clientWidth-document.images[0].width);');
writeln('height=300-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}

