function createCookie(name,value,days){
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name){
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name){
	createCookie(name,"",-1);
}
var fontObj = {
//	CSSArray:['normal.css', 'big.css', 'bigger.css'],  '/_css/'+
	CSSArray:['estilo_pequeno.css', 'estilo_normal.css', 'estilo_grande.css'],
	CSSSelected:1,
	init:function(){
		this.CSSSelected = this.getFontSizeCookie();
		var fsize_css = document.createElement('link');
		fsize_css.setAttribute('href', this.CSSArray[this.CSSSelected]);// aqui vai
		fsize_css.setAttribute('id','altcss');
		fsize_css.setAttribute('rel','stylesheet');
		fsize_css.setAttribute('title','gerencia tamanho da fonte');
		document.getElementsByTagName('head')[0].appendChild(fsize_css);
	},
	getFontSizeCookie:function(){
		var cookie = readCookie("FSize");
		var fsize = cookie ? parseInt(cookie) : 0;
		return fsize;
	},
	getFontSizeCSS:function(){
		var cssfont = document.getElementById('altcss');
		return cssfont;
	},
	setFontSizeCSS:function(){
		var cssfont = this.getFontSizeCSS();
		cssfont.setAttribute('href',this.CSSArray[this.CSSSelected]);// aqui vai
		return true;
	},
	fontChangeUp:function(){
		this.CSSSelected = (this.CSSSelected >= this.CSSArray.length-1) ? this.CSSSelected : this.CSSSelected +1;
		this.setFontSizeCSS(this.CSSSelected);
		createCookie("FSize", this.CSSSelected, 365);
		return false;
	},
	fontChangeDown:function(){
		this.CSSSelected = (this.CSSSelected <= 1) ? 0 : this.CSSSelected -1;
		this.setFontSizeCSS(this.CSSSelected);
		createCookie("FSize", this.CSSSelected, 365);
		return false;
	}
}
fontObj.init();


function GerarSWF(arquivo,largura,altura,id,cor,wmode){
    document.writeln('    <object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + largura + '" height="' + altura + '" id="' + id + '" name="' + id + '">');
    document.writeln('        <param name="movie" value="' + arquivo + '" />');
    document.writeln('        <param name="FlashVars" value="loc=en_US&htmlApp=false&gatewayURL=gwurl" />');
    document.writeln('        <param name="menu" value="false" />');
	document.writeln('        <param name="BGCOLOR" value="' + cor + '" />');
	document.writeln('        <param name="quality" value="high" />');
	document.writeln('        <param name="wmode" value="' + wmode + '" />');
    document.writeln('        <embed id="globalnav-embed" src="' + arquivo + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="loc=en_US&htmlApp=false&gatewayURL=gwurl" menu="false" quality="high" wmode="' + wmode + '" bgcolor="' + cor + '" id="' + id + '" width="' + largura + '" height="' + altura + '"></embed>');
    document.writeln('    </object>');
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/*pop*/
function abrePop(param,param2,s,w,h){
	var novaJanela = window.open(param,param2,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+s+',resizable=no,top=50,left=50,width='+w+',height='+h);
	if (novaJanela) return false;
	return true;
}

function jumpMenu(targ,selObj,restore){
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

// Adiciona aos Favoritos
function addBookmark(title, url){
if (document.all) window.external.AddFavorite(url, title); 
else if (window.sidebar) window.sidebar.addPanel(title, url, "") 
}

// Página Inicial
setHome = function(obj){
	if(document.all)
	{
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage('http://www.litoraldesantacatarina.com');
		return false;
	}
	return true;
}

function MM_findObj(n, d) { //v3.0
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function printPage() {
print(document); 
}


function CompartilheTwitter(url,msg){

	texto = msg.substr(0, (137));
	
	if(msg.length >140){
		texto = texto+'...';
	}

	//window.open("http://twitthis.com/twit?url="+encodeURIComponent(url)+"&title="+encodeURIComponent(texto),"sharer","toolbar=0,status=0,width=626,height=436");
	window.open("http://twitter.com/intent/tweet?source=webclient&text="+encodeURIComponent(texto)+" "+encodeURIComponent(url),"sharer","toolbar=0,status=0,width=626,height=436");
}
function CompartilheFacebook(url,msg){
	window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent(url)+"&t="+encodeURIComponent(msg),"sharer","toolbar=0,status=0,width=626,height=436");
}



