/*
 * syspack.js JS Library 2.2
 * Copyright(c) 2006-2009, photopost.
 * all rights reserved
 * 
 * http://www.photopost.com.br
 */
var w = window.screen.width;
var h = window.screen.height;

var NS = (document.layers)? true:false
var IE = (document.all)? true:false
var VER = (IE || NS) ? 1 : 0;

this.agent = navigator.userAgent.toLowerCase(); // informações sobre o navegador
this.codeName = navigator.appCodeName; // codename do navegador
this.version = navigator.appVersion // versão completa do navegador
this.major = parseInt(navigator.appVersion); // numero da versão do navegador
this.dom = (document.getElementById)?1:0; //
this.name = (this.dom&&navigator.appName); // nome do navegador
this.ns = (document.layers);

this.nts = (this.dom&&navigator.appName=="Netscape"); // true se for netscape 
this.mie = (this.dom&&navigator.appName=="Microsoft Internet Explorer"); // true se for Internet explorer
this.opr = (window.opera?1:0);  // retorna 1 se o nav. for o opera se não 0
this.ie = (document.all);
this.ie4 = (document.all&&!this.dom)?1:0; // 1 se a versão for a 4 se não 0
this.ie4up = (this.ie && this.major>=4); // true se a versão do navegador for superior a 4
this.ie5 = (document.all&&this.dom);

this.win = ((this.agent.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1)); // true para s.o. windows
this.mac = (this.agent.indexOf("mac")!=-1); // true para s.o. mac
this.iphone = (this.agent.indexOf("iphone")!=-1); // true para iphone
this.ipod = (this.agent.indexOf("ipod")!=-1); // true para ipod
this.mobile = (this.agent.indexOf("mobile")!=-1); // true para ipod
this.blackberry = (this.agent.indexOf("blackberry")!=-1); // true para blackberry

function isMobile()
// retorna true se o dispositivo de acesso é mobile
{
    if((iphone)||(ipod)||(mobile)||(blackberry)){
        return(true);
    }
    return(false)
};
    
			   
// NewPopup
function NewPopup(url,left,top,width,height,scroll) {
    features = "left="+left+",top="+top+",width="+width+",height="+height+",toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no"+",scrollbars="+scroll;
    popup = window.open( url,"Photo",features);
    if (window.focus)
    popup.focus();
}

// CheckAll
// marcad todos os checkbox da pagina
function CheckAll(spanChk){
	// Added as ASPX uses SPAN for checkbox
	var oItem = spanChk.children;          
	var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];
	xState=theBox.checked;                                                 
	elm=theBox.form.elements;                                              
	for(i=0;i<elm.length;i++)                                              
	if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)                    
	{                                                                      
		//elm[i].click();                                                      
		if(elm[i].checked!=xState)                                             
		elm[i].click();                                                        
		//elm[i].checked=xState;                                               
	}                                                                      
}                                
		
// ToolTips
// exibe o tooltips para os elementos que possuem um atributo title
// no cabeçalho da página onde o tip deve funcionar coloque:
// <script language="javascript" type="text/javascript" >
//  window.onload = function() {tooltip();} 
// </script>
//
//
var _id = "MyToolTip";
var _background = "#000000";
var _border = "1px solid #999999";
var _display = "none";
var _font = "11px Tahoma, Verdana, Arial, Sans-serif";
var _color = "#ffffff";
var _marginX = 13; //distancia do mouse em x
var _marginY = 5; //distancia do mouse em y
var _opacity = 75; // 0 a 100
var _padding = "2px 5px";
var _position = "absolute";
var _x = -10;
var _y = -10;
//
function setPos(event) {
	if (document.all) {//IE
		_x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		_y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
		_x += (window.event.clientX+_marginX);
		_y += (window.event.clientY+_marginY);
	} else {//Good Browsers
		_x = (event.pageX+_marginX);
		_y = (event.pageY+_marginY);
	}
}
//
function showTip(text) {
	var t = document.getElementById(_id);
	t.style.display = "block";
	document.onmousemove = function(event) {
		setPos(event);
		t.innerHTML = text;
		t.style.left = _x+"px";
		t.style.top = _y+"px";
	}
}
//
function hideTip() {
	var t = document.getElementById(_id).style;
	t.display = "none";
}
//
function tooltip() {
	var body = document.getElementsByTagName("body");
	body = body[0];
	body.innerHTML += "<div id='"+_id+"'></div>";
	var t = document.getElementById(_id).style;
	t.background = _background;
	t.border = _border;
	t.display = _display;
	t.font = _font;
	t.color = _color;
	t.opacity = _opacity/100;
	t.filter = "alpha(opacity="+_opacity+")";
	t.padding = _padding;
	t.position = _position;
	var element = document.getElementsByTagName("input");
	for (i=0; i<element.length; i++) {
		var title = element[i].getAttribute("title");
		if (title) {
			element[i].setAttribute("tptitle", title);
			element[i].removeAttribute("title");
			element[i].onmouseover = function() { showTip(this.getAttribute("tptitle")); }
		}
		element[i].onmouseout = function() { hideTip(); }
	}
}
