function openOverlay()
{	
	new Effect.Appear("id_overlay_box_export", {duration:0.5});
}
function closeOverlay()
{	
	new Effect.Fade("id_overlay_box_export", {duration:0.5});
}

function send_image_dest_my_pri(message_id)
{
    var dest = document.Formular_1.album_id.value;
    new Ajax.Request('/my_profile/move_image_to_album/'+dest+'?message_id='+message_id, {asynchronous:true, evalScripts:true}); 
    return false;
    
}

function send_image_dest_my_pub(message_id)
{
    var dest = document.Formular_2.album_id.value;
    new Ajax.Request('/my_profile/move_image_to_album/'+dest+'?message_id='+message_id, {asynchronous:true, evalScripts:true}); 
    return false;
    
}

function send_image_dest_pub(message_id)
{
    var dest = document.Formular_3.album_id.value;
    new Ajax.Request('/my_profile/move_image_to_album/'+dest+'?message_id='+message_id, {asynchronous:true, evalScripts:true}); 
    return false;
    
}

function send_show_count(str)
{
	var count = document.form1.show_count.value;
	new Ajax.Request(str+"?count="+count, {asynchronous:true, evalScripts:true}); return false;
}

function send_note(user_id)
{
    var note = document.getElementsByName("form_"+user_id)[0].value;
    new Ajax.Request('/admin/add_note/'+user_id+'?note='+note, {asynchronous:true, evalScripts:true}); 
    return false;
    
}

function wait_twitter_box(name)
{
	window.setTimeout('reload_twitter_box("'+name+'")',5000);
}

function reload_twitter_box(name)
{
	new Ajax.Request('/Twitterbox/'+name, {asynchronous:true, evalScripts:true}); 
}

function CXO_WriteBanner(string)
{     
}

function send_album_create()
{                                    
    var album = document.AlbumCreate.title.value;
    document.AlbumCreate.title.value = ""
    if (document.AlbumCreate.category.item(0).checked)
    {
        var category =  document.AlbumCreate.category.item(0).value;
    };
    if (document.AlbumCreate.category.item(1).checked)
    {
        var category =  document.AlbumCreate.category.item(1).value;
    };
    if (document.AlbumCreate.category.item(2).checked)
    {
        var category =  document.AlbumCreate.category.item(2).value;
    };
    
    new Ajax.Request('/my_profile/create_album/?title='+album+'&category='+category, {asynchronous:true, evalScripts:true}); 
    
    return false;
    
}

function change_state()
{                                    
    if (document.AlbumState.category.item(0).checked)
    {
        var category =  document.AlbumCreate.category.item(0).value;
    };
    if (document.AlbumState.category.item(1).checked)
    {
        var category =  document.AlbumCreate.category.item(1).value;
    };
    if (document.AlbumState.category.item(2).checked)
    {
        var category =  document.AlbumCreate.category.item(2).value;
    };    
    new Ajax.Request('/my_profile/change_album_state/?category='+category, {asynchronous:true, evalScripts:true}); 
    
    return false;
    
}

function send_album_create_ext()
{                                    
    var album = document.AlbumCreate.title.value;

    if (document.AlbumCreate.category.item(0).checked)
    {
        var category =  document.AlbumCreate.category.item(0).value;
    };
    if (document.AlbumCreate.category.item(1).checked)
    {
        var category =  document.AlbumCreate.category.item(1).value;
    };
    if (document.AlbumCreate.category.item(2).checked)
    {
        var category =  document.AlbumCreate.category.item(2).value;
    };
    
    new Ajax.Request('/my_profile/create_album/?title='+album+'&category='+category, {asynchronous:true, evalScripts:true}); 
    return false;
    
}


function eventtester(s,e,event)
{
    alert(event.target);
    new Effect.Appear(e);
    node = document.getElementById(s);
    Event.stopObserving(s,'load');
    //node.releaseEvent();
        
}

function addEventListner(s,t)
{
    alert('mh');
    Event.observe(s, 'load', function(e){eventtester(s,t,e);});
    node = document.getElementById(s);
    node.onload();
    
}

function change_type(id)
{   
    var node_id = new String("Device_")
    var node = document.getElementById(node_id.concat(id))
    var dest = node.album_id.value;
    new Ajax.Request('/admin/update_device_type/'+id+'?device_type='+dest, {asynchronous:true, evalScripts:true}); 
    return false;
}


function change_password()
{
    var user_id = document.getElementById('user_id').value
    var customer_id = document.getElementById('customer_id').value
    var old_password = document.getElementById('old_password').value
    var new_password = document.getElementById('new_password').value
    var new_password_confirm = document.getElementById('new_password_confirm').value
    new Ajax.Request('/user/change_pwd', {
           method:'post',
           asynchronous:true, 
           evalScripts:true, 
           postBody:'user[user_id]='+user_id+'&user[customer_id]='+customer_id+'&user[old_password]='+old_password+'&user[password]='+new_password+'&user[password_confirmation]='+new_password_confirm
        });
    return false;
}

function stop_abo_text(text){
    Check = confirm(text);
    if(Check == true){      
        stop_abo();
    }

}
function stop_abo()
{    
    new Ajax.Request('/user/stop_abo', {
           method:'post',
           asynchronous:true, 
           evalScripts:true            
        });
    return false;
}

function reactivate_abo ()
{
    new Ajax.Request('/user/reactivate_abo', {
           method:'post',
           asynchronous:true, 
           evalScripts:true            
        });
    return false;
}

function submitform(form_name)
{
    elements = document.getElementsByName(form_name);
    elements[0].submit();
}
