//Javascript for displaying
var art;
var interval;
var xmlHttp;

var site_url="http://www.do2006taxes.com";

function showImg(a)//Function for diplaying the image in a popup div
{
    var image_file=site_url+'/media/morephotos_big/'+a;
    //var bht=window.innerHeight;
    //var bwt=window.innerWidth;
    var bht=document.getElementById("ht").offsetHeight;
    var bwt=document.getElementById("ht").offsetWidth;
    
    
    document.getElementById('overlay').style.display="block";
    document.getElementById('overlay').style.height=bht+30;
    document.getElementById('overlay').style.width=bwt+20;
    
    popUpShow();
    document.getElementById('dispImg').innerHTML='';
    document.getElementById('dispImg').innerHTML='<img src="'+image_file+'.jpg" border="0" alt="'+a+'"/>';
}


function menuIn(t)
{
	document.getElementById(t).style.backgroundImage="url("+site_url+"/images/orange_menu.gif)";
}
function menuOut(t)
{
	document.getElementById(t).style.backgroundImage="url("+site_url+"/images/blue_menu.gif)";
}
function leftMenuIn(t)
{
	t.style.backgroundColor="#FC7C00";
}
function leftMenuOut(t)
{
	t.style.backgroundColor="transparent";
}

function showCtrList()
{
    document.getElementById('country_list').style.display="block";
}

function hideCtrList()
{
    document.getElementById('country_list').style.display="none";
}

function displayCtrData(a,b)
{
    var country_code=a;
    var country_name=b.substring(0,20);
    var show_data='<img src="flags_png/'+country_code+'.png" align="absmiddle"/>&nbsp;&nbsp;'+country_name;
    document.getElementById('select_country').innerHTML=show_data;
    //alert(show_data);
}


//****Function for displaying artist bio using Ajax****//
function showBio(b)
{
    var bht=document.getElementById("ht").offsetHeight;
    var bwt=document.getElementById("ht").offsetWidth;
    
    document.getElementById('overlay').style.display="block";
    document.getElementById('overlay').style.height=bht+30;
    document.getElementById('overlay').style.width=bwt+20;
            
    popUpBioShow();
            
    startRequest_Bio(b);
}

function createXMLHttpRequest()
{
    if(window.ActiveXObject)
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    if(window.XMLHttpRequest)
    xmlHttp=new XMLHttpRequest();
}

function startRequest_Bio(art)
{    
    url = "http://www.do2006taxes.com/get_artist_bio?aid=";    
    createXMLHttpRequest();
    xmlHttp.open("GET",url+art,true);
    xmlHttp.onreadystatechange=handleStateChange1;
    xmlHttp.send(null);
}

function handleStateChange1()
{

    if(xmlHttp.readyState==1)
    {
        document.getElementById('dispBio').innerHTML='<font color="#FF6600">Retriving Biography...</font>';        
        //setTimeout("handleStateChange()",100);
    }
    if(xmlHttp.readyState==4)
    {
        if(xmlHttp.status==200)
        {
            clearInterval(interval);
            var reply_bio=xmlHttp.responseText;
            bio_string=reply_bio;
                        
            document.getElementById('dispBio').innerHTML='';
            
            document.getElementById("dispBio").innerHTML=bio_string;
        }
    }
}


//*****End of displaying artist bio******//


//****Function for ratting the artist ringtone******//
function ringtoneRatingFunction(rt_id,no)
{
    var nos=Number(no)+1;
    url1 = "insert_ringtone_rating?rid="+rt_id+"&no="+nos; 
    createXMLHttpRequest();
    xmlHttp.open("GET",url1,true);
    xmlHttp.onreadystatechange=handleRingtone;
    xmlHttp.send(null);
}

function handleRingtone()
{
    if(xmlHttp.readyState==4)
    {
        if(xmlHttp.status==200)
        {
            location.reload(true);
        }
    }
}
//***End of raingtone rattings*****//



//******Function for geneerating next ringtones******//

function getMoreRt(c,d)
{       
    startRequest_Ringtone(c,d);
}

function startRequest_Ringtone(rt,aid)
{    
    url = "http://www.do2006taxes.com/artist_rts?rt_pg=";    
    createXMLHttpRequest();
    xmlHttp.open("GET",url+rt+"&aid="+aid,true);
    xmlHttp.onreadystatechange=handleStateChange2;
    xmlHttp.send(null);    
}

function handleStateChange2()
{

    if(xmlHttp.readyState==1)
    {
        document.getElementById('disp_ringtones').innerHTML='';
        document.getElementById('disp_ringtones').innerHTML='<img src="'+site_url+'/images/loader_big_green.gif" border="0" align="absmiddle" />';        
        setTimeout("handleStateChange2()",1000);
    }
    if(xmlHttp.readyState==4)
    {
        if(xmlHttp.status==200)
        {
            clearInterval(interval);
            var reply_tones=xmlHttp.responseText;
            tones_string=reply_tones;
            document.getElementById("disp_ringtones").innerHTML=tones_string;
        }
    }
}
