

function changeTab(tab)
{
	/*document.getElemenyById('first-tab');
	document.getElemenyById('second-tab');
	document.getElemenyById('third-tab');
	document.getElemenyById('fourth-tab');*/
	 var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
	 if(is_chrome){
	 document.getElementById('ttt').style.top = (getY(tab)+2)+'px';
	 }
	 else{
	 document.getElementById('ttt').style.top = (getY(tab)+1)+'px';
	 }
	
	document.getElementById('ttt').style.left = (getX(tab)-3)+'px';
	
	if  (selectedFormTab==tab.id) return;
	selectedFormTab=tab.id;
	
	$('#right-content-form-container-content').fadeOut(100,function(){
	    unselectAllTabs();
	    tab.style.cursor = "auto";
	    switch(tab.id)
	    {
		    case 'first-tab': 
			    tab.style.backgroundPosition="-67px 46px";
			    document.getElementById('prayer-times').style.display="block";
		    break;
    			
		    case 'second-tab':
			    tab.style.backgroundPosition="0px 46px";
			    document.getElementById('poll').style.display="block";
		    break;
    		
		    case 'third-tab':
			    tab.style.backgroundPosition="-134px 46px";
			    document.getElementById('mail-list').style.display="block";
		    break;
    		
		    case 'fourth-tab':
			    tab.style.backgroundPosition="-201px 46px";
			    document.getElementById('weather').style.display="block";
		    break;
	    }
	$('#right-content-form-container-content').fadeIn(50);
	});

}

function unselectAllTabs()
{
	
	document.getElementById('prayer-times').style.display="none";	
	document.getElementById('poll').style.display="none";	
	document.getElementById('mail-list').style.display="none";
	document.getElementById('weather').style.display="none";
	
	unHoverAllFormTabs();

}


function hoverFormTab(topX)
{
	unHoverAllFormTabs();
	
	
	
	switch(topX.id)
	{
		case 'first-tab': 
			topX.style.backgroundPosition="-67px 46px";
		break;
			
		case 'second-tab':
			topX.style.backgroundPosition="0 46px";
		break;
		
		case 'third-tab':
			topX.style.backgroundPosition="-134px 46px";
		break;
		
		case 'fourth-tab':
			topX.style.backgroundPosition="-201px 46px";
		break; 
	}
	
	
}

function unHoverAllFormTabs()
{
	if(selectedFormTab!='first-tab'){
		document.getElementById('first-tab').style.backgroundPosition="-67px 0";
		document.getElementById('first-tab').style.cursor="pointer";
		}
	if(selectedFormTab!='second-tab')	{
		document.getElementById('second-tab').style.backgroundPosition="0 0";
		document.getElementById('second-tab').style.cursor="pointer";
		}
	if(selectedFormTab!='third-tab'){
		document.getElementById('third-tab').style.backgroundPosition="-134px 0";
		document.getElementById('third-tab').style.cursor="pointer";
		}
	if(selectedFormTab!='fourth-tab'){
		document.getElementById('fourth-tab').style.backgroundPosition="-201px 0";
		document.getElementById('fourth-tab').style.cursor="pointer";
		}

	
}

function unHoverFormTab(topX)
{
	if(topX.id!=selectedFormTab)
		{
		
			switch(topX.id)
			{
				case 'first-tab':
					document.getElementById('first-tab').style.backgroundPosition="-67px 0";
				break;
					
				case 'second-tab':
					document.getElementById('second-tab').style.backgroundPosition="0 0";
				break;
				
				case 'third-tab':
					document.getElementById('third-tab').style.backgroundPosition="-134px 0";
				break;
				
				case 'fourth-tab':
					document.getElementById('fourth-tab').style.backgroundPosition="-201px 0";
				break;
			}
			
		}
		
}



function selectTopTab(topX) {
    if (topSelected == topX.id)
        return;

    topSelected = topX.id; 
    unselectAllTopTabs();
    simHoverTop(topX);
    switch (topX.id) {
        case 'top-videos': document.getElementById('videos').style.display = "block";

            break;

        case 'top-albums': document.getElementById('albums').style.display = "block";

            break;

        case 'top-intro': document.getElementById('intro').style.display = "block";

            break;

        case 'top-sponsors': document.getElementById('sponsors').style.display = "block";

            break;
    } 
}

function unselectAllTopTabs()
{ 
    document.getElementById('videos').style.display = "none"; 
    document.getElementById('albums').style.display = "none"; 
    document.getElementById('intro').style.display = "none"; 
    document.getElementById('sponsors').style.display = "none";

    unHoverAllTopTabs();
}

function simHoverTop(topX) { 
    topX.style.backgroundPosition = "0 -34px"; 
}

function simUnHoverTop(topX) {  
	if(topX.id!=topSelected)
	    topX.style.backgroundPosition = "0 0"; 
}





function unHoverAllTopTabs() { 
    if (topSelected != 'top-videos') {
        document.getElementById('top-videos').style.backgroundPosition = "0 0";
        document.getElementById('top-videos').style.cursor = "pointer";
    }
    if (topSelected != 'top-albums') {
        document.getElementById('top-albums').style.backgroundPosition = "0 0";
        document.getElementById('top-albums').style.cursor = "pointer";
    }
    if (topSelected != 'top-intro') {
        document.getElementById('top-intro').style.backgroundPosition = "0 0";
        document.getElementById('top-intro').style.cursor = "pointer";
    }
    if (topSelected != 'top-sponsors') {
        document.getElementById('top-sponsors').style.backgroundPosition = "0 0";
        document.getElementById('top-sponsors').style.cursor = "pointer";
    } 

}
