// JavaScript Document
function axter(){
	var default_value=true;	
}
var last_id_clicked='';
	function SelImage(file,id,how, id_db_default){
		var obj=document.getElementById('img_'+ id);
		
		if (last_id_clicked==''){
			try{
				document.getElementById(id_db_default).className='img_not_selected';
			}catch(e){}
		}else{
		
			document.getElementById(last_id_clicked).className='img_not_selected';
			last_id_clicked='img_'+ id;
		}
		
		obj.className='img_selected';
		document.getElementById('image').value=file;
		if(how==1){
			document.getElementById('path_image').value='default_icons';
		}else{
			document.getElementById('path_image').value='';
		}
		
		last_id_clicked='img_'+ id;

	}
	
	function OverImage(id){
		var obj=document.getElementById('img_'+ id);
		if(last_id_clicked!='img_'+id){
		obj.className='img_onmouseover';
		}
	}
	
	function OutImage(id){
		var obj=document.getElementById('img_'+ id);
		if(last_id_clicked!='img_'+id){
		obj.className='img_not_selected';
		}
	}
	function DltImage(imei, file){
		document.getElementById('frm_hidden').src='include_content/device_config.php?dlt&file='+ file +'&imei='+ imei;
	}
	
	function set_last_id_clicked(id){
		last_id_clicked=id;
		alert(last_id_clicked);		
	}

//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.com
//
function getPageScroll(){

	var xScroll, yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}

	arrayPageScroll = new Array(xScroll,yScroll) 
	return arrayPageScroll;
}

// -----------------------------------------------------------------------------------

//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.com
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
//	console.log(self.innerWidth);
//	console.log(document.documentElement.clientWidth);

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

//	console.log("xScroll " + xScroll)
//	console.log("windowWidth " + windowWidth)

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
//	console.log("pageWidth " + pageWidth)

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
function getMousePos(e) {
	//NS
	if (document.layers||document.getElementById&&!document.all) {
		coordsXY[0]=e.pageX;
		coordsXY[1]=e.pageY;
	}
	//IE
	else if (document.all) {
//		window.status=window.event.clientX+" and "+window.event.clientY;
		coordsXY[0]=window.event.clientX;
		coordsXY[1]=window.event.clientY;
	}
}
document.onmousemove=getMousePos;
//--------------------------------------------

<!--
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
function portfolioOnMouseOver(nome){
	if(portfoliothumb==0){
		var vScroll = getPageScroll();
		var objOverlay = document.getElementById(nome+'thumb');
		if(!objOverlay)
			return false;
		objOverlay.style.position = 'absolute';
		objOverlay.style.backgroundColor = '#FFFFFF';
		objOverlay.style.border = "1px solid #CCC";
		if(objOverlay.innerHTML!='')
			objOverlay.style.display = '';
		if(BrowserDetect.browser=='Explorer'){
			objOverlay.style.top =coordsXY[1]+vScroll[1]+"px";
		}else{
			objOverlay.style.top =coordsXY[1]+"px";
		}
		objOverlay.style.left = coordsXY[0]+"px";
		objOverlay.style.zIndex = 150;
		portfoliothumb = 1;		
	}
}
function portfolioOnMouseOut(nome){
	var objOverlay = document.getElementById(nome+'thumb');
	if(!objOverlay)
		return false;
	objOverlay.style.display = 'none';
	portfoliothumb = 0;
}
