function ArtistMoreInfo(){

    var imgBio = document.getElementById('imageArtists');
    var txtBio = document.getElementById('biographic');
    var btnBio = document.getElementById('moreInfo');

    if (txtBio.style.height == parseInt(imgBio.style.height) - 0 + 'px')
    {
        txtBio.style.height = 'auto';
        btnBio.innerHTML = 'Collapse Text';
    }
    else
    {
        txtBio.style.height = parseInt(imgBio.style.height) - 0 + 'px';
        btnBio.innerHTML = '+ More Info';
    }
}

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 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;
var linkId = 1;
var copyId = 2;
var countId = 1;
        
function play_sound(obj, id, sound_path) {
     
        
    if (sound == obj) {
        sound = null;
        document.getElementById('player').innerHTML = '';
    } else {
    
        sound = obj;
        
        if (!document.getElementById('player')) {
        
            var div = document.createElement('div');
            div.id = 'player';
            document.body.appendChild(div);
        }
                       
        var so = new Flash('/swf/player.swf', 'playsample', '0', '0', '8');
        so.addVariable('sound_path', sound_path);
        so.write('player');
       
    }
      
   if(countId == 1)
   {
        if(copyId != 2)
        {
            try {
                document.getElementById(copyId).className = '';
                document.getElementById(copyId).innerHTML = 'PLAY';
            }catch(e){}
            countId = 1;
        }
        
        document.getElementById(id).className = 'play';
        document.getElementById(id).innerHTML = 'STOP!';
        countId++;
        copyId = id;
    }
    else
    {
        if(copyId != id)
        {
            try {
                document.getElementById(copyId).className = '';
                document.getElementById(copyId).innerHTML = 'PLAY';
            }catch(e){}
                        
            document.getElementById(id).className = 'play';
            document.getElementById(id).innerHTML = 'STOP!';
            countId++;
            copyId = id;
        }
        else
        {
            document.getElementById(id).className = '';
            document.getElementById(id).innerHTML = 'PLAY';
            countId--;
        }
    }
    //Debug
    //console.log('sound_path: %s', Url.decode(sound_path));
    //console.log('id: %d', copyId);
}


var Url = {

    encode : function (string) {
        return escape(this._utf8_encode(string));
    },

    decode : function (string) {
        return this._utf8_decode(unescape(string));
    },

    _utf8_encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }

        return utftext;
    },

    _utf8_decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while ( i < utftext.length ) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }

        }

        return string;
    }

}


function resetVar()
{
    sound = null;
    linkId = 1;
    copyId = 2;
    countId = 1;
}



function openPopup(url)
{
var wscr =  screen.width;
var hscr = screen.height;
popup = window.open(url,'mywindow','"wscr","hscr",toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
    //popup = window.open(url, name , 'width=' + width + ' , height=' + height + ', scrollbars=yes, status = yes, menubar = yes, toolbar = yes, titlebar = yes, location = yes, directories = 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 AddToWishilist(itemId, isLogged)
{
    if (isLogged == 'True')
        window.location.href = '/AddToWishilist.aspx?ItemId='+ itemId;
    else
        showPopup('/Login.aspx');
}

// Recommend Friend - Change color of the box

function activeArea(obj){
    document.getElementById(obj).style.background = "#EBEBEB";
}
function endActive(obj){
    document.getElementById(obj).style.background = "#FFF";
}
