function IsEmail(emailad){
    var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
    var check=/@[\w\-]+\./;
    var checkend=/\.[a-zA-Z]{2,3}$/;
    if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){
        return false;
    }
    else {
        return true;
    }
}

function Dismiss()
{
    document.getElementById('completeProfile').style.display = 'none';
    
    var dataexp = new Date ();
    dataexp.setTime(dataexp.getTime() + (24 * 60 * 60 * 1000 * 1000)); 
    document.cookie = "CompleteYourProfile=1;expires=" + dataexp.toGMTString() + ";path=/";
}

function SearchGO()
{
    searchfield = document.getElementById('ctl00_txtSearch');  
      
    if (searchfield.value != '' && searchfield.value != 'Search Here...')
        location = "/Search.aspx?Query=" + (searchfield.value);
}

function SearchNotFound()
{
    searchfield = document.getElementById('txtSearch');    
    location = "/Search.aspx?Query=" + (searchfield.value);
}

function IEPlugOpen()
{
    if(navigator.appName == ("Microsoft Internet Explorer"))
    {
        var ua = navigator.userAgent;
        var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(ua) != null) rv = parseFloat( RegExp.$1 );
        
        if ( rv > -1 )
        {
            if ( rv >= 7.0 )
            {
                if((document.getElementById("ie7-plugin")) != null)
                    document.getElementById("ie7-plugin").style.display = "block";
            }
        }
    }
}

function FoxPlugOpen()
{
    if(navigator.userAgent.indexOf("Firefox") != -1)
    {
        if((document.getElementById("fox-plug")) != null)
            document.getElementById("fox-plug").style.display = "block";
    }
}

function addEngine()
{
    if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function")) { 
        window.sidebar.addSearchEngine(
            "http://www.playphone.com/Text/Search.src",
            "http://www.playphone.com/Images/p-icon-small.png","PlayPhone","Mobile"
        );
    } else {
        alert("Sorry, you need a Mozilla-based browser to install a search plugin.");
    } 
}

function ArtistMoreInfo(){

    var imgBio = document.getElementById('image');
    var txtBio = document.getElementById('biographic');
    var btnBio = document.getElementById('moreInfo');

    if (txtBio.style.height == parseInt(imgBio.style.height) - 42 + 'px')
    {
        txtBio.style.width = 'auto';
        txtBio.style.height = 'auto';
        txtBio.style.overflow = 'visible';
        document.getElementById('right-artist').className += ' expand';
        btnBio.innerHTML = 'Collapse Text';
    }
    else
    {
        txtBio.style.width = 340 + 'px';
        txtBio.style.height = parseInt(imgBio.style.height) - 42 + 'px';
        txtBio.style.overflow = 'hidden';
        document.getElementById('right-artist').className = 'right-artist';
        btnBio.innerHTML = 'More Info';
    }
}

function enterCarrier(value)
{   
    var select = document.getElementById('ctl00_ContentPlaceHolder1_lstCarrier');
    var row = document.getElementById('enterCarrier');
      
    if (select.options.selectedIndex == value) 
        row.style.display = (navigator.appName == 'Microsoft Internet Explorer') ? 'block' : 'table-row';
    else row.style.display = 'none';
}

function openTerms()
{
	termswindow = window.open("/TermsConditionsPop.aspx", 'termswindow' , 'width=400 , height=310');
	termswindow.focus();
}

function jumpfields(fieldName, nextFieldName)
{
    var form = document.forms[0];
    if ((form.elements[fieldName] != null) && (form.elements[fieldName]))
    {
        var field = form.elements[fieldName];
        field.nextField = form.elements[nextFieldName];
        
        field.onkeydown = jumpfields_keyDown;
        field.onkeyup = jumpfields_keyUp;
    }
}

function jumpfields_keyDown()
{
    this.beforeLength = this.value.length;
    dsf = this;
}

function jumpfields_keyUp()
{
    if ((this == dsf) && (this.value.length > this.beforeLength) && (this.value.length >= this.maxLength))
        this.nextField.focus();
    
    dsf = null;
}

