/* Update log:
(C) www.dhtmlgoodies.com, September 2005
Version 1.2, November 8th - 2005 - Added <iframe> background in IE
Version 1.3, November 12th - 2005 - Fixed top bar position in Opera 7
Version 1.4, December 28th - 2005 - Support for Spanish and Portuguese
Version 1.5, January 18th - 2006 - Fixed problem with next-previous buttons after a month has been selected from dropdown
Version 1.6, February 22nd - 2006 - Added variable which holds the path to images.
Format todays date at the bottom by use of the todayStringFormat variable
Pick todays date by clicking on todays date at the bottom of the calendar
Version 2.0 May, 25th - 2006 - Added support for time(hour and minutes) and changing year and hour when holding mouse over + and - options. (i.e. instead of click)
Version 2.1 July, 2nd - 2006 - Added support for more date formats(example: d.m.yyyy, i.e. one letter day and month).
*/
var languageCode = 'pt-br'; // Possible values: en,ge,no,nl,es,pt-br,fr
var calendar_display_time = true;
var todayStringFormat = '[todayString] [UCFdayString]. [day]. [monthString] [year]';
var pathToImages = '../image/calendar/'; // Relative to your HTML file
var speedOfSelectBoxSliding = 200; // Milliseconds between changing year and hour when holding mouse over "-" and "+" - lower value = faster
var intervalSelectBox_minutes = 5; // Minute select box - interval between each option (5 = default)
var calendar_offsetTop = 0; // Offset - calendar placement - You probably have to modify this value if you're not using a strict doctype
var calendar_offsetLeft = 0; // Offset - calendar placement - You probably have to modify this value if you're not using a strict doctype
var calendarDiv = false;
var MSIE = false;
var Opera = false;
if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0)MSIE=true;
if(navigator.userAgent.indexOf('Opera')>=0)Opera=true;
switch(languageCode){
case "en": /* English */
var monthArray = ['January','February','March','April','May','June','July','August','September','October','November','December'];
var monthArrayShort = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var dayArray = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];
var weekString = 'Week';
var todayString = '';
break;
case "ge": /* German */
var monthArray = ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'];
var monthArrayShort = ['Jan','Feb','Mar','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'];
var dayArray = ['Mon','Die','Mit','Don','Fre','Sam','Son'];
var weekString = 'Woche';
var todayString = 'Heute';
break;
case "no": /* Norwegian */
var monthArray = ['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember'];
var monthArrayShort = ['Jan','Feb','Mar','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Des'];
var dayArray = ['Man','Tir','Ons','Tor','Fre','L&oslash;r','S&oslash;n'];
var weekString = 'Uke';
var todayString = 'Dagen i dag er';
break;
case "nl": /* Dutch */
var monthArray = ['Januari','Februari','Maart','April','Mei','Juni','Juli','Augustus','September','Oktober','November','December'];
var monthArrayShort = ['Jan','Feb','Mar','Apr','Mei','Jun','Jul','Aug','Sep','Okt','Nov','Dec'];
var dayArray = ['Ma','Di','Wo','Do','Vr','Za','Zo'];
var weekString = 'Week';
var todayString = 'Vandaag';
break;
case "es": /* Spanish */
var monthArray = ['Enero','Febrero','Marzo','April','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'];
var monthArrayShort =['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'];
var dayArray = ['Lun','Mar','Mie','Jue','Vie','Sab','Dom'];
var weekString = 'Semana';
var todayString = 'Hoy es';
break;
case "pt-br": /* Brazilian portuguese (pt-br) */
var monthArray = ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'];
var monthArrayShort = ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'];
var dayArray = ['Seg','Ter','Qua','Qui','Sex','S&aacute;b','Dom'];
var weekString = 'Sem.';
var todayString = 'Hoje &eacute;';
break;
case "fr": /* French */
var monthArray = ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'];
var monthArrayShort = ['Jan','Fev','Mar','Avr','Mai','Jun','Jul','Aou','Sep','Oct','Nov','Dec'];
var dayArray = ['Lun','Mar','Mer','Jeu','Ven','Sam','Dim'];
var weekString = 'Sem';
var todayString = "Aujourd'hui";
break;
case "da": /*Danish*/
var monthArray = ['januar','februar','marts','april','maj','juni','juli','august','september','oktober','november','december'];
var monthArrayShort = ['jan','feb','mar','apr','maj','jun','jul','aug','sep','okt','nov','dec'];
var dayArray = ['man','tirs','ons','tors','fre','l&oslash;r','s&oslash;n'];
var weekString = 'Uge';
var todayString = 'I dag er den';
break;
case "hu": /* Hungarian - Remember to use UTF-8 encoding, i.e. the <meta> tag */
var monthArray = ['JanuÃ¡r','FebruÃ¡r','MÃ¡rcius','Ã?prilis','MÃ¡jus','JÃºnius','JÃºlius','Augusztus','Szeptember','OktÃ³ber','November','December'];
var monthArrayShort = ['Jan','Feb','MÃ¡rc','Ã?pr','MÃ¡j','JÃºn','JÃºl','Aug','Szep','Okt','Nov','Dec'];
var dayArray = ['HÃ©','Ke','Sze','Cs','PÃ©','Szo','Vas'];
var weekString = 'HÃ©t';
var todayString = 'Mai nap';
break;
case "it": /* Italian*/
var monthArray = ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'];
var monthArrayShort = ['Gen','Feb','Mar','Apr','Mag','Giu','Lugl','Ago','Set','Ott','Nov','Dic'];
var dayArray = ['Lun',';Mar','Mer','Gio','Ven','Sab','Dom'];
var weekString = 'Settimana';
var todayString = 'Oggi &egrave; il';
break;
case "sv": /* Swedish */
var monthArray = ['Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December'];
var monthArrayShort = ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'];
var dayArray = ['M&aring;n','Tis','Ons','Tor','Fre','L&ouml;r','S&ouml;n'];
var weekString = 'Vecka';
var todayString = 'Idag &auml;r det den';
break;
}
var daysInMonthArray = [31,28,31,30,31,30,31,31,30,31,30,31];
var currentMonth;
var currentYear;
var currentHour;
var currentMinute;
var calendarContentDiv;
var returnDateTo;
var returnFormat;
var activeSelectBoxMonth;
var activeSelectBoxYear;
var activeSelectBoxHour;
var activeSelectBoxMinute;
var iframeObj = false;
var iframeObj2 =false;
function EIS_FIX_EI1(where2fixit)
{
if(!iframeObj2)return;
iframeObj2.style.display = 'block';
iframeObj2.style.height =document.getElementById(where2fixit).offsetHeight+1;
iframeObj2.style.width=document.getElementById(where2fixit).offsetWidth;
iframeObj2.style.left=getleftPos(document.getElementById(where2fixit))+1-calendar_offsetLeft - 30;
iframeObj2.style.top=getTopPos(document.getElementById(where2fixit))-document.getElementById(where2fixit).offsetHeight-calendar_offsetTop;
}
function EIS_Hide_Frame()
{ if(iframeObj2)iframeObj2.style.display = 'none';}
var returnDateToYear;
var returnDateToMonth;
var returnDateToDay;
var returnDateToHour;
var returnDateToMinute;
var inputYear;
var inputMonth;
var inputDay;
var inputHour;
var inputMinute;
var calendarDisplayTime = false;
var selectBoxHighlightColor = '#D60808'; // Highlight color of select boxes
var selectBoxRolloverBgColor = '#E2EBED'; // Background color on drop down lists(rollover)
var selectBoxMovementInProgress = false;
var activeSelectBox = false;
function cancelCalendarEvent()
{
return false;
}
function isLeapYear(inputYear)
{
if(inputYear%400==0||(inputYear%4==0&&inputYear%100!=0)) return true;
return false;
}
var activeSelectBoxMonth = false;
var activeSelectBoxDirection = false;
function highlightMonthYear()
{
if(activeSelectBoxMonth)activeSelectBoxMonth.className='';
activeSelectBox = this;
if(this.className=='monthYearActive'){
this.className='';
}else{
this.className = 'monthYearActive';
activeSelectBoxMonth = this;
}
if(this.innerHTML.indexOf('-')>=0 || this.innerHTML.indexOf('+')>=0){
if(this.className=='monthYearActive')
selectBoxMovementInProgress = true;
else
selectBoxMovementInProgress = false;
if(this.innerHTML.indexOf('-')>=0)activeSelectBoxDirection = -1; else activeSelectBoxDirection = 1;
}else selectBoxMovementInProgress = false;
}
function showMonthDropDown()
{
if(document.getElementById('monthDropDown').style.display=='block'){
document.getElementById('monthDropDown').style.display='none';
EIS_Hide_Frame();
}else{
document.getElementById('monthDropDown').style.display='block';
document.getElementById('yearDropDown').style.display='none';
document.getElementById('hourDropDown').style.display='none';
document.getElementById('minuteDropDown').style.display='none';
if (MSIE)
{ EIS_FIX_EI1('monthDropDown')}
}
}
function showYearDropDown()
{
if(document.getElementById('yearDropDown').style.display=='block'){
document.getElementById('yearDropDown').style.display='none';
EIS_Hide_Frame();
}else{
document.getElementById('yearDropDown').style.display='block';
document.getElementById('monthDropDown').style.display='none';
document.getElementById('hourDropDown').style.display='none';
document.getElementById('minuteDropDown').style.display='none';
if (MSIE)
{ EIS_FIX_EI1('yearDropDown')}
}
}
function showHourDropDown()
{
if(document.getElementById('hourDropDown').style.display=='block'){
document.getElementById('hourDropDown').style.display='none';
EIS_Hide_Frame();
}else{
document.getElementById('hourDropDown').style.display='block';
document.getElementById('monthDropDown').style.display='none';
document.getElementById('yearDropDown').style.display='none';
document.getElementById('minuteDropDown').style.display='none';
if (MSIE)
{ EIS_FIX_EI1('hourDropDown')}
}
}
function showMinuteDropDown()
{
if(document.getElementById('minuteDropDown').style.display=='block'){
document.getElementById('minuteDropDown').style.display='none';
EIS_Hide_Frame();
}else{
document.getElementById('minuteDropDown').style.display='block';
document.getElementById('monthDropDown').style.display='none';
document.getElementById('yearDropDown').style.display='none';
document.getElementById('hourDropDown').style.display='none';
if (MSIE)
{ EIS_FIX_EI1('minuteDropDown')}
}
}
function selectMonth()
{
document.getElementById('calendar_month_txt').innerHTML = this.innerHTML
currentMonth = this.id.replace(/[^\d]/g,'');
document.getElementById('monthDropDown').style.display='none';
EIS_Hide_Frame();
for(var no=0;no<monthArray.length;no++){
document.getElementById('monthDiv_'+no).style.color='';
}
this.style.color = selectBoxHighlightColor;
activeSelectBoxMonth = this;
writeCalendarContent();
}
function selectHour()
{
document.getElementById('calendar_hour_txt').innerHTML = this.innerHTML
currentHour = this.innerHTML.replace(/[^\d]/g,'');
document.getElementById('hourDropDown').style.display='none';
EIS_Hide_Frame();
if(activeSelectBoxHour){
activeSelectBoxHour.style.color='';
}
activeSelectBoxHour=this;
this.style.color = selectBoxHighlightColor;
}
function selectMinute()
{
document.getElementById('calendar_minute_txt').innerHTML = this.innerHTML
currentMinute = this.innerHTML.replace(/[^\d]/g,'');
document.getElementById('minuteDropDown').style.display='none';
EIS_Hide_Frame();
if(activeSelectBoxMinute){
activeSelectBoxMinute.style.color='';
}
activeSelectBoxMinute=this;
this.style.color = selectBoxHighlightColor;
}
function selectYear()
{
document.getElementById('calendar_year_txt').innerHTML = this.innerHTML
currentYear = this.innerHTML.replace(/[^\d]/g,'');
document.getElementById('yearDropDown').style.display='none';
EIS_Hide_Frame();
if(activeSelectBoxYear){
activeSelectBoxYear.style.color='';
}
activeSelectBoxYear=this;
this.style.color = selectBoxHighlightColor;
writeCalendarContent();
}
function switchMonth()
{
if(this.src.indexOf('left')>=0){
currentMonth=currentMonth-1;;
if(currentMonth<0){
currentMonth=11;
currentYear=currentYear-1;
}
}else{
currentMonth=currentMonth+1;;
if(currentMonth>11){
currentMonth=0;
currentYear=currentYear/1+1;
}
}
writeCalendarContent();
}
function createMonthDiv(){
var div = document.createElement('DIV');
div.className='monthYearPicker';
div.id = 'monthPicker';
for(var no=0;no<monthArray.length;no++){
var subDiv = document.createElement('DIV');
subDiv.innerHTML = monthArray[no];
subDiv.onmouseover = highlightMonthYear;
subDiv.onmouseout = highlightMonthYear;
subDiv.onclick = selectMonth;
subDiv.id = 'monthDiv_' + no;
subDiv.style.width = '56px';
subDiv.onselectstart = cancelCalendarEvent;
div.appendChild(subDiv);
if(currentMonth && currentMonth==no){
subDiv.style.color = selectBoxHighlightColor;
activeSelectBoxMonth = subDiv;
}
}
return div;
}
function changeSelectBoxYear(e,inputObj)
{
if(!inputObj)inputObj =this;
var yearItems = inputObj.parentNode.getElementsByTagName('DIV');
if(inputObj.innerHTML.indexOf('-')>=0){
var startYear = yearItems[1].innerHTML/1 -1;
if(activeSelectBoxYear){
activeSelectBoxYear.style.color='';
}
}else{
var startYear = yearItems[1].innerHTML/1 +1;
if(activeSelectBoxYear){
activeSelectBoxYear.style.color='';
}
}
for(var no=1;no<yearItems.length-1;no++){
yearItems[no].innerHTML = startYear+no-1;
yearItems[no].id = 'yearDiv' + (startYear/1+no/1-1);
}
if(activeSelectBoxYear){
activeSelectBoxYear.style.color='';
if(document.getElementById('yearDiv'+currentYear)){
activeSelectBoxYear = document.getElementById('yearDiv'+currentYear);
activeSelectBoxYear.style.color=selectBoxHighlightColor;;
}
}
}
function changeSelectBoxHour(e,inputObj)
{
if(!inputObj)inputObj = this;
var hourItems = inputObj.parentNode.getElementsByTagName('DIV');
if(inputObj.innerHTML.indexOf('-')>=0){
var startHour = hourItems[1].innerHTML/1 -1;
if(startHour<0)startHour=0;
if(activeSelectBoxHour){
activeSelectBoxHour.style.color='';
}
}else{
var startHour = hourItems[1].innerHTML/1 +1;
if(startHour>14)startHour = 14;
if(activeSelectBoxHour){
activeSelectBoxHour.style.color='';
}
}
var prefix = '';
for(var no=1;no<hourItems.length-1;no++){
if((startHour/1 + no/1) < 11)prefix = '0'; else prefix = '';
hourItems[no].innerHTML = prefix + (startHour+no-1);
hourItems[no].id = 'hourDiv' + (startHour/1+no/1-1);
}
if(activeSelectBoxHour){
activeSelectBoxHour.style.color='';
if(document.getElementById('hourDiv'+currentHour)){
activeSelectBoxHour = document.getElementById('hourDiv'+currentHour);
activeSelectBoxHour.style.color=selectBoxHighlightColor;;
}
}
}
function updateYearDiv()
{
var div = document.getElementById('yearDropDown');
var yearItems = div.getElementsByTagName('DIV');
for(var no=1;no<yearItems.length-1;no++){
yearItems[no].innerHTML = currentYear/1 -6 + no;
if(currentYear==(currentYear/1 -6 + no)){
yearItems[no].style.color = selectBoxHighlightColor;
activeSelectBoxYear = yearItems[no];
}else{
yearItems[no].style.color = '';
}
}
}
function updateMonthDiv()
{
for(no=0;no<12;no++){
document.getElementById('monthDiv_' + no).style.color = '';
}
document.getElementById('monthDiv_' + currentMonth).style.color = selectBoxHighlightColor;
activeSelectBoxMonth = document.getElementById('monthDiv_' + currentMonth);
}
function updateHourDiv()
{
var div = document.getElementById('hourDropDown');
var hourItems = div.getElementsByTagName('DIV');
var addHours = 0;
if((currentHour/1 -6 + 1)<0){
addHours = (currentHour/1 -6 + 1)*-1;
}
for(var no=1;no<hourItems.length-1;no++){
var prefix='';
if((currentHour/1 -6 + no + addHours) < 10)prefix='0';
hourItems[no].innerHTML = prefix + (currentHour/1 -6 + no + addHours);
if(currentHour==(currentHour/1 -6 + no)){
hourItems[no].style.color = selectBoxHighlightColor;
activeSelectBoxHour = hourItems[no];
}else{
hourItems[no].style.color = '';
}
}
}
function updateMinuteDiv()
{
for(no=0;no<60;no+=intervalSelectBox_minutes){
var prefix = '';
if(no<10)prefix = '0';
document.getElementById('minuteDiv_' + prefix + no).style.color = '';
}
if(document.getElementById('minuteDiv_' + currentMinute)){
document.getElementById('minuteDiv_' + currentMinute).style.color = selectBoxHighlightColor;
activeSelectBoxMinute = document.getElementById('minuteDiv_' + currentMinute);
}
}
function createYearDiv()
{
if(!document.getElementById('yearDropDown')){
var div = document.createElement('DIV');
div.className='monthYearPicker';
}else{
var div = document.getElementById('yearDropDown');
var subDivs = div.getElementsByTagName('DIV');
for(var no=0;no<subDivs.length;no++){
subDivs[no].parentNode.removeChild(subDivs[no]);
}
}
var d = new Date();
if(currentYear){
d.setFullYear(currentYear);
}
var startYear = d.getFullYear()/1 - 5;
var subDiv = document.createElement('DIV');
subDiv.innerHTML = '&nbsp;&nbsp;- ';
subDiv.onclick = changeSelectBoxYear;
subDiv.onmouseover = highlightMonthYear;
subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;};
subDiv.onselectstart = cancelCalendarEvent;
div.appendChild(subDiv);
for(var no=startYear;no<(startYear+10);no++){
var subDiv = document.createElement('DIV');
subDiv.innerHTML = no;
subDiv.onmouseover = highlightMonthYear;
subDiv.onmouseout = highlightMonthYear;
subDiv.onclick = selectYear;
subDiv.id = 'yearDiv' + no;
subDiv.onselectstart = cancelCalendarEvent;
div.appendChild(subDiv);
if(currentYear && currentYear==no){
subDiv.style.color = selectBoxHighlightColor;
activeSelectBoxYear = subDiv;
}
}
var subDiv = document.createElement('DIV');
subDiv.innerHTML = '&nbsp;&nbsp;+ ';
subDiv.onclick = changeSelectBoxYear;
subDiv.onmouseover = highlightMonthYear;
subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;};
subDiv.onselectstart = cancelCalendarEvent;
div.appendChild(subDiv);
return div;
}
/* This function creates the hour div at the bottom bar */
function slideCalendarSelectBox()
{
if(selectBoxMovementInProgress){
if(activeSelectBox.parentNode.id=='hourDropDown'){
changeSelectBoxHour(false,activeSelectBox);
}
if(activeSelectBox.parentNode.id=='yearDropDown'){
changeSelectBoxYear(false,activeSelectBox);
}
}
setTimeout('slideCalendarSelectBox()',speedOfSelectBoxSliding);
}
function createHourDiv()
{
if(!document.getElementById('hourDropDown')){
var div = document.createElement('DIV');
div.className='monthYearPicker';
}else{
var div = document.getElementById('hourDropDown');
var subDivs = div.getElementsByTagName('DIV');
for(var no=0;no<subDivs.length;no++){
subDivs[no].parentNode.removeChild(subDivs[no]);
}
}
if(!currentHour)currentHour=0;
var startHour = currentHour/1;
if(startHour>14)startHour=14;
var subDiv = document.createElement('DIV');
subDiv.innerHTML = '&nbsp;&nbsp;- ';
subDiv.onclick = changeSelectBoxHour;
subDiv.onmouseover = highlightMonthYear;
subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;};
subDiv.onselectstart = cancelCalendarEvent;
div.appendChild(subDiv);
for(var no=startHour;no<startHour+10;no++){
var prefix = '';
if(no/1<10)prefix='0';
var subDiv = document.createElement('DIV');
subDiv.innerHTML = prefix + no;
subDiv.onmouseover = highlightMonthYear;
subDiv.onmouseout = highlightMonthYear;
subDiv.onclick = selectHour;
subDiv.id = 'hourDiv' + no;
subDiv.onselectstart = cancelCalendarEvent;
div.appendChild(subDiv);
if(currentYear && currentYear==no){
subDiv.style.color = selectBoxHighlightColor;
activeSelectBoxYear = subDiv;
}
}
var subDiv = document.createElement('DIV');
subDiv.innerHTML = '&nbsp;&nbsp;+ ';
subDiv.onclick = changeSelectBoxHour;
subDiv.onmouseover = highlightMonthYear;
subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;};
subDiv.onselectstart = cancelCalendarEvent;
div.appendChild(subDiv);
return div;
}
/* This function creates the minute div at the bottom bar */
function createMinuteDiv()
{
if(!document.getElementById('minuteDropDown')){
var div = document.createElement('DIV');
div.className='monthYearPicker';
}else{
var div = document.getElementById('minuteDropDown');
var subDivs = div.getElementsByTagName('DIV');
for(var no=0;no<subDivs.length;no++){
subDivs[no].parentNode.removeChild(subDivs[no]);
}
}
var startMinute = 0;
var prefix = '';
for(var no=startMinute;no<60;no+=intervalSelectBox_minutes){
if(no<10)prefix='0'; else prefix = '';
var subDiv = document.createElement('DIV');
subDiv.innerHTML = prefix + no;
subDiv.onmouseover = highlightMonthYear;
subDiv.onmouseout = highlightMonthYear;
subDiv.onclick = selectMinute;
subDiv.id = 'minuteDiv_' + prefix + no;
subDiv.onselectstart = cancelCalendarEvent;
div.appendChild(subDiv);
if(currentYear && currentYear==no){
subDiv.style.color = selectBoxHighlightColor;
activeSelectBoxYear = subDiv;
}
}
return div;
}
function highlightSelect()
{
if(this.className=='selectBoxTime'){
this.className = 'selectBoxTimeOver';
this.getElementsByTagName('IMG')[0].src = pathToImages + 'down_time_over.gif';
}else if(this.className=='selectBoxTimeOver'){
this.className = 'selectBoxTime';
this.getElementsByTagName('IMG')[0].src = pathToImages + 'down_time.gif';
}
if(this.className=='selectBox'){
this.className = 'selectBoxOver';
this.getElementsByTagName('IMG')[0].src = pathToImages + 'down_over.gif';
}else if(this.className=='selectBoxOver'){
this.className = 'selectBox';
this.getElementsByTagName('IMG')[0].src = pathToImages + 'down.gif';
}
}
function highlightArrow()
{
if(this.src.indexOf('over')>=0){
if(this.src.indexOf('left')>=0)this.src = pathToImages + 'left.gif';
if(this.src.indexOf('right')>=0)this.src = pathToImages + 'right.gif';
}else{
if(this.src.indexOf('left')>=0)this.src = pathToImages + 'left_over.gif';
if(this.src.indexOf('right')>=0)this.src = pathToImages + 'right_over.gif';
}
}
function highlightClose()
{
if(this.src.indexOf('over')>=0){
this.src = pathToImages + 'close.gif';
}else{
this.src = pathToImages + 'close_over.gif';
}
}
function closeCalendar(){
document.getElementById('yearDropDown').style.display='none';
document.getElementById('monthDropDown').style.display='none';
document.getElementById('hourDropDown').style.display='none';
document.getElementById('minuteDropDown').style.display='none';
calendarDiv.style.display='none';
if(iframeObj){
iframeObj.style.display='none';
EIS_Hide_Frame();}
if(activeSelectBoxMonth)activeSelectBoxMonth.className='';
if(activeSelectBoxYear)activeSelectBoxYear.className='';
}
function writeTopBar()
{
var topBar = document.createElement('DIV');
topBar.className = 'topBar';
topBar.id = 'topBar';
calendarDiv.appendChild(topBar);
var leftDiv = document.createElement('DIV');
leftDiv.style.marginRight = '1px';
var img = document.createElement('IMG');
img.src = pathToImages + 'left.gif';
img.onmouseover = highlightArrow;
img.onclick = switchMonth;
img.onmouseout = highlightArrow;
leftDiv.appendChild(img);
topBar.appendChild(leftDiv);
if(Opera)leftDiv.style.width = '16px';
var rightDiv = document.createElement('DIV');
rightDiv.style.marginRight = '1px';
var img = document.createElement('IMG');
img.src = pathToImages + 'right.gif';
img.onclick = switchMonth;
img.onmouseover = highlightArrow;
img.onmouseout = highlightArrow;
rightDiv.appendChild(img);
if(Opera)rightDiv.style.width = '16px';
topBar.appendChild(rightDiv);
var monthDiv = document.createElement('DIV');
monthDiv.id = 'monthSelect';
monthDiv.onmouseover = highlightSelect;
monthDiv.onmouseout = highlightSelect;
monthDiv.onclick = showMonthDropDown;
var span = document.createElement('SPAN');
span.innerHTML = monthArray[currentMonth];
span.id = 'calendar_month_txt';
monthDiv.appendChild(span);
var img = document.createElement('IMG');
img.src = pathToImages + 'down.gif';
img.style.position = 'absolute';
img.style.right = '0px';
monthDiv.appendChild(img);
monthDiv.className = 'selectBox';
if(Opera){
img.style.cssText = 'float:right;position:relative';
img.style.position = 'relative';
img.style.styleFloat = 'right';
}
topBar.appendChild(monthDiv);
var monthPicker = createMonthDiv();
monthPicker.style.left = '37px';
monthPicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px';
monthPicker.style.width ='60px';
monthPicker.id = 'monthDropDown';
calendarDiv.appendChild(monthPicker);
var yearDiv = document.createElement('DIV');
yearDiv.onmouseover = highlightSelect;
yearDiv.onmouseout = highlightSelect;
yearDiv.onclick = showYearDropDown;
var span = document.createElement('SPAN');
span.innerHTML = currentYear;
span.id = 'calendar_year_txt';
yearDiv.appendChild(span);
topBar.appendChild(yearDiv);
var img = document.createElement('IMG');
img.src = pathToImages + 'down.gif';
yearDiv.appendChild(img);
yearDiv.className = 'selectBox';
if(Opera){
yearDiv.style.width = '50px';
img.style.cssText = 'float:right';
img.style.position = 'relative';
img.style.styleFloat = 'right';
}
var yearPicker = createYearDiv();
yearPicker.style.left = '113px';
yearPicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px';
yearPicker.style.width = '35px';
yearPicker.id = 'yearDropDown';
calendarDiv.appendChild(yearPicker);
var img = document.createElement('IMG');
img.src = pathToImages + 'close.gif';
img.style.styleFloat = 'right';
img.onmouseover = highlightClose;
img.onmouseout = highlightClose;
img.onclick = closeCalendar;
topBar.appendChild(img);
if(!document.all){
img.style.position = 'absolute';
img.style.right = '2px';
}
}
function writeCalendarContent()
{
var calendarContentDivExists = true;
if(!calendarContentDiv){
calendarContentDiv = document.createElement('DIV');
calendarDiv.appendChild(calendarContentDiv);
calendarContentDivExists = false;
}
currentMonth = currentMonth/1;
var d = new Date();
d.setFullYear(currentYear);
d.setDate(1);
d.setMonth(currentMonth);
var dayStartOfMonth = d.getDay();
if(dayStartOfMonth==0)dayStartOfMonth=7;
dayStartOfMonth--;
document.getElementById('calendar_year_txt').innerHTML = currentYear;
document.getElementById('calendar_month_txt').innerHTML = monthArray[currentMonth];
document.getElementById('calendar_hour_txt').innerHTML = currentHour;
document.getElementById('calendar_minute_txt').innerHTML = currentMinute;
var existingTable = calendarContentDiv.getElementsByTagName('TABLE');
if(existingTable.length>0){
calendarContentDiv.removeChild(existingTable[0]);
}
var calTable = document.createElement('TABLE');
calTable.width = '100%';
calTable.cellSpacing = '0';
calendarContentDiv.appendChild(calTable);
var calTBody = document.createElement('TBODY');
calTable.appendChild(calTBody);
var row = calTBody.insertRow(-1);
row.className = 'calendar_week_row';
var cell = row.insertCell(-1);
cell.innerHTML = weekString;
cell.className = 'calendar_week_column';
cell.style.backgroundColor = selectBoxRolloverBgColor;
for(var no=0;no<dayArray.length;no++){
var cell = row.insertCell(-1);
cell.innerHTML = dayArray[no];
}
var row = calTBody.insertRow(-1);
var cell = row.insertCell(-1);
cell.className = 'calendar_week_column';
cell.style.backgroundColor = selectBoxRolloverBgColor;
var week = getWeek(currentYear,currentMonth,1);
cell.innerHTML = week; // Week
for(var no=0;no<dayStartOfMonth;no++){
var cell = row.insertCell(-1);
cell.innerHTML = '&nbsp;';
}
var colCounter = dayStartOfMonth;
var daysInMonth = daysInMonthArray[currentMonth];
if(daysInMonth==28){
if(isLeapYear(currentYear))daysInMonth=29;
}
for(var no=1;no<=daysInMonth;no++){
d.setDate(no-1);
if(colCounter>0 && colCounter%7==0){
var row = calTBody.insertRow(-1);
var cell = row.insertCell(-1);
cell.className = 'calendar_week_column';
var week = getWeek(currentYear,currentMonth,no);
cell.innerHTML = week; // Week
cell.style.backgroundColor = selectBoxRolloverBgColor;
}
var cell = row.insertCell(-1);
if(currentYear==inputYear && currentMonth == inputMonth && no==inputDay){
cell.className='activeDay';
}
cell.innerHTML = no;
cell.onclick = pickDate;
colCounter++;
}
if(!document.all){
if(calendarContentDiv.offsetHeight)
document.getElementById('topBar').style.top = calendarContentDiv.offsetHeight + document.getElementById('timeBar').offsetHeight + document.getElementById('topBar').offsetHeight -1 + 'px';
else{
document.getElementById('topBar').style.top = '';
document.getElementById('topBar').style.bottom = '0px';
}
}
if(iframeObj){
if(!calendarContentDivExists)setTimeout('resizeIframe()',350);else setTimeout('resizeIframe()',10);
}
}
function resizeIframe()
{
iframeObj.style.width = calendarDiv.offsetWidth + 'px';
iframeObj.style.height = calendarDiv.offsetHeight + 'px' ;
}
function pickTodaysDate()
{
var d = new Date();
currentMonth = d.getMonth();
currentYear = d.getFullYear();
pickDate(false,d.getDate());
}
function pickDate(e,inputDay)
{
var month = currentMonth/1 +1;
if(month<10)month = '0' + month;
var day;
if(!inputDay && this)day = this.innerHTML; else day = inputDay;
if(day/1<10)day = '0' + day;
if(returnFormat){
returnFormat = returnFormat.replace('dd',day);
returnFormat = returnFormat.replace('mm',month);
returnFormat = returnFormat.replace('yyyy',currentYear);
returnFormat = returnFormat.replace('hh',currentHour);
returnFormat = returnFormat.replace('ii',currentMinute);
returnFormat = returnFormat.replace('d',day/1);
returnFormat = returnFormat.replace('m',month/1);
returnDateTo.value = returnFormat;
try{
returnDateTo.onchange();
}catch(e){
}
}else{
for(var no=0;no<returnDateToYear.options.length;no++){
if(returnDateToYear.options[no].value==currentYear){
returnDateToYear.selectedIndex=no;
break;
}
}
for(var no=0;no<returnDateToMonth.options.length;no++){
if(returnDateToMonth.options[no].value==parseInt(month)){
returnDateToMonth.selectedIndex=no;
break;
}
}
for(var no=0;no<returnDateToDay.options.length;no++){
if(returnDateToDay.options[no].value==parseInt(day)){
returnDateToDay.selectedIndex=no;
break;
}
}
if(calendarDisplayTime){
for(var no=0;no<returnDateToHour.options.length;no++){
if(returnDateToHour.options[no].value==parseInt(currentHour)){
returnDateToHour.selectedIndex=no;
break;
}
}
for(var no=0;no<returnDateToMinute.options.length;no++){
if(returnDateToMinute.options[no].value==parseInt(currentMinute)){
returnDateToMinute.selectedIndex=no;
break;
}
}
}
}
closeCalendar();
}
function getWeek(year,month,day){
day = day/1;
year = year /1;
month = month/1 + 1; //use 1-12
var a = Math.floor((14-(month))/12);
var y = year+4800-a;
var m = (month)+(12*a)-3;
var jd = day + Math.floor(((153*m)+2)/5) +
(365*y) + Math.floor(y/4) - Math.floor(y/100) +
Math.floor(y/400) - 32045; // (gregorian calendar)
var d4 = (jd+31741-(jd%7))%146097%36524%1461;
var L = Math.floor(d4/1460);
var d1 = ((d4-L)%365)+L;
NumberOfWeek = Math.floor(d1/7) + 1;
return NumberOfWeek;
}
function writeTimeBar()
{
var timeBar = document.createElement('DIV');
timeBar.id = 'timeBar';
timeBar.className = 'timeBar';
var subDiv = document.createElement('DIV');
subDiv.innerHTML = 'Time:';
var hourDiv = document.createElement('DIV');
hourDiv.onmouseover = highlightSelect;
hourDiv.onmouseout = highlightSelect;
hourDiv.onclick = showHourDropDown;
hourDiv.style.width = '30px';
var span = document.createElement('SPAN');
span.innerHTML = currentHour;
span.id = 'calendar_hour_txt';
hourDiv.appendChild(span);
timeBar.appendChild(hourDiv);
var img = document.createElement('IMG');
img.src = pathToImages + 'down_time.gif';
hourDiv.appendChild(img);
hourDiv.className = 'selectBoxTime';
if(Opera){
hourDiv.style.width = '30px';
img.style.cssText = 'float:right';
img.style.position = 'relative';
img.style.styleFloat = 'right';
}
var hourPicker = createHourDiv();
hourPicker.style.left = '130px';
hourPicker.style.width = '35px';
hourPicker.id = 'hourDropDown';
calendarDiv.appendChild(hourPicker);
var minuteDiv = document.createElement('DIV');
minuteDiv.onmouseover = highlightSelect;
minuteDiv.onmouseout = highlightSelect;
minuteDiv.onclick = showMinuteDropDown;
minuteDiv.style.width = '30px';
var span = document.createElement('SPAN');
span.innerHTML = currentMinute;
span.id = 'calendar_minute_txt';
minuteDiv.appendChild(span);
timeBar.appendChild(minuteDiv);
var img = document.createElement('IMG');
img.src = pathToImages + 'down_time.gif';
minuteDiv.appendChild(img);
minuteDiv.className = 'selectBoxTime';
if(Opera){
minuteDiv.style.width = '30px';
img.style.cssText = 'float:right';
img.style.position = 'relative';
img.style.styleFloat = 'right';
}
var minutePicker = createMinuteDiv();
minutePicker.style.left = '167px';
minutePicker.style.width = '35px';
minutePicker.id = 'minuteDropDown';
calendarDiv.appendChild(minutePicker);
return timeBar;
}
function writeBottomBar()
{
var d = new Date();
var bottomBar = document.createElement('DIV');
bottomBar.id = 'bottomBar';
bottomBar.style.cursor = 'pointer';
bottomBar.className = 'todaysDate';
var subDiv = document.createElement('DIV');
subDiv.onclick = pickTodaysDate;
subDiv.id = 'todaysDateString';
subDiv.style.width = (calendarDiv.offsetWidth - 95) + 'px';
var day = d.getDay();
if(day==0)day = 7;
day--;
var bottomString = todayStringFormat;
bottomString = bottomString.replace('[monthString]',monthArrayShort[d.getMonth()]);
bottomString = bottomString.replace('[day]',d.getDate());
bottomString = bottomString.replace('[year]',d.getFullYear());
bottomString = bottomString.replace('[dayString]',dayArray[day].toLowerCase());
bottomString = bottomString.replace('[UCFdayString]',dayArray[day]);
bottomString = bottomString.replace('[todayString]',todayString);
subDiv.innerHTML = todayString + ': ' + d.getDate() + '. ' + monthArrayShort[d.getMonth()] + ', ' + d.getFullYear() ;
subDiv.innerHTML = bottomString ;
bottomBar.appendChild(subDiv);
var timeDiv = writeTimeBar();
bottomBar.appendChild(timeDiv);
calendarDiv.appendChild(bottomBar);
}
function getTopPos(inputObj)
{
var returnValue = inputObj.offsetTop + inputObj.offsetHeight;
while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetTop;
return returnValue + calendar_offsetTop;
}
function getleftPos(inputObj)
{
var returnValue = inputObj.offsetLeft;
while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
return returnValue + calendar_offsetLeft;
}
function positionCalendar(inputObj)
{
calendarDiv.style.left = getleftPos(inputObj) + 'px';
calendarDiv.style.top = getTopPos(inputObj) + 'px';
if(iframeObj){
iframeObj.style.left = calendarDiv.style.left;
iframeObj.style.top = calendarDiv.style.top;
iframeObj2.style.left = calendarDiv.style.left;
iframeObj2.style.top = calendarDiv.style.top;
}
}
function initCalendar()
{
if(MSIE){
iframeObj = document.createElement('IFRAME');
iframeObj.style.filter = 'alpha(opacity=0)';
iframeObj.style.position = 'absolute';
iframeObj.border='0px';
iframeObj.style.border = '0px';
iframeObj.style.marginLeft = '30px';
iframeObj.style.backgroundColor = '#FF0000';
iframeObj2 = document.createElement('IFRAME');
iframeObj2.style.position = 'absolute';
iframeObj2.border='0px';
iframeObj2.style.marginLeft = '30px';
iframeObj2.style.border = '0px';
iframeObj2.style.height = '1px';
iframeObj2.style.width = '1px';
document.body.appendChild(iframeObj2);
iframeObj2.src = 'blank.html';
iframeObj.src = 'blank.html';
document.body.appendChild(iframeObj);
}
calendarDiv = document.createElement('DIV');
calendarDiv.id = 'calendarDiv';
calendarDiv.style.zIndex = 1000;
slideCalendarSelectBox();
document.body.appendChild(calendarDiv);
writeBottomBar();
writeTopBar();
if(!currentYear){
var d = new Date();
currentMonth = d.getMonth();
currentYear = d.getFullYear();
}
writeCalendarContent();
}
function setTimeProperties()
{
if(!calendarDisplayTime){
document.getElementById('timeBar').style.display='none';
document.getElementById('timeBar').style.visibility='hidden';
document.getElementById('todaysDateString').style.width = '100%';
}else{
document.getElementById('timeBar').style.display='block';
document.getElementById('timeBar').style.visibility='visible';
document.getElementById('hourDropDown').style.top = document.getElementById('calendar_minute_txt').parentNode.offsetHeight + calendarContentDiv.offsetHeight + document.getElementById('topBar').offsetHeight + 'px';
document.getElementById('minuteDropDown').style.top = document.getElementById('calendar_minute_txt').parentNode.offsetHeight + calendarContentDiv.offsetHeight + document.getElementById('topBar').offsetHeight + 'px';
document.getElementById('minuteDropDown').style.right = '50px';
document.getElementById('hourDropDown').style.right = '50px';
document.getElementById('todaysDateString').style.width = '115px';
}
}
function calendarSortItems(a,b)
{
return a/1 - b/1;
}
function displayCalendar(inputField,format,buttonObj,displayTime,timeInput)
{
if(displayTime)calendarDisplayTime=true; else calendarDisplayTime = false;
if(inputField.value.length>0){
if(!format.match(/^[0-9]*?$/gi)){
var items = inputField.value.split(/[^0-9]/gi);
var positionArray = new Array();
positionArray['m'] = format.indexOf('mm');
if(positionArray['m']==-1)positionArray['m'] = format.indexOf('m');
positionArray['d'] = format.indexOf('dd');
if(positionArray['d']==-1)positionArray['d'] = format.indexOf('d');
positionArray['y'] = format.indexOf('yyyy');
positionArray['h'] = format.indexOf('hh');
positionArray['i'] = format.indexOf('ii');
var positionArrayNumeric = Array();
positionArrayNumeric[0] = positionArray['m'];
positionArrayNumeric[1] = positionArray['d'];
positionArrayNumeric[2] = positionArray['y'];
positionArrayNumeric[3] = positionArray['h'];
positionArrayNumeric[4] = positionArray['i'];
positionArrayNumeric = positionArrayNumeric.sort(calendarSortItems);
var itemIndex = -1;
currentHour = '00';
currentMinute = '00';
for(var no=0;no<positionArrayNumeric.length;no++){
if(positionArrayNumeric[no]==-1)continue;
itemIndex++;
if(positionArrayNumeric[no]==positionArray['m']){
currentMonth = items[itemIndex]-1;
continue;
}
if(positionArrayNumeric[no]==positionArray['y']){
currentYear = items[itemIndex];
continue;
}
if(positionArrayNumeric[no]==positionArray['d']){
tmpDay = items[itemIndex];
continue;
}
if(positionArrayNumeric[no]==positionArray['h']){
currentHour = items[itemIndex];
continue;
}
if(positionArrayNumeric[no]==positionArray['i']){
currentMinute = items[itemIndex];
continue;
}
}
currentMonth = currentMonth / 1;
tmpDay = tmpDay / 1;
}else{
var monthPos = format.indexOf('mm');
currentMonth = inputField.value.substr(monthPos,2)/1 -1;
var yearPos = format.indexOf('yyyy');
currentYear = inputField.value.substr(yearPos,4);
var dayPos = format.indexOf('dd');
tmpDay = inputField.value.substr(dayPos,2);
var hourPos = format.indexOf('hh');
if(hourPos>=0){
tmpHour = inputField.value.substr(hourPos,2);
currentHour = tmpHour;
}else{
currentHour = '00';
}
var minutePos = format.indexOf('ii');
if(minutePos>=0){
tmpMinute = inputField.value.substr(minutePos,2);
currentMinute = tmpMinute;
}else{
currentMinute = '00';
}
}
}else{
var d = new Date();
currentMonth = d.getMonth();
currentYear = d.getFullYear();
currentHour = '08';
currentMinute = '00';
tmpDay = d.getDate();
}
inputYear = currentYear;
inputMonth = currentMonth;
inputDay = tmpDay/1;
if(!calendarDiv){
initCalendar();
}else{
if(calendarDiv.style.display=='block'){
closeCalendar();
return false;
}
writeCalendarContent();
}
returnFormat = format;
returnDateTo = inputField;
positionCalendar(buttonObj);
calendarDiv.style.visibility = 'visible';
calendarDiv.style.display = 'block';
if(iframeObj){
iframeObj.style.display = '';
iframeObj.style.height = '140px';
iframeObj.style.width = '195px';
iframeObj2.style.display = '';
iframeObj2.style.height = '140px';
iframeObj2.style.width = '195px';
}
setTimeProperties();
updateYearDiv();
updateMonthDiv();
updateMinuteDiv();
updateHourDiv();
}
function displayCalendarSelectBox(yearInput,monthInput,dayInput,hourInput,minuteInput,buttonObj)
{
if(!hourInput)calendarDisplayTime=false; else calendarDisplayTime = true;
currentMonth = monthInput.options[monthInput.selectedIndex].value/1-1;
currentYear = yearInput.options[yearInput.selectedIndex].value;
if(hourInput){
currentHour = hourInput.options[hourInput.selectedIndex].value;
inputHour = currentHour/1;
}
if(minuteInput){
currentMinute = minuteInput.options[minuteInput.selectedIndex].value;
inputMinute = currentMinute/1;
}
inputYear = yearInput.options[yearInput.selectedIndex].value;
inputMonth = monthInput.options[monthInput.selectedIndex].value/1 - 1;
inputDay = dayInput.options[dayInput.selectedIndex].value/1;
if(!calendarDiv){
initCalendar();
}else{
writeCalendarContent();
}
returnDateToYear = yearInput;
returnDateToMonth = monthInput;
returnDateToDay = dayInput;
returnDateToHour = hourInput;
returnDateToMinute = minuteInput;
returnFormat = false;
returnDateTo = false;
positionCalendar(buttonObj);
calendarDiv.style.visibility = 'visible';
calendarDiv.style.display = 'block';
if(iframeObj){
iframeObj.style.display = '';
iframeObj.style.height = calendarDiv.offsetHeight + 'px';
iframeObj.style.width = calendarDiv.offsetWidth + 'px';
iframeObj2.style.display = '';
iframeObj2.style.height = calendarDiv.offsetHeight + 'px';
iframeObj2.style.width = calendarDiv.offsetWidth + 'px'
}
setTimeProperties();
updateYearDiv();
updateMonthDiv();
updateHourDiv();
updateMinuteDiv();
}
var uploadsucess=0;
var pStr1;
var pStr2;
var data1;
var data2;
var star=0;
var estrelas = new Array(5);
estrelas[0]="star1";
estrelas[1]="star2";
estrelas[2]="star3";
estrelas[3]="star4";
estrelas[4]="star5";
var reDate = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;
if (navigator.appName.indexOf('Microsoft') != -1){
clientNavigator = "IE";
}else{
clientNavigator = "Other";
}
function ValidateEmail(emailAdress)
{
if ((emailAdress.indexOf("{")>=0) || (emailAdress.indexOf("}")>=0) || (emailAdress.indexOf("(")>=0)
|| (emailAdress.indexOf(")")>=0) || (emailAdress.indexOf("<")>=0) || (emailAdress.indexOf(">")>=0)
|| (emailAdress.indexOf("[")>=0) || (emailAdress.indexOf("]")>=0) || (emailAdress.indexOf("|")>=0)
|| (emailAdress.indexOf("\"")>=0) || (emailAdress.indexOf("/")>=0) )
{
alert("Erro, Este e-mail não é válido");
return false;
}
if ((emailAdress.indexOf("&")>=0) || (emailAdress.indexOf("*")>=0) || (emailAdress.indexOf("$")>=0) || (emailAdress.indexOf("%")>=0)
|| (emailAdress.indexOf("?")>=0) || (emailAdress.indexOf("!")>=0) || (emailAdress.indexOf("^")>=0) || (emailAdress.indexOf("~")>=0)
|| (emailAdress.indexOf("`")>=0) || (emailAdress.indexOf("'")>=0) )
{
alert("Erro, Este e-mail não é válido");
return false;
}
if ((emailAdress.indexOf(",")>=0) || (emailAdress.indexOf(";")>=0) || (emailAdress.indexOf(":")>=0) || (emailAdress.indexOf("=")>=0)
|| (emailAdress.indexOf("#")>=0) )
{
alert("Erro, Este e-mail não é válido");
return false;
}
if ( (emailAdress.indexOf("@") < 0) || (emailAdress.indexOf("@") != emailAdress.lastIndexOf("@")) )
{
alert("Erro, Este e-mail não é válido");
return false;
}
if (emailAdress.lastIndexOf(".") < emailAdress.indexOf("@"))
{
alert("Erro, Este e-mail não é válido");
return false;
}
return true;
}
var currentMouseX;
var currentMouseY;
function GetMousePosition(e)
{
var nn6 = document.getElementById && !document.all;
var clientX = document.all ? event.clientX : e.clientX;
var clientY = document.all ? event.clientY : e.clientY;
var scrollLeft = nn6 ? window.pageXOffset : document.documentElement.scrollLeft;
var scrollTop = nn6 ? window.pageYOffset : document.documentElement.scrollTop;
currentMouseX = clientX + scrollLeft;
currentMouseY = clientY + scrollTop;
}
var NotifyDiv = null;
var NotifyTimeout = -1;
var NotifyOffsetX = - 30;
var NotifyOffsetY = -20;
function CreateNotify(header, text)
{
if(NotifyTimeout!=-1)
{
window.clearTimeout(NotifyTimeout);
}
if(!NotifyDiv)
{
NotifyDiv = document.createElement('div');
NotifyDiv.className = 'popBox'; //class that contains div style
NotifyDiv.style.position = 'Absolute';
document.body.appendChild(NotifyDiv);
}
NotifyDiv.style.left = currentMouseX + NotifyOffsetX + 'px';
NotifyDiv.style.top = currentMouseY + NotifyOffsetY + 'px';
NotifyDiv.innerHTML = " <div style='padding:5px; padding-left:10px; font-size: 10pt;color: #FFF;background: #1F3D79;'>"+header+"</div>"+
" <p>"+text+"</p>";
NotifyTimeout = window.setTimeout('DestroyNotify()', 2000);
}
function DestroyNotify()
{
document.body.removeChild(NotifyDiv);
NotifyDiv = null;
NotifyTimeout = -1;
}
function validateComments(areacomment,event,size)
{
if (areacomment.value.length > size){
return false
}
}
function DarNota(numeroStar){
star=0;
ApagarNota();
PreencherNota(numeroStar);
star=numeroStar;
}
function ApagarNota(){
if(star==0){
for(var i=0;i<5;i++){
var estrelaAtual = document.getElementById(estrelas[i]);
estrelaAtual.src='../skins/default/image/evaluate_star00.gif';
}
}
}
function PreencherNota(nota){
if(star==0){
for(var i=0;i<nota;i++){
var estrelaAtual = document.getElementById(estrelas[i]);
estrelaAtual.src='../skins/default/image/evaluate_star01.gif';
}
}
}
function Search_Enter(e,txt,dt1,dt2,channel){
var code;
if (!e) var e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
var character = String.fromCharCode(code);
if (code == 13) {
doDate(txt,dt1,dt2,channel);
}
return true;
}
function Ajusta_Data(input, event){
if(clientNavigator == "IE"){
var tecla=(window.event)? event.keyCode:e.which;
}
else{
tecla = event.charCode;
}
if((tecla > 46 && tecla < 58))
{
DataMask(input,event);
}
else
{
if (tecla == 8 || tecla == 0)
{
DataMask(input,event);
}
else
{
return false;
}
}
if(tecla == 13)
{
document.getElementById('btBusc').click();
}
return true;
}
function DataMask(input,event){
if (input.value.length == 2 || input.value.length == 5){
if(clientNavigator == "IE"){
input.value += "/";
}
else if(event.keyCode == 0){
input.value += "/";
}
}
}
function validateRecomenda(contentID,channel){
var email0 = document.getElementsByName('email0')[0].value;
var email1 = document.getElementsByName('email1')[0].value;
var name0 = document.getElementsByName('name0')[0].value;
var name1 = document.getElementsByName('name1')[0].value;
var text = document.getElementsByName('text')[0].value;
if (email0=="" || email1=="" || name0=="" || name1=="" || text==""){
alert('Todos os dados devem ser digitados corretamente para que o envio obtenha sucesso')
}
else{
ValidateEmail(email0);
sendRecomenda(email0, email1, name0, name1,text,contentID,channel);
}
}
function sendComments(loc,userID,contentID,titulo,fullname){
var reply_id = loc.parentNode.comment_id.value;
var text = loc.parentNode.repplyComment.value;
var nome = loc.parentNode.username_reply.value;
var email = loc.parentNode.email_reply.value;
var display_email = loc.parentNode.chkReplyEmailView.checked ? 1 : 0;
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if (nome==""){
alert('Necessário Preencher o campo Nome');
}else if(email=="" || email.match(emailReg)== null){
alert('Necessário fornecer um email válido');
return false;
}
var url = 'ComentarioResponse.aspx?uf=' + getUf() + '&userID='+userID+ '&email=' +email+ '&contentID='+contentID+'&text='+escape(text)+'&reply_id='+reply_id+'&titulo='+escape(titulo)+'&fullname='+escape(nome)+ '&display_email=' + display_email;
new Ajax.Request(url, {
method: 'get',
onSuccess: function(transport)
{
var obj = transport.responseText.evalJSON();
var myTemplate = new Template('#{status}');
var valores = myTemplate.evaluate(obj);
var pgatual = document;
if(valores=="sucess"){
alert('Resposta envianda com sucesso');
backComments(loc);
loc.parentNode.username_reply.value="";
loc.parentNode.email_reply.value="";
var idx = document.getElementById('indexPag').value;
ListComment(idx,contentID,userID);
}
pgatual.close();
}
});
}
function sendRecomenda(email0, email1, name0, name1,text,contentID,channel)
{
var url = 'Recomenda.aspx?email0='+email0+'&email1='+email1+'&name0='+name0+'&name1='+name1+'&contentID='+contentID+'&channel='+channel+'&text='+text;
new Ajax.Request(url, {
method: 'get',
onSuccess: function(transport)
{
var obj = transport.responseText.evalJSON();
var myTemplate = new Template('#{status}');
var valores = myTemplate.evaluate(obj);
var pgatual = document;
if(valores=="sucess"){
document.getElementsByName('email0')[0].style.display="none";
document.getElementsByName('email1')[0].style.display="none";
document.getElementsByName('name0')[0].style.display="none";
document.getElementsByName('name1')[0].style.display="none";
document.getElementsByName('text')[0].style.display="none";
document.getElementById('feedback').style.display="block";
document.getElementById('mail0').style.display="none";
document.getElementById('mail1').style.display="none";
document.getElementById('mail2').style.display="none";
document.getElementById('mail3').style.display="none";
document.getElementById('messagetext').style.display="none";
document.getElementById('enviorecomendar').style.display="none";
}
if(valores=="failure"){
document.getElementsByName('email0')[0].style.display="none";
document.getElementsByName('email1')[0].style.display="none";
document.getElementsByName('name0')[0].style.display="none";
document.getElementsByName('name1')[0].style.display="none";
document.getElementsByName('text')[0].style.display="none";
document.getElementById('feedback').style.display="block";
document.getElementById('mail0').style.display="none";
document.getElementById('mail1').style.display="none";
document.getElementById('mail2').style.display="none";
document.getElementById('mail3').style.display="none";
document.getElementById('messagetext').style.display="none";
document.getElementById('enviorecomendar').style.display="none";
document.getElementById('feedback').innerHTML = "Sua mensagem não pode ser enviada.";
}
pgatual.close();
}
});
}
function addDenounce(text_denuncia,contentID,channel)
{
var url = 'Denounce.aspx?denuncia='+text_denuncia+'&contentID='+contentID+'&channel='+channel;
new Ajax.Request(url, {
method: 'get',
onSuccess: function(transport)
{
var obj = transport.responseText.evalJSON();
var myTemplate = new Template('#{status}');
var valores = myTemplate.evaluate(obj);
var pgatual = document;
if(valores=="sucess"){
document.getElementById('fora').style.display="none"
document.getElementById('envio').style.display="none"
document.getElementById('areadenuncia').style.display="none"
document.getElementById('feedback2').style.display="block"
}
pgatual.close();
}
});
}
function denounceValidate(contentID,channel){
var denounce=document.denounceVideo.areadenuncia.value;
if (denounce==""){
alert("É necessário cadastrar uma denúncia");
document.denounceVideo.areadenuncia.focus();
return false
}
else{
addDenounce(denounce,contentID,channel);
}
}
function BackUpload(url,channel)
{
window.location.href = url+'?channel='+channel;
}
function Go(url,channel)
{
window.location.href = url+'?channel='+channel;
}
function GoContent(url,channel,contentID)
{
window.location.href = url+'?uf=' + getUf() + '&channel='+channel+'&contentID='+contentID;
}
function Ir(url,channel,tipo,userID)
{
window.location.href = url+'?uf=' + getUf() + '&channel='+channel+'&tipo='+tipo+'&user='+userID;
}
function editarVideos(id,index,user,channel)
{
window.location.href = 'MyVideosEdit.aspx?uf=' + getUf() + '&channel='+channel+'&contentID='+id+'&index='+index+'&userID='+user;
}
function onUploadComplete(){
uploadsucess=1;
document.forms['editInfo'].submit();
}
function commentValidate(contentID,userID){
var titulo=document.comment.titulo_coment.value;
var comentario=document.comment.text_coment.value;
var fullname = encodeURI(document.getElementById("username_comment").value);
var email = encodeURI(document.getElementById("email_comment").value);
var exibirEmail = document.getElementById("chkEmailView").checked;
var display_email = (exibirEmail==true) ? 1 : 0;
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if (fullname==""){
alert('Necessário Preencher o campo Nome');
document.getElementById("username_comment").focus();
}
else if(email=="" || email.match(emailReg)== null){
alert('Necessário fornecer um email válido');
document.getElementById("email_comment").focus();
}
else if (titulo==""){
alert('Necessário Preencher o campo Título')
document.comment.titulo_coment.focus();
}
else if(comentario==""){
alert('Necessário Preencher o campo Comentário')
document.comment.text_coment.focus();
return false;
}
else{
addComment(contentID,titulo,comentario,userID, email, fullname, display_email);
}
}
function ListComment(index,contentID,userID){
var url = 'ComentarioList.aspx?uf=' + getUf() + '&contentID='+contentID+'&index='+index+'&userID='+userID;
new Ajax.Request(url, {
method: 'get',
onSuccess: function(transport)
{
var obj = transport.responseText.evalJSON();
var myTemplate = new Template('#{item}');
var valores = myTemplate.evaluate(obj);
var pgatual = document;
document.getElementById('divContentsPaging').style.display='none';
document.getElementById('list').innerHTML=valores;
atualizaQtt(contentID);
pgatual.close();
}
});
}
function addComment(contentID,titulo,comentario,userID, email, fullname, display_email)
{
var url = 'DarComentario.aspx?uf=' + getUf() + '&username_comment='+fullname+ '&email_comment='+email+ '&contentID='+contentID+'&titulo_comment='+titulo+'&text_comment='+comentario+ '&display_email='+ display_email;
new Ajax.Request(url, {
method: 'get',
onSuccess: function(transport)
{
var obj = transport.responseText.evalJSON();
var myTemplate = new Template('#{status}');
var valores = myTemplate.evaluate(obj);
var pgatual = document;
if(valores=="sucess"){
alert('Comentário enviado com sucesso!');
document.comment.titulo_coment.value="";
document.comment.text_coment.value="";
document.getElementById("username_comment").value="";
document.getElementById("email_comment").value="";
document.getElementById("chkEmailView").checked=false;
}
pgatual.close();
ListComment(1,contentID,userID);
}
});
}
function addNota(contentID){
if(star==0){
alert('Necessário clicar em uma estrela');
return false;
}else{
var url = 'DarNota.aspx?uf=' + getUf() + '&contentID='+contentID+'&star='+star;
new Ajax.Request(url, {
method: 'get',
onSuccess: function(transport)
{
var obj = transport.responseText.evalJSON();
var myTemplate = new Template('#{status}');
var valores = myTemplate.evaluate(obj);
var pgatual = document;
if(valores=="sucess"){
document.getElementById('titulo').style.display="none"
document.getElementById('estrelas').style.display="none"
document.getElementById('enviar').style.display="none"
document.getElementById('feednota').style.display="block"
}
pgatual.close();
}
});
}
}
function addFavorite(contentID){
if(userID == 0) {
mLogin(escape(location.href));
return;
}
var url = 'FavoriteVideo.aspx?contentID='+contentID;
new Ajax.Request(url, {
method: 'get',
onSuccess: function(transport)
{
var obj = transport.responseText.evalJSON();
var myTemplate = new Template('#{status}');
var valores = myTemplate.evaluate(obj);
var pgatual = document;
if(valores=="sucess"){
alert('Adicionado aos Favoritos com sucesso!');
document.getElementById('addfavorite').style.display="none";
document.getElementById('favorite').style.display="inline";
atualizaQtt(contentID);
}
else{
alert('O Video já foi adicionado como favorito!');
}
pgatual.close();
}
});
}
function doDate(tx,pStr1,pStr2,channel)
{
if (tx.length > 21){
alert('O número de caracteres ultrapassou o limite máximo de 20');
}else{
if(!(tx==""&&pStr1==""&& pStr2=="")){
data1 = pStr1;
var dt1
var dt2
var dt3
dt1 = data1.substr( 0,2 );
dt2 = data1.substr( 3,2 );
dt3 = data1.substr( 6,4 );
data1 = (dt1+"/"+dt2+"/"+dt3);
data2 = pStr2;
var dta
var dtb
var dtc
dta = data2.substr( 0,2 );
dtb = data2.substr( 3,2 );
dtc = data2.substr( 6,4 );
data2 = (dta+"/"+dtb+"/"+dtc);
if (reDate.test(data1))
{
if (reDate.test(data2))
{
var datainicial = new Date();
var datafinal = new Date();
datainicial.setFullYear(dt3,dt2,dt1);
datafinal.setFullYear(dtc,dtb,dta);
if( datainicial > datafinal)
{
alert('Data inicial é maior que a data final');
return false;
}
} else {
if (pStr2 != null && pStr2 != '') {
alert('Data final deve estar no formato dd/mm/aaaa');
return false;
}
}
} else {
if (pStr1 != null && pStr1 != '') {
alert('Data inicial deve estar no formato dd/mm/aaaa');
return false;
} else if (!(reDate.test(data2))) {
if (pStr2 != null && pStr2 != '') {
alert('Data final deve estar no formato dd/mm/aaaa');
return false;
}
}
}
if(data2=='//' && data1!='//'){
window.location.href = 'ResultadoBusca.aspx?uf=' + getUf() + '&channel='+channel+'&tipo=busca&texto='+tx+'&dInicial='+escape(data1);
}else if(data1=='//'&&data2!='//'){
window.location.href = 'ResultadoBusca.aspx?uf=' + getUf() + '&channel='+channel+'&tipo=busca&texto='+tx+'&dFinal='+escape(data2);
}else if(data1!='//'&&data2!='//'){
window.location.href = 'ResultadoBusca.aspx?uf=' + getUf() + '&channel='+channel+'&tipo=busca&texto='+tx+'&dInicial='+escape(data1)+'&dFinal='+escape(data2);
}else{
window.location.href = 'ResultadoBusca.aspx?uf=' + getUf() + '&channel='+channel+'&tipo=busca&texto='+tx;
}
}else{alert('Necessário entrar com uma Palavra Chave ou com uma data inicial ou final');}
}
}
function SomenteNumero(e)
{
var tecla=(window.event)?event.keyCode:e.which;
if((tecla > 46 && tecla < 58))
{
return true;
}
else
{
if (tecla == 8 || tecla == 0)
{
return true;
}else
{
return false;
}
}
}
function SomenteAlfaNumericos(e)
{
var tecla=(window.event)?event.keyCode:e.which;
if((tecla > 64 && tecla < 122))
{
return true;
}
else
{
if (tecla == 8 || tecla == 0)
{
return true;
}else
{
return false;
}
}
}
function backAction(action){
if (action=="denuncia"){
document.getElementById('denuncie').style.display='none'
}
if (action=="nota"){
star=0;
ApagarNota();
document.getElementById('nota').style.display='none'
}
if (action=="recomenda"){
document.getElementById('recomenda').style.display='none'
}
document.getElementById('main').style.display='block'
}
function videoAction(action,channel,userID,contentID)
{
document.getElementById('main').style.display='none';
if ((action=="denuncia"))
{
var url = 'validaSessao.aspx?userID='+userID;
new Ajax.Request(url, { method: 'get', onSuccess: function(transport)
{
var obj = transport.responseText.evalJSON();
var myTemplate = new Template('#{status}');
var valores = myTemplate.evaluate(obj);
var pgatual = document;
if(valores=="sucess")
{
if (action=="denuncia")
{
document.getElementById('denuncie').style.display="block"
document.getElementById('fora').style.display="block"
document.getElementById('envio').style.display="inline"
document.getElementById('areadenuncia').style.display="block"
document.getElementById('feedback2').style.display="none"
document.getElementById('areadenuncia').value="";
document.denounceVideo.areadenuncia.focus();
}
/*if (action=="recomenda")
{
document.getElementById('feedback').style.display="none";
document.getElementById('recomenda').style.display="block"
document.getElementById('mail').style.display="inline";
document.getElementsByName('email')[0].style.display="inline";
document.getElementById('messagetext').style.display="block";
document.getElementsByName('text')[0].style.display="inline";
document.getElementById('enviorecomendar').style.display="inline";
document.getElementsByName('email')[0].value="";
document.denounceRecomendar.email.focus();
document.getElementsByName('text')[0].value="";
}
if (action=="recomenda2")
{
document.getElementById('feedback').style.display="none";
document.getElementById('recomenda').style.display="block"
document.getElementById('mail').style.display="inline";
document.getElementsByName('email')[0].style.display="inline";
document.getElementById('messagetext').style.display="block";
document.getElementsByName('text')[0].style.display="inline";
document.getElementById('enviorecomendar').style.display="inline";
document.getElementsByName('email')[0].value="";
document.denounceRecomendar.email.focus();
document.getElementsByName('text')[0].value="";
} */
}
else
{
var loc = document.location;
mLogin(escape(loc));
}
pgatual.close();
}
});
}
if (action=="recomenda")
{
document.getElementById('feedback').style.display="none";
document.getElementById('recomenda').style.display="block"
document.getElementById('mail').style.display="inline";
document.getElementsByName('email')[0].style.display="inline";
document.getElementById('messagetext').style.display="block";
document.getElementsByName('text')[0].style.display="inline";
document.getElementById('enviorecomendar').style.display="inline";
document.getElementsByName('email')[0].value="";
document.denounceRecomendar.email.focus();
document.getElementsByName('text')[0].value="";
}
if (action=="recomenda2")
{
document.getElementsByName('email0')[0].style.display="inline";
document.getElementsByName('email1')[0].style.display="inline";
document.getElementsByName('name0')[0].style.display="inline";
document.getElementsByName('name1')[0].style.display="inline";
document.getElementsByName('text')[0].style.display="inline";
document.getElementById('feedback').style.display="none";
document.getElementById('mail0').style.display="";
document.getElementById('mail1').style.display="";
document.getElementById('mail2').style.display="";
document.getElementById('mail3').style.display="";
document.getElementById('messagetext').style.display="";
document.getElementById('feedback').style.display="none";
document.getElementById('recomenda').style.display="block"
document.getElementById('enviorecomendar').style.display="inline";
document.getElementsByName('email0')[0].value="";
document.getElementsByName('name0')[0].value="";
document.denounceRecomendar.email0.focus();
document.getElementsByName('text')[0].value="";
}
if (action=="nota"){
document.getElementById('nota').style.display="block"
document.getElementById('titulo').style.display="block"
document.getElementById('estrelas').style.display="block"
document.getElementById('enviar').style.display="inline"
document.getElementById('feednota').style.display="none"
star = 0;
}
}
function detalheshow(desc,more,tam){
if (more=='show'){
document.getElementById('show').style.display="none";
document.getElementById('hide').style.display="inline";
document.getElementById('descript').innerHTML=desc;
}
else{
document.getElementById('hide').style.display="none";
document.getElementById('show').style.display="inline";
document.getElementById('descript').innerHTML=desc.substr(0,tam)+"...";
}
}
function responseComments(loc){
var div = loc.parentNode;
while(div.tagName != "DIV") div = div.parentNode;
div = div.getElementsByTagName("DIV")[0];
div.style.display="block";
}
function backComments(loc){
loc.parentNode.getElementsByTagName("textarea")[0].value="";
loc.parentNode.getElementsByTagName("textarea")[0].focus();
loc.parentNode.parentNode.style.display="none";
}
function detalhes(desc,loc,tam){
var evento = loc.innerHTML;
if (evento.substr(0,3)=='&gt'){
loc.parentNode.childNodes[0].nodeValue=desc;
loc.innerHTML=" << ";
}
else{
loc.parentNode.childNodes[0].nodeValue=desc.substr(0,tam)+"...";
loc.innerHTML=" >> ";
}
}
function Add(index)
{
var mi = CreateMediaItem(titles[index],urls[index]);
playlistSample.add(mi);
}
function CreateMediaItem(title,url)
{
var mi = new MediaItem();
mi.title = title;
mi.setUrl(0,url);
mi.ads = new Array();
return(mi);
}
function ValidateMyVideo(){
var title = document.editInfo.videoTitle.value;
var description = document.editInfo.videoDescription.value;
var tags = document.editInfo.videoTags.value;
var arraytags = tags.split(";");
var i=0;
var arraytag;
var param;
if(title==""){
alert('Entre com o Título do Vídeo');
return false;
}
if(description ==""){
alert('É obrigatório o preenchimento da Descrição do Vídeo');
return false;
}
if(tags==""){
alert('Entrar com pelo menos 1 palavras chave (tags)');
return false;
}
if (title.length > 70){
alert('O título deverá possuir até 70 caracteres');
return false;
}
if (description.length > 500){
alert('A descrição deverá possuir até 500 caracteres');
return false;
}
if (arraytags.length > 10){
alert('Entre com no máximo 10 palavras chaves');
return false;
}
for(i=0;i<tags.length;i++){
param = trim(arraytags[i]);
if(param == ""||arraytags[i]=="" )
{
alert(' Entre com uma palavra chave após o ; ');
return false;
}
arraytag = arraytags[i].split(",");
if(arraytag.length > 1){
alert('Separar as palavras chaves por ;');
return false;
}
}
return true;
}
function trim(str)
{
if(!str || typeof str != 'string')
return null;
else
return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
}
function ValidateUpload(){
var maxTags = 10;
var title = document.editInfo.videoTitle.value;
var description = document.editInfo.videoDescription.value;
var tags = document.editInfo.videoTags.value;
var arraytags = tags.split(" ");
var i=0;
var arraytag;
var param;
if(title==""){
alert('Entre com o Título do Vídeo');
return false;
}
if(description ==""){
alert('É obrigatório o preenchimento da Descrição do Vídeo');
return false;
}
if (title.length > 70){
alert('O título deverá possuir até 70 caracteres');
return false;
}
if (description.length > 500){
alert('A descrição deverá possuir até 500 caracteres');
return false;
}
if (arraytags.length > maxTags){
alert('Entre com no máximo ' + maxTags + ' palavras chaves');
return false;
}
return true;
}
function RemovMV(contentID,index,userID,tipo,titulo)
{
var f = 'RemoverMV'+contentID;
var r=confirm('Tem certeza que deseja remover o vídeo: '+titulo+'');
if (r==true)
{
window.location.href = 'DelVideo.aspx?uf=' + getUf() + '&contentID='+contentID+'&userID='+userID+'&index='+index+'&tipo='+tipo;
}
}
function RemovMF(contentID,index,userID,tipo,titulo)
{
var f = 'RemoverMF'+contentID;
var r=confirm('Tem certeza que deseja remover o vídeo: '+titulo+'');
if (r==true)
{
window.location.href = 'DelVideo.aspx?uf=' + getUf() + '&contentID='+contentID+'&userID='+userID+'&index='+index+'&tipo='+tipo;
}
return false;
}
function RemovTot(user,tipo)
{
var url='DelVideo.aspx?uf=' + getUf() + '&userID='+user+'&tipo='+tipo+'&contents='
var arrayoption = document.getElementsByName('option');
var i=0;
var titulos="";
var aux="";
var arrayseparador=new Array();
for(i=0;i < arrayoption.length; i++)
{
if (arrayoption[i].checked==true)
{
aux = arrayoption[i].value;
arrayseparador=aux.split('@@');
url=url+arrayseparador[0]+"_";
titulos=titulos+arrayseparador[1]+" ";
}
}
if(url=='DelVideo.aspx?uf=' + getUf() + '&userID='+user+'&tipo='+tipo+'&contents=')
{
alert('Não existem vídeos selecionados!');
}
else
{
url.split("_");
var r=confirm('Tem certeza que deseja remover o(s) vídeo(s): '+titulos+'');
if (r==true)
{window.location.href = url;}
}
return false;
}
function editarVideo(contentID,index,userID)
{
window.location.href = 'MyVideos.aspx?uf=' + getUf() + '&?contentID='+contentID+'&userID='+userID+'&index='+index;
}
function mudaCor(id)
{
if(id=="favorite")
{
document.getElementById(id).style.color='E7bE00';
}
else
{
document.getElementById(id).style.color='Black';
}
}
function mudaCorOriginal(id)
{
if(id=="favorite")
{
document.getElementById(id).style.color='FFDE43';
}
else
{
document.getElementById(id).style.color='#424242';
}
}
function logout()
{
document.location = 'logout.aspx?uf=' + getUf() + '&';
}
function cancelUpload01()
{
document.editInfo.videoTitle.value="";
document.editInfo.videoDescription.value="";
document.editInfo.videoTags.value="";
var categories = document.editInfo.category;
var i=0;
for(i=0;i < categories.length;i++)
{
document.editInfo.category[i].checked=false;
}
document.editInfo.notifymail.checked=false;
}
function cancelUpload01_()
{
history.back();
}
function sucessUpload()
{
if(uploadsucess==1)
{
uploadsucess=0;
return true
}
else
{
alert('É necessário fazer upload de um vídeo');
return false
}
return false
}
function mLogin(loc)
{
var url = 'login.aspx?url=';
url += escape(loc);
document.location = url;
}
function registerEvent(listenerObject, eventName, callbackFunction) {
var eventRegistered = true;
if(listenerObject.addEventListener){
listenerObject.addEventListener(eventName, callbackFunction, false);
} else if (listenerObject.attachEvent){
eventRegistered = listenerObject.attachEvent('on' + eventName, callbackFunction);
} else {
eventRegistered = false;
}
return eventRegistered;
}
function msgErro()
{
alert('123');
}
function atualizaQtt(contentID)
{
var url = 'Atualiza.aspx?uf=' + getUf() + '&?contentID='+contentID;
new Ajax.Request(url, { method: 'get', onSuccess: function(transport)
{
var obj = transport.responseText.evalJSON();
var valExib = obj.exibicoes;
var valComent = obj.comentarios;
var valFav = obj.favoritado;
var exib = document.getElementById('tExi');
var coment = document.getElementById('tCom');
var fav = document.getElementById('tFav');
exib.innerHTML = valExib;
coment.innerHTML = valComent;
fav.innerHTML = valFav;
}
});
}
toRegister = function () {
window.open('http://www.clicrbs.com.br/servlet/SignUpServlet?op=1&nexttop=21');
}
openPluginWindow = function () {
window.open("/templates/PluginInfo.aspx","pluginWindow","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=585, height=530")
}
getUf = function () {
var uf = 1; // Valor padrão, caso não encontre um válido no cookie
var arr = document.cookie.split("; ");
var uf = 0;
for(var i=0; i<arr.length; i++) {
var pair = arr[i].split("=");
if(pair[0] == "MC_uf") {
uf = pair[1];
break;
}
}
return(uf);
}
function InstallPluginActiveX () {
xpi={'Mozilla Firefox 1.5 ActiveX Plug-in':'http://www.iol.ie/~locka/mozilla/mozactivex-ff-15.xpi'};
InstallTrigger.install(xpi);
}
function Querystring(qs) {
this.params = new Object()
this.get=Querystring_get
if (qs == null)
qs=location.search.substring(1,location.search.length)
if (qs.length == 0) return
qs = qs.replace(/\+/g, ' ')
var args = qs.split('&')
for (var i=0;i<args.length;i++) {
var value;
var pair = args[i].split('=')
var name = unescape(pair[0])
if (pair.length == 2)
value = unescape(pair[1])
else
value = name
this.params[name] = value
}
}
function Querystring_get(key, default_) {
if (default_ == null) default_ = null;
var value=this.params[key]
if (value==null) value=default_;
return value
}
function fillSearchField (check) {
var q = new Querystring();
if(check == true) {
if(q.params['tipo'] == 'busca' && q.params['texto'] != "undefined") {
if(window.attachEvent) {
window.attachEvent("onload", fillSearchField);
} else {
window.addEventListener("load", fillSearchField, false);
}
}
} else {
document.getElementsByName('texto')[0].value = q.params['texto'];
}
}

