/**
* Copyright (c) 2009 Sebastião Ricardo Costa Rodrigues (tiaoricardo@gmail.com)
* Date 2010-01-02
*
* @file /js/application.initialize.js
*
* @dependence /js/jquery.js 					=> jQuery 1.2 [packed]
* @dependence /js/jquery.form.pack.js		=> jQuery Form Plugin [packed]
* @dependence /js/application.ajax.js		=> AppAjax
* @dependence /js/application.form.js		=> AppForm
* @dependence /js/application.utils.js		=> AppUtils
* @dependence /js/application.picplayer.js	=> AppPicPlayer
* @dependence /js/application.rating.js		=> AppRating
* @dependence /js/application.noticias.js	=> AppNoticia
*
*/

$(document).ready(function() {

	AppUtils.bindAnchors();		
	AppUtils.bindAddFavList("#addToFav","GP1 - O 1º Grande Portal de Notícias do Piauí","http://www.gp1.com.br");			
	AppUtils.toggleFontSize(".aum-fonte",".dim-fonte",".texto");
	
	if (PAGE == "NOTICIA" || PAGE == "BLOG_POST") {
	
		AppForm.bind('#commentform');
		

		AppNoticia.bindOptionsBar(".aum-fonte",".dim-fonte",".texto");	
		
		AppForm.loadCities({
			source : "select[@name=estado]",
			target : "select[@name=cidade]",
			selected : null		
		});
		
		$(".container-image a").lightBox({
			imageLoading: BASE_URL+"imgs/lightbox-loading.gif",
			imageBtnClose: BASE_URL+"imgs/lightbox-closelabel.gif",
			imageBtnPrev: BASE_URL+"imgs/lightbox-prevlabel.png",
			imageBtnNext: BASE_URL+"imgs/lightbox-nextlabel.png",
			txtImage: "Imagem",
			txtOf: "de"
		});
			
	}
	
	if (PAGE == "FALECONOSCO") {
		
		AppForm.bind('#contactform');		
		
		AppForm.loadCities({
			source : "select[@name=estado]",
			target : "select[@name=cidade]",
			selected : null		
		});
	
	}
	
	if (PAGE == "LISTA_NOTICIA") {
		
		$('select[@name=editoria]').bind("change",function() {window.top.location = "/noticias/"+$(this).val()});
	
	}
	
	if (PAGE == "HOME") {
			
		AppPicPlayer.initial = 4;		
		AppPicPlayer.item = 4;		
		AppPicPlayer.length = $(AppPicPlayer.container).length + 3;		
		AppPicPlayer.init();
			
	}
		
});