function menuOptions() {    
    if (document.getElementById('layer').style.display == 'none')
        document.getElementById('layer').style.display == 'block'    
    else
        document.getElementById('layer').style.display == 'none'
}

function help_open_item(index) {

    var items = document.getElementsByTagName('ol');
    
    for (i in items) {
    
        if (i != index) {
        
            items[i].className = '';
        
        } else {
        
            items[i].className = 'on';
        }
    }
}



var sound = null;
        
function play_sound(obj, sound_path) {
    
    if (sound) {
    
        try { sound.childNodes[0].src = urlStaticServer + '/Images/bt_listen-play.png'; } catch (e) { }
        try { sound.src = urlStaticServer + '/Images/bt_listen-play.png'; } catch (e) { }
    }
    
    if (sound == obj) {
    
        try { obj.src = urlStaticServer + '/Images/bt_listen-play.png'; } catch (e) { }
        try { obj.childNodes[0].src = urlStaticServer + '/Images/bt_listen-play.png'; } catch (e) { }
        
        sound = null;
        
        document.getElementById('player').innerHTML = '';
    
    } else {
    
        try { obj.childNodes[0].src = urlStaticServer + '/Images/bt_listen-stop.png'; } catch (e) { }
        try { obj.src = urlStaticServer + '/Images/bt_listen-stop.png'; } catch (e) { }

        sound = obj;
        
        if (!document.getElementById('player')) {
        
            var div = document.createElement('div');
            div.id = 'player';
            document.body.appendChild(div);
        }
        
        var so = new SWFObject('/player.swf', 'playsample', '0', '0', '8');
        so.addVariable('sound_path', sound_path);
        so.write('player');
    }
}

function openPopup(url, name, width, height)
{
    popup = window.open(url, name , 'width=' + width + ' , height=' + height + ', scrollbars=yes');
    popup.focus();
}

function writeMail(linkId, name, prov, complement){
    email = name + '@' + prov + complement;
    linkId = document.getElementById(linkId);
    if(linkId.innerHTML != ''){
        linkId.href = 'mailto:' + email;
    }
    else{
        linkId.innerHTML = email;
        linkId.href = 'mailto:' + email;
    }
}

function setOpacity(divid, dec){
    divid = document.getElementById(divid);
    divid.style.opacity = (dec/10) / 10;
    divid.style.filter = 'alpha(opacity=' + dec + ')';
}

function newsletter(){
    if(document.getElementById('cnt-pcy').style.display!='block'){
        document.getElementById('cnt-pcy').style.display='block'
    }
    else
        document.getElementById('cnt-pcy').style.display='none'
}

var lock_prev = 0;
var lock_next = 0;
var countBanner = 1;
var animNav;

function prev_banner(){
    clearBanner();
    if(countBanner > 1){
        lock_next=1;
        var marginLeft = $('cnt_banner').getStyle('marginLeft').toInt();
        $('cnt_banner').effect('marginLeft', {duration: 300, transition: Fx.Transitions.linear, onComplete: function(){lock_next=0}}).start(marginLeft,marginLeft+340);
        countBanner--;
    }
    else{
        countBanner = 5;
        $('cnt_banner').setStyle('marginLeft', '-1360px');
    }
    
}

function moveNav(){
    clearBanner();
    if(countBanner < 5 && lock_next==0){
        lock_next=1;
        var marginRight = $('cnt_banner').getStyle('marginLeft').toInt();
        $('cnt_banner').effect('marginLeft', {duration: 300, transition: Fx.Transitions.linear, onComplete: function(){lock_next=0}}).start(marginRight,marginRight-340);
    }
    countBanner++;
    if(countBanner == 6){
        countBanner = 1;
        $('cnt_banner').setStyle('marginLeft', '0');
    }
}

