var r7_bar = {
	domain: 'r7.com',
	
	init: function(type,banner,css,target) {
		if(banner==null) banner=false;
		if(target==null) target=false;
		if(css==null) css=false;
		if(css==true) return r7_bar.css() + eval('r7_bar.type_'+type+'('+banner+','+target+')');
		if(css==false) return eval('r7_bar.type_'+type+'('+banner+','+target+')');
	},
	
	css: function() {
		html = '<style>';
		html += '.barra_r7 * {margin: 0; padding: 0;    outline: 0;font-family: "Trebuchet MS" !important;}';
		html += '.barra_r7 {font-size: 16px !important;background: #fff url(http://barra.'+r7_bar.domain+'/css/img/bg_menu.gif) bottom repeat-x; text-align: center;}';
		html += '.barra_r7 fieldset, .barra_r7 img {    border: 0;}';
		html += '.barra_r7 .clear {display: block;clear: both !important;height: 0px !important;line-height: 0;font-size: 0;}';
		html += '.barra_r7 .barra_r7_alinha {width: 960px; margin: 0 auto;}';
		html += '.barra_r7_menu .barra_r7_alinha{width: 660px;padding-top: 5px;}';
		html += '.barra_r7 .banner {clear: both;float: none;width: 728px;height: 90px;padding-top: 6px;padding-right: 11px;padding-left: 33px;margin: 0 auto 10px auto;background: url(http://barra.'+r7_bar.domain+'/css/img/publicidade.gif) no-repeat 14px bottom;}';
		html += '.barra_r7 h1 {float: left;width: 39px;height: 35px;background-image: url(http://barra.'+r7_bar.domain+'/css/img/logo_barra.gif);}';
		html += '.barra_r7 h1 a {display: block;width: 39px;height: 31px;    overflow: hidden;text-indent: -1000px;}';
		html += '.barra_r7 ul {float: left;margin: 0 auto;padding-left: 5px;}';
		html += '.barra_r7 ul li {display: inline;}';
		html += '.barra_r7 ul li a {float: left;padding: 8px 17px;color: #8d8d8d;font-weight: bold;letter-spacing: 0.01em;text-transform: uppercase;background: url(http://barra.'+r7_bar.domain+'/css/img/sep_menu.gif) right bottom no-repeat;text-decoration:none !important;}';
		html += '.barra_r7 ul li.item1 a { color: #000; }';
		html += '.barra_r7 ul li.item2 a { color: #c9168e; }';
		html += '.barra_r7 ul li.item3 a { color: #246d26; }';
		html += '.barra_r7 ul li.item4 a { color: #0071bd; }';
		html += '.barra_r7 ul li.item5 a { background: none; }';
		html += '.barra_r7 form {  float: right;width: 270px;padding-top: 5px;}';
		html += '.barra_r7 form legend { display: none; }';
		html += '.barra_r7 form label input {float: left;width: 187px;font-size: 13px !important;}';
		html += '.barra_r7 form input.botao {float: right;cursor: pointer;clear: none;width: 74px;height: 24px;padding: 0;border: 1px solid #000000;border-left-color: #c5daf3;border-top-color: #c5daf3;background: #59a0ca !important;color: #ffffff;font-size: 13px;font-weight: bold;text-align: center;text-transform: uppercase;}';
		html += '.barra_r7 form.areas select {width: 270px;}';
		html += '</style>';
		return html;
	},
	
	//Barra com busca
	type_1: function(banner,target) {
		attr_target = "";
		if(target == true){
			attr_target = "target='_parent'";
		}
		html = '';
        html += '<div class="barra_r7">';
        html += '    <div class="barra_r7_alinha">';
        if(banner) {
        html += '        <div class="banner"><img src="images/banner_full.jpg" alt="" /></div>';
        }
        html += '        <h1 title="Portal R7">';
        html += '            <a target="_blank" title="Portal R7" href="http://www.'+r7_bar.domain+'" >R7</a>';
        html += '        </h1>';
        html += '        <ul>';
        html += '            <li class="item1"><a target="_blank" title="Ir para a página de Notícias do Portal R7" href="http://noticias.'+r7_bar.domain+'">Notícias</a></li>';
        html += '            <li class="item2"><a target="_blank" title="Ir para a página de Entretenimento do Portal R7" href="http://entretenimento.'+r7_bar.domain+'">Entretenimento</a></li>';
        html += '            <li class="item3"><a target="_blank" title="Ir para a página de Esportes do Portal R7" href="http://esportes.'+r7_bar.domain+'">Esportes</a></li>';
        html += '            <li class="item4"><a target="_blank" title="Ir para a página de Vídeos do Portal R7" href="http://videos.'+r7_bar.domain+'">Vídeos</a></li>';
        html += '            <li class="item5"><a target="_blank" title="Ir para o site da Rede Record" href="http://rederecord.'+r7_bar.domain+'/">Rede Record</a></li>';
        html += '        </ul>';
        html += '        <form action="http://busca.'+r7_bar.domain+'/s" method="get">';
        html += '            <fieldset>';
        html += '                <legend>Buscar no R7</legend>';
        html += '                <label for="palavra_chave">';
        html += '                   <input type="text" name="q" class="palavra_chave" id="palavra_chave" accesskey="4" />';
        html += '                </label>';
        html += '                <input type="submit" value="Buscar" class="botao" />';
        html += '            </fieldset>';
        html += '        </form>';
        html += '        <span class="clear"><!----></span>';
        html += '    </div>';
        html += '</div>';
		return html;
	},
	
	//Barra somente com as editorias principáis
	type_2: function(banner,target) {
		attr_target = "";
		if(target == true){
			attr_target = "target='_parent'";
		}
		html = '';
        html += '<div class="barra_r7 barra_r7_menu">';
        html += '   <div class="barra_r7_alinha">';
        html += '        <h1 title="Portal R7">';
        html += '            <a href="http://www.'+r7_bar.domain+'" title="Portal R7">R7</a>';
        html += '        </h1>';
        html += '        <ul>';
        html += '            <li class="item1"><a '+attr_target+' title="Ir para a página de Notícias do Portal R7" href="http://noticias.'+r7_bar.domain+'">Notícias</a></li>';
        html += '            <li class="item2"><a '+attr_target+' title="Ir para a página de Entretenimento do Portal R7" href="http://entretenimento.'+r7_bar.domain+'">Entretenimento</a></li>';
        html += '            <li class="item3"><a '+attr_target+' title="Ir para a página de Esportes do Portal R7" href="http://esportes.'+r7_bar.domain+'">Esportes</a></li>';
        html += '            <li class="item4"><a '+attr_target+' title="Ir para a página de Vídeos do Portal R7" href="http://videos.'+r7_bar.domain+'">Vídeos</a></li>';
        html += '            <li class="item5"><a '+attr_target+' title="Ir para o site da Rede Record" href="http://rederecord.'+r7_bar.domain+'/">Rede Record</a></li>';
        html += '        </ul>';
        html += '        <span class="clear"><!----></span>';
        html += '    </div>';
        html += '</div>';
		return html;
	},
	
	//Barra com select box com as aréas do portal
	type_3: function(banner,target) {
		html = '';
        html += '<div class="barra_r7">';
        html += '   <div class="barra_r7_alinha">';
        if(banner) {
        html += '        <div class="banner"><img src="images/banner_full.jpg" alt="" /></div>';
        }
        html += '        <h1 title="Portal R7">';
        html += '            <a href="http://www.'+r7_bar.domain+'" title="Portal R7">R7</a>';
        html += '        </h1>';
        html += '        <ul>';
        html += '            <li class="item1"><a title="Ir para a página de Notícias do Portal R7"  href="http://noticias.'+r7_bar.domain+'">Notícias</a></li>';
        html += '            <li class="item2"><a title="Ir para a página de Entretenimento do Portal R7" href="http://entretenimento.'+r7_bar.domain+'">Entretenimento</a></li>';
        html += '            <li class="item3"><a title="Ir para a página de Esportes do Portal R7" href="http://esportes.'+r7_bar.domain+'">Esportes</a></li>';
        html += '            <li class="item4"><a title="Ir para a página de Vídeos do Portal R7" href="http://videos.'+r7_bar.domain+'">Vídeos</a></li>';
        html += '            <li class="item5"><a title="Ir para o site da Rede Record" href="http://rederecord.'+r7_bar.domain+'/">Rede Record</a></li>';
        html += '        </ul>';
        html += '        <form method="post" action="" class="areas">';
        html += '            <fieldset>';
        html += '                <legend>Áreas do Portal R7</legend>';
        html += '                <label for="areas">';
        html += '                   <select name="areas" id="areas" onchange="">';
        html += '                        <option>Todo R7</option>';
        html += '                        <option>Entretenimento</option>';
        html += '                        <option>- Agenda Cultural</option>';
        html += '                        <option>- Bate Papo</option>';
        html += '                        <option>- Cinema</option>';
        html += '                        <option>Notícias</option>';
        html += '                        <option>- Economia</option>';
        html += '                        <option>- Trânsito</option>';
        html += '                        <option>- Tecnologia e Ciência</option>';
        html += '                        <option>- Pergunte ao especilista</option>';
        html += '                    </select>';
        html += '                </label>';
        html += '            </fieldset>';
        html += '        </form>';
        html += '        <span class="clear"><!----></span>';
        html += '    </div>';
        html += '</div>';
        return html;
	},
	
	//Barra somente utilizado nos Blogs
	type_4: function(banner,target) {
		html = '';
		html += '<style>';
		html += '.barra_r7 * {margin: 0;padding: 0;    outline: 0;font-family: "Trebuchet MS" !important;}';
		html += '.barra_r7 {font-size: 16px !important;}';
		html += '.barra_r7 fieldset, .barra_r7 img { border: 0;}';
		html += '.barra_r7 .clear {display: block;clear: both !important;height: 0px !important;line-height: 0;font-size: 0;}';
		html += '.barra_r7 h1 {float: left;width: 39px;height: 35px;background-image: url(http://barra.'+r7_bar.domain+'/css/img/logo_barra.gif);}';
		html += '.barra_r7 h1 a {display: block;width: 39px;height: 31px; overflow: hidden;text-indent: -1000px;}';
		html += '.barra_r7 ul {float: left;margin: 0 auto;padding-left: 15px; height:43px;}';
		html += '.barra_r7 ul li {display: inline;}';
		html += '.barra_r7 ul li a {font-size: 16px !important; float: left;padding: 8px 17px;color: #8d8d8d;font-weight: bold;letter-spacing: 0.01em;text-transform: uppercase;background: url(http://barra.'+r7_bar.domain+'/css/img/sep_menu.gif) right bottom no-repeat;}';
		html += '.barra_r7 ul li.item1 a { color: #000 !important;}';
		html += '.barra_r7 ul li.item2 a { color: #c9168e !important; }';
		html += '.barra_r7 ul li.item3 a { color: #246d26 !important; }';
		html += '.barra_r7 ul li.item4 a { color: #0071bd !important; }';
		html += '.barra_r7 ul li.item5 a { color: #8D8D8D !important; background: none; }';
		html += '.barra_r7 form {  float: right;width: 270px;padding-top: 5px;}';
		html += '.barra_r7 form legend { display: none; }';
		html += '.barra_r7 form label input {float: left;width: 187px;font-size: 13px !important; margin-top: 3px;}';
		html += '.barra_r7 form input.botao {float: right;cursor: pointer;clear: none;width: 74px;height: 24px;padding: 0;border: 1px solid #000000;border-left-color: #c5daf3;border-top-color: #c5daf3;background: #59a0ca !important;color: #ffffff;font-size: 13px;font-weight: bold;text-align: center;text-transform: uppercase;}';
		html += '</style>';
		html += '<div class="barra_r7">';
        html += '  <h1 title="Portal R7">';
        html += '     <a href="http://www.'+r7_bar.domain+'" title="Portal R7">R7</a>';
        html += '  </h1>';
		html += '  <ul>';
		html += '    <li class="item1"><a href="http://noticias.'+r7_bar.domain+'" >NOT&Iacute;CIAS</a></li>';
		html += '    <li class="item2"><a href="http://entretenimento.'+r7_bar.domain+'">ENTRETENIMENTO</a></li>';
		html += '    <li class="item3"><a href="http://esportes.'+r7_bar.domain+'">ESPORTES</a></li>';
		html += '    <li class="item4"><a href="http://videos.'+r7_bar.domain+'">V&Iacute;DEOS</a></li>';
		html += '    <li class="item5"><a href="http://rederecord.'+r7_bar.domain+'/">REDE RECORD</a></li>';
		html += '  </ul>';		
        html += '  <form action="http://busca.'+r7_bar.domain+'/s" method="get">';
        html += '      <fieldset>';
        html += '           <legend>Buscar no R7</legend>';
        html += '           <label for="palavra_chave">';
        html += '           <input type="text" name="q" class="palavra_chave" id="palavra_chave" accesskey="4" />';
        html += '           </label>';
        html += '           <input type="submit" value="Buscar" class="botao" />';
        html += '      </fieldset>';
        html += '  </form>';
        html += '  <span class="clear"><!----></span>';
		html += '</div>';
		return html;
	},
	
	_get_domain: function() {
		href = window.location.href;
		pattern = new RegExp("http://(.*?)/");
		return pattern.exec(href)[1];
	}
}

var url = r7_bar._get_domain();

if(url == "blogs."+r7_bar.domain) {
	document.write(r7_bar.init(4,false,false,false));
} else if(url == "busca."+r7_bar.domain ) {
	document.write(r7_bar.init(2,false,true,false));
} else if(url == "www.recordnewstv.com.br" ) {
	document.write(r7_bar.init(2,false,true,true));
} else {
	document.write(r7_bar.init(1,false,true,false));
}

