	function ownerVideoShow(){
		var arrow = document.getElementById("OwnerArrow"); 
		var isHidden = $('#OwnerContainer').is(':hidden'); 
		if (!isHidden){
			arrow.src = 'images/button_down.png';
			$("#OwnerContainer").hide('blind',{},800);
		}
		else{
			arrow.src = 'images/button_up.png';
			$("#OwnerContainer").toggle('blind',{},800);
		}
	}
	
	function embedShow(){
		var isHiddenDelete = $('#deleteContainer').is(':hidden');
		var isHiddenProblem = $('#problemContainer').is(':hidden');
		if (!isHiddenDelete){
			$("#deleteContainer").hide('blind',{},0);
		}
		
		if (!isHiddenProblem){
			$("#problemContainer").hide('blind',{},0);
		}
		
		var isHidden = $('#embedContainer').is(':hidden'); 
		if (!isHidden)
			$("#embedContainer").hide('blind',{},800);
		else
			$("#embedContainer").toggle('blind',{},800);
	}
	
	function showYoutube(){
		var isHidden = $('#youtubeExample').is(':hidden'); 
		if (!isHidden)
			$("#youtubeExample").hide('blind',{},800);
		else
			$("#youtubeExample").toggle('blind',{},800);
	}
	
	function deleteShow(){
		var isHiddenProblem = $('#problemContainer').is(':hidden');
		var isHiddenEmbed = $('#embedContainer').is(':hidden');
		if (!isHiddenProblem){
			$("#problemContainer").hide('blind',{},0);
		}
		
		if (!isHiddenEmbed){
			$("#embedContainer").hide('blind',{},0);
		}
		
		var isHidden = $('#deleteContainer').is(':hidden'); 
		if (!isHidden)
			$("#deleteContainer").hide('blind',{},800);
		else
			$("#deleteContainer").toggle('blind',{},800);
	}
	
	function problemShow(){
		var isHiddenDelete = $('#deleteContainer').is(':hidden');
		var isHiddenEmbed = $('#embedContainer').is(':hidden');
		if (!isHiddenDelete){
			$("#deleteContainer").hide('blind',{},0);
		}
		
		if (!isHiddenEmbed){
			$("#embedContainer").hide('blind',{},0);
		}	
		
		var isHidden = $('#problemContainer').is(':hidden'); 
		if (!isHidden)
			$("#problemContainer").hide('blind',{},800);
		else
			$("#problemContainer").toggle('blind',{},800);
	}
	
	function HideShowContainer(elementid){
		var isHidden= $('#'+elementid).is(':hidden');
		
		if (!isHidden){
			$('#'+elementid).hide('blind',{},800);
		}else{
			$('#'+elementid).toggle('blind',{},800);
		}	
	}
	
	function HideContainer(elementid){
		var isHidden= $('#'+elementid).is(':hidden');
		
		if (!isHidden){
			$('#'+elementid).hide('blind',{},0);
		}	
	}
	
	function openSingin(){
		var signinArrow = document.getElementById("signinArrow"); 
		var loginArrow = document.getElementById("loginArrow"); 
		$('html, body').animate({scrollTop:0}, 'slow'); 
		$('#countrySignin').addClass('hide');
		var isHidden = $('#signin').is(':hidden'); 
		if (!isHidden)
			return;
		
		if (signinArrow != null){
			if (isHidden) 
				signinArrow.src = 'images/up_arrow.png';
			else
				signinArrow.src = 'images/down_arrow.png';
		}

		$("#signin").toggle('blind',function(){
			if (isHidden){
				document.registration.fullname.focus();
				$('#countrySignin').removeClass('hide');
			}
		},800);
		$("#login").hide('blind',{},0);
		
		if (loginArrow != null)
			loginArrow.src = 'images/down_arrow.png';
	}
	
  	function openLogin(){
		var signinArrow = document.getElementById("signinArrow"); 
		var loginArrow = document.getElementById("loginArrow"); 
		$('#countrySignin').addClass('hide');
		$('html, body').animate({scrollTop:0}, 'slow'); 
		
		var isHidden = $('#login').is(':hidden'); 
		if (!isHidden)
			return;
		
		if (loginArrow != null){
			if (isHidden) 
				loginArrow.src = 'images/up_arrow.png';
			else
				loginArrow.src = 'images/down_arrow.png';
		}

		$("#login").toggle('blind',function(){
			if (isHidden)
				document.formlogin.username.focus();
		},800);
		
		$("#signin").hide('blind',{},0);
		
		if (signinArrow != null)
			signinArrow.src = 'images/down_arrow.png';
		
	}

	function runSingin(){
		var signinArrow = document.getElementById("signinArrow"); 
		var loginArrow = document.getElementById("loginArrow"); 
		var isHidden = $('#signin').is(':hidden'); 
		$('#countrySignin').addClass('hide');
		
		if (signinArrow != null){
			if (isHidden) 
				signinArrow.src = 'images/up_arrow.png';
			else
				signinArrow.src = 'images/down_arrow.png';
		}

		$("#signin").toggle('blind',function() {
			if (isHidden){
				document.registration.fullname.focus();
				$('#countrySignin').removeClass('hide');
			}	
		},800);
		
		$("#login").hide('blind',{},0);
		
		if (loginArrow != null)
			loginArrow.src = 'images/down_arrow.png';
		
	}

	function runInvitate(){
		var helpArrow = document.getElementById("helpArrow"); 
		var profileArrow = document.getElementById("profileArrow");
		var invitateArrow = document.getElementById("invitateArrow");
		var isHidden = $('#invitate').is(':hidden'); 
		$('#profilecountry').addClass('hide');
		
		if (invitateArrow != null){
			if (isHidden) 
				invitateArrow.src = 'images/up_arrow.png';
			else
				invitateArrow.src = 'images/down_arrow.png';
		}

		$("#invitate").toggle('blind',function (){
			if (isHidden)
				document.sendEmailToFriend.friendemail.focus();
		},800);
		$("#help").hide('blind',{},0);
		$("#profile").hide('blind',{},0);
		
		if (helpArrow != null)
			helpArrow.src = 'images/down_arrow.png';
		if (profileArrow != null)
			profileArrow.src = 'images/down_arrow.png';
	}
	
	function runLogin(){
		var signinArrow = document.getElementById("signinArrow"); 
		var loginArrow = document.getElementById("loginArrow"); 
		var isHidden = $('#login').is(':hidden');
		$('#countrySignin').addClass('hide');
		
		if (loginArrow != null){
			if (isHidden) 
				loginArrow.src = 'images/up_arrow.png';
			else
				loginArrow.src = 'images/down_arrow.png';
		}

		$("#login").toggle('blind',function (){
			if(isHidden)
				document.formlogin.username.focus();
		},800);
		
		$("#signin").hide('blind',{},0);

		if (signinArrow != null)
			signinArrow.src = 'images/down_arrow.png';
	}

	function runProfile(){
		var helpArrow = document.getElementById("helpArrow"); 
		var profileArrow = document.getElementById("profileArrow"); 
		var invitateArrow = document.getElementById("invitateArrow");
		var isHidden = $('#profile').is(':hidden'); 
		$('#profilecountry').addClass('hide');
		if (profileArrow != null){
			if (isHidden) 
				profileArrow.src = 'images/up_arrow.png';
			else
				profileArrow.src = 'images/down_arrow.png';
		}

		$("#profile").toggle('blind',function(){
			if (isHidden){
				document.formProfile.profilefullname.focus();
				setTimeout("$('#profilecountry').removeClass('hide')",100);
			}
		},800);
		$("#help").hide('blind',{},0);
		$("#invitate").hide('blind',{},0);

		if (helpArrow != null)
			helpArrow.src = 'images/down_arrow.png';
		if (invitateArrow != null)
			invitateArrow.src = 'images/down_arrow.png';
	}

	function runHelp(){
		var helpArrow = document.getElementById("helpArrow"); 
		var profileArrow = document.getElementById("profileArrow");
		var invitateArrow = document.getElementById("invitateArrow");
		var isHidden = $('#help').is(':hidden');
		$('#profilecountry').addClass('hide');
		
		if (helpArrow != null){
			if (isHidden) 
				helpArrow.src = 'images/up_arrow.png';
			else
				helpArrow.src = 'images/down_arrow.png';
		}

		$("#help").toggle('blind',{},1000);
		$("#profile").hide('blind',{},0);
		$("#invitate").hide('blind',{},0);

		if (profileArrow != null)
			profileArrow.src = 'images/down_arrow.png';
		
		if (invitateArrow != null)
			invitateArrow.src = 'images/down_arrow.png';
	}
	
	function searchkeypress(event) {
		  var code;
		  if (!event.which){
			event = window.event;
			code = event.keyCode; 
		  }
		  else
		  {
			  if (event && event.which) 
				  code = event.which;
		  }
		  if(code == 13)
			  $("#searchbutton").click();
	}
	  
	function getFlashMovie(movieName) 
	{   
		var isIE = navigator.appName.indexOf("Microsoft") != -1;   
		return (isIE) ? window[movieName] : document[movieName];  
	}  
	
	function formSend() 
	{
		try{
			getFlashMovie("soundplayer").sendTextToFlash('intro');
		}catch(err){}
	}
 
	function playlogin(){
		formSend();
		createUploader();
	}
	
	function logout(){
		setResetPasword();
	}
	
	function setUpload(){
		$('#uploadify').uploadify({
				'uploader': 'uploadify/uploadify.swf',
				'script': 'uploadify/uploadify.php',
				'fileDesc': 'Audio files (.mp3)',
				'buttonText': 'Upload',
				'queueSizeLimit' : 1,  
				'fileExt': '*.mp3',
				'queueID': 'fileQueue',
				'folder': 'songs',
				'auto'  : true,
				'cancelImg': 'uploadify/cancel.png',
				'onSelect' : function(){setValues();},
				'onComplete': function(a, b, c, d, e){if(Number(d) > 0) {window.location.href = 'lyric_editor.php?iid=' + d + '&edit=1'} else {$('#messageerror').html(d);} }
		});
		
		$('#originalsongname').keyup(function() {
			if (!ValidateUpload(false)){
				$('#uploadProtect').css({'z-index' : '20'});
			}else{
				$('#uploadProtect').css({'z-index' : '5'});
			}	
		});
		
		$('#authorname').keyup(function() {
			if (!ValidateUpload(false)){
				$('#uploadProtect').css({'z-index' : '20'});
			}else{
				$('#uploadProtect').css({'z-index' : '5'});
			}	
		});
		
		$('#youtubeURL').change(function() {
			if (!ValidateUpload(false)){
				$('#uploadProtect').css({'z-index' : '20'});
			}else{
				$('#uploadProtect').css({'z-index' : '5'});
			}	
		});
		
	}
	
	function setValues()
	{
		$('#uploadify').uploadifySettings(
			    'scriptData', {'songname' : $('#originalsongname').val(), 'authorname' : $('#authorname').val(), 'lyrics' : $('#lyrics').val(), 'songtype' : $('#songtype').val(),'guid':$('#guid').val(), 'youtubeURL':$('#youtubeURL').val()}
			    );
	}
	
	function setResetPasword()
	{
		$("#pass").click(function(){
			$("#forgetpassword").slideToggle("slow");
			$(this).toggleClass("active");
		});
		$('#loginpassword').bind('keypress', function(e) {
		    if(e.keyCode==13){
		    	$('#loginbutton').focus();
		    	$('#loginbutton').click();
		    	return false;
		    }
		});
		
		Init_KeyPress_FriendMail();
	}
	
	
	function Init_KeyPress_FriendMail(){
		$('#friendemail').bind('keypress', function(e) {
		    if(e.keyCode==13){
		    	$('#loginInvitateButton').focus();
		    	$('#loginInvitateButton').click();
		    	return false;
		    }
		});
	}