function next_banner(){
    clearBanner();
    if(countBanner < 5 && lock_next==0){
        lock_next=1;
        var marginRight = $('cnt_banner').getStyle('marginLeft').toInt();
        $('cnt_banner').effect('marginLeft', {duration: 300, transition: Fx.Transitions.linear, onComplete: function(){lock_next=0}}).start(marginRight,marginRight-340);
    }
    countBanner++;
    if(countBanner == 6){
        countBanner = 1;
        $('cnt_banner').setStyle('marginLeft', '0');
        
    }
}

function clearBanner(){
    clearTimeout(animNav);
    animNav = setTimeout('moveNav()', 8000);
}

function ExpandText(){
    document.getElementById('box-expand').style.display = 'none';
    document.getElementById('box-collpase').style.display = 'block';
}

function CollapseText(){
    document.getElementById('box-expand').style.display = 'block';
    document.getElementById('box-collpase').style.display = 'none';
}

var animText;
var propertyText = 0;
var countText = 1;

function changeText(){
    $('cnt_link').effect('opacity', {duration: 500, transition: Fx.Transitions.linear, onComplete: function(){
        if(countText >= countTextLimit){
            propertyText = 0;
            countText = 1;
            $('cnt_link').setStyle('marginTop', '0');
            $('cnt_link').setOpacity('1');
        } else {
            propertyText -= 18;
            $('cnt_link').setStyle('marginTop', propertyText);
            $('cnt_link').setOpacity('1');
            countText++;
        }
        animText = setTimeout('changeText()', 1500);
    }}).start(1,0);
}

var animStuff;
var idStuff;
var mouseOver;
var controllStuff = 0;

propertyClass = function(){
    var elClass = document.getElementById('more_'+idStuff);
    if(elClass.className == 'more')
        elClass.className += ' hover';
    else
        elClass.className = 'more';
}

openStuff = function(idOpen){
    if(controllStuff == 0){
        idStuff = idOpen;
        propertyClass();
        mouseOver = document.getElementById('more_'+idStuff).onmouseover;
        document.getElementById('more_'+idStuff).onmouseover = null;
        document.getElementById('stuff_'+idStuff).style.display = 'block';
    }
    controllStuff = 1;
}

fixStuff = function(){
    if(controllStuff == 1){
        clearTimeout(animStuff);
    }
}

function timeCall(){
    if(controllStuff == 1){
        document.getElementById('stuff_'+idStuff).style.display = 'none';
        propertyClass();
        document.getElementById('more_'+idStuff).onmouseover = mouseOver;
        controllStuff = 0;
    }
}

closeStuff = function(){
    if(controllStuff == 1){
        clearTimeout(animStuff);
        animStuff = setTimeout("timeCall()", 300);
    }
}

function LimitChar(obj){
    var limit = 250;

    qtde = obj.value.length;
    
    if (qtde>limit) {
        obj.value = obj.value.substring(0,limit);
    } else {
        document.getElementById('count').innerHTML = (obj.value.length) + " - 250 characters.";
        
        if (obj.value.length < limit)
            document.getElementById('count').style.color = "#333";
        else
            document.getElementById('count').style.color = "#FF0000";
    }
}

function all_category(){
    document.getElementById('tab-info').style.display = "block";
}

function close_all_category(){
    document.getElementById('tab-info').style.display = "none";
}



/*function show(object) {
    if (document.getElementById && document.getElementById(object) != null)
         node = document.getElementById(object).style.display='block';
    else if (document.layers && document.layers[object] != null)
        document.layers[object].display = 'block';
    else if (document.all)
        document.all[object].style.display = 'block';
}
function hide(object) {
    if (document.getElementById && document.getElementById(object) != null)
         node = document.getElementById(object).style.display='none';
    else if (document.layers && document.layers[object] != null)
        document.layers[object].display = 'none';
    else if (document.all)
         document.all[object].style.display = 'none';
}*/


function activeArea(obj)
{
    document.getElementById(obj).style.display = 'block';
}
function endActive(obj)
{
    document.getElementById(obj).style.display = 'none';
}

