function fWindowOpen(pagina,nome,altura,largura)
	{
		var leftPos = (screen.width/2)-(largura/2);
		var topPos = (screen.height/2)-(altura/2);
		//alert(leftPos);
		var contentPage = window.open("",nome,'toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no,width='+largura+',height='+altura+',left='+leftPos+',top='+topPos+'');
		contentPage.document.write("<HTML><HEAD><TITLE>Projetando PVC</TITLE>");
		contentPage.document.write("</HEAD><BODY topmargin='0' leftmargin='0'><IMG src="+pagina+" border='0'></BODY></HTML>");
	}
function RodarFlash(path,variaveis,_width,_height)
{
	document.write('<div class="flash">');
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" id="externalinterface" width="'+_width+'" height="'+_height+'">');
			document.write('<param name="movie" value="'+path+'?'+variaveis+'">');
			document.write('<param name="quality" value="high">');
			document.write('<param name="wmode" value="transparent">');
			document.write('<embed src="'+path+'?'+variaveis+'" width="'+_width+'" height="'+_height+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>');
		document.write('</object>');
	document.write('</div>');
}
function RodarBanner(path,variaveis,_width,_height)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" id="externalinterface2" width="'+_width+'" height="'+_height+'">');
		document.write('<param name="movie" value="'+path+'?'+variaveis+'">');
		document.write('<param name="quality" value="high">');
		document.write('<param name="wmode" value="transparent">');
		document.write('<embed src="'+path+'?'+variaveis+'" width="'+_width+'" height="'+_height+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>');
	document.write('</object>');
}
function SubMenu(parametro)
{
	if(parametro == 'mostra')
	{
		//document.getElementById('menu').style.zIndex = '2';
		//document.getElementById('conteudo').style.zIndex = '1';
	}
	if(parametro == 'esconde')
	{
		//document.getElementById('menu').style.zIndex = '1';
		//document.getElementById('conteudo').style.zIndex = '2';
	}
}

var defaultEmptyOK = false
var whitespace = " \t\n\r";
function isEmail (s)
{  
	
 if (isEmpty(s)) 
       if (isEmail.arguments.length == 1) return defaultEmptyOK;
       else return (isEmail.arguments[1] == true);
   
    if (isWhitespace(s)) return false;
    var i = 1;
    var sLength = s.length;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }

    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}
function isWhitespace (s)

{   var i;

    // Is s empty?
    if (isEmpty(s)) return true;

    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    return true;
}

/*Script para calcular o tamanho da pagina*/
function calculaAltura(){
	var heightPage = "";
	var widthPage  = "";
					
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY){	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	}else if(document.body.scrollHeight > document.body.offsetHeight){ // todos exceto Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	}else{ // Explorer Mac...também trabalhara em Explorer 6 Strict, Mozilla e Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight){	// todos exceto Explorer
		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){ // outros Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
		
	// para pequenas páginas com altura total menos então altura do viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	}else{ 
		pageHeight = yScroll;
	}

	// para pequenas páginas com largura total menos então largura do viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	}else{
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);

	heightPage = pageHeight;
	widthPage =  pageWidth;
	
	var objectHalfWidth = $("#bannerPopup object").css("width");
	objectHalfWidth = objectHalfWidth.substring(0,objectHalfWidth.indexOf("px"));
	var objectHalfHeight = $("#bannerPopup object").css("height");
	objectHalfHeight = objectHalfHeight.substring(0,objectHalfHeight.indexOf("px"));
	
	//document.getElementById("bannerPopup").style.width = widthPage+"px";
	$("#bannerPopup").css("height",heightPage+'px');
	$("#bannerPopup div").css("position","absolute");
	//$("#bannerPopup div").css("background","#4cb3b2");
	//$("#bannerPopup div").css("padding","5px 10px");
	$("#bannerPopup div").css("width",$("#bannerPopup object").css("width"));
	$("#bannerPopup div").css("left",(widthPage/2)-(objectHalfWidth/2));
	$("#bannerPopup div").css("top",(heightPage/2)-(objectHalfHeight/2));
	$("#bannerPopup div a").remove();
	$("#bannerPopup div").prepend("<a href='javascript:;'>fechar</a>");
	$("#bannerPopup div a").attr("style","background:#fff; text-align:right; display:block; position:absolute; right:0px; font-family:Tahoma, Geneva, sans-serif; font-size:11px; font-weight:bold; color:#333; padding:5px; text-decoration:none;");
	$("#bannerPopup div a").click(function(){
		$("#bannerPopup").css("display","none");						   
	});
	
	
	
	//return widthPage + " - " +heightPage;
}