function activeAreaSec(checkbox, box){
    
    //alert('teste');

    if(document.getElementById(checkbox).checked)
    {
        document.getElementById(box).style.display = 'block';
    }
    else
    {
        document.getElementById(box).style.display = 'none';
    }
}

/*function activeArea(obj){
    //document.getElementById(obj).style.background = "#EBEBEB";
    document.getElementById(obj).className = "on";
}
function endActive(obj){
    //document.getElementById(obj).style.background = "#FFF";
    document.getElementById(obj).className = "";
}*/

function activeAreaSupport(obj){
    document.getElementById(obj).style.background = "#C1E1F2";
    //document.getElementById(obj).className = "on";
}
function endActiveSupport(obj){
    document.getElementById(obj).style.background = "#E9F5FB";
    //document.getElementById(obj).className = "";
}



function scrollObject(main, width, height, direct, pause, speed) {
  var self = this;
  this.main = main;
  this.width = width;
  this.height = height;
  this.direct = direct;
  this.pause = pause;
  this.speed = Math.max(1.001, Math.min((direct == "up" || direct == "down") ? height : width, speed));
  this.slope = (direct == "up" || direct == "left") ? 1 : -1;
  this.prev = this.offset = 0;
  this.curr = 1;
  this.mouse = false;
  this.scroll = function() {
    this.main = document.getElementById(this.main);
    this.main.style.overflow = "hidden";
    this.main.style.position = "relative";
    this.main.style.width = this.width + "px";
    this.main.style.height = this.height + "px";
    var b = [], c;
    while (this.main.firstChild) if ((c = this.main.removeChild(this.main.firstChild)).nodeName == "DIV") b.push(c);
    for (var x = 0; x < b.length; x++) {
      var table = document.createElement('table');
          table.cellPadding = table.cellSpacing = table.border = "0";
          table.style.position = "absolute";
          table.style.left = table.style.top = "0px";
          table.style.width = table.style.height = "100%";
          table.style.overflow = table.style.visibility = "hidden";
        var tbody = document.createElement('tbody');
          var tr = document.createElement('tr');
            var td = document.createElement('td');
              while (b[x].firstChild)
                  td.appendChild(b[x].removeChild(b[x].firstChild));
              tr.appendChild(td);
            tbody.appendChild(tr);
          table.appendChild(tbody);
      this.main.appendChild(table);
    } b = c = null;
    if (this.main.childNodes.length > 1) {
      this.main.onmouseover = function() { self.mouse = true; };
      this.main.onmouseout = function() { self.mouse = false; };
      setInterval(function() {
        if (!self.offset && self.scrollLoop()) self.main.childNodes[self.curr].style.visibility = "visible";
      }, this.pause);
    } this.main.childNodes[this.prev].style.visibility = "visible";
  };
  this.scrollLoop = function() {
    if (!this.offset) {
      if (this.mouse) return false;
      this.offset = (this.direct == "up" || this.direct == "down") ? this.height : this.width;
    } else this.offset = Math.floor(this.offset / this.speed);
    if (this.direct == "up" || this.direct == "down") {
      this.main.childNodes[this.curr].style.top = (this.offset * this.slope) + "px";
      this.main.childNodes[this.prev].style.top = ((this.offset - this.height) * this.slope) + "px";
    } else {
      this.main.childNodes[this.curr].style.left = (this.offset * this.slope) + "px";
      this.main.childNodes[this.prev].style.left = ((this.offset - this.width) * this.slope) + "px";
    }
    if (!this.offset) {
      this.main.childNodes[this.prev].style.visibility = "hidden";
      this.prev = this.curr;
      if (++this.curr >= this.main.childNodes.length) this.curr = 0;
    } else setTimeout(function() { self.scrollLoop(); }, 30);
    return true;
  };
  if (window.addEventListener) {
    window.addEventListener('load', function() { self.scroll(); }, false); 
  } else if (window.attachEvent)
    window.attachEvent('onload', function() { self.scroll(); });
}
