


function sendComment()
{
var nick = document.getElementById('comment_nick').value;
var comment = document.getElementById('comment').value;
var record_id = document.getElementById('record_id').value;

if( comment == "" )
{
  alert("Wpisz tresc komentarza");
  return false;
}

if( nick == "" )
{
  alert("Podaj swoj nick");
  return false;
}

advAJAX.post({
    url: "http://oggole.pl/ajax/sendcomment.html",
    parameters : {
          "sid" : ""+document.getElementById('sid').innerHTML,          
          "nick"      : ""+nick,
          "comment"   : ""+comment,
          "record_id" : ""+record_id
    },
    onSuccess : function(obj) { hideCommentBox(); },
    onError : function(obj) { alert("Error: " + obj.status); },
    "var3" : "value3"
}); 

}


function sendPlaylistComment()
{
var nick = document.getElementById('comment_nick').value;
var comment = document.getElementById('comment').value;
var playlist_id = document.getElementById('record_id').value;

if( comment == "" )
{
  alert("Wpisz tresc komentarza");
  return false;
}

if( nick == "" )
{
  alert("Podaj swoj nick");
  return false;
}

advAJAX.post({
    url: "http://oggole.pl/ajax/sendplaylistcomment.html",
    parameters : {
          "sid" : ""+document.getElementById('sid').innerHTML,          
          "nick"      : ""+nick,
          "comment"   : ""+comment,
          "playlist_id" : ""+playlist_id
    },
    onSuccess : function(obj) { hideCommentBox(); },
    onError : function(obj) { alert("Error: " + obj.status); },
    "var3" : "value3"
}); 

}





function badRecordBox()
{
var record_id = document.getElementById('record_id').value;

advAJAX.post({
    url: "http://oggole.pl/ajax/badrecord.html",
    parameters : {
          "record_id" : ""+record_id
    },
    onSuccess : function(obj) { alert("Dziekujemy! Zgloszenie zostalo zarejestrowane"); },
    onError : function(obj) { alert("Error: " + obj.status); },
    "var3" : "value3"
}); 

}


function hideCommentBox()
{
document.getElementById('comment_box').style.display = 'none';
document.getElementById('comment_sent').style.display = '';
}


function sendFriendBox()
{
document.getElementById('comment_box').style.display = 'none';
document.getElementById('comment_sent').style.display = 'none';
document.getElementById('send_friend').style.display = '';
}

function sendFriend()
{
var name = document.getElementById('sender_name').value;
var email = document.getElementById('email').value;
var text = document.getElementById('mailtext').value;
var record_id = document.getElementById('record_id').value;

advAJAX.post({
    url: "http://oggole.pl/ajax/sendmail.html",
    parameters : {
          "name"      : ""+name,
          "email"     : ""+email,
          "text"      : ""+text,
          "record_id" : ""+record_id
    },
    onSuccess : function(obj) { alert("Wiadomosc zostala wyslana!"); },
    onError : function(obj) { alert("Error: " + obj.status); },
    "var3" : "value3"
}); 

document.getElementById('comment_box').style.display = '';
document.getElementById('comment_sent').style.display = 'none';
document.getElementById('send_friend').style.display = 'none';

}


function sendFriendPlaylist()
{
var name = document.getElementById('sender_name').value;
var email = document.getElementById('email').value;
var text = document.getElementById('mailtext').value;
var record_id = document.getElementById('record_id').value;

advAJAX.post({
    url: "http://oggole.pl/ajax/sendmailplaylist.html",
    parameters : {
          "name"      : ""+name,
          "email"     : ""+email,
          "text"      : ""+text,
          "record_id" : ""+record_id
    },
    onSuccess : function(obj) { alert("Wiadomosc zostala wyslana!"); },
    onError : function(obj) { alert("Error: " + obj.status); },
    "var3" : "value3"
}); 

document.getElementById('comment_box').style.display = '';
document.getElementById('comment_sent').style.display = 'none';
document.getElementById('send_friend').style.display = 'none';

}


function inf()
{
 alert('Uzyj prawego klawisza myszy i wybierze "Zapisz elemend docalowy jako..."');
}

function validateContactForm()
{

}



function loadPage(page, objId)
{

if(!objId)
    objId = 'page';

advAJAX.post({
    url: "http://oggole.pl/ajax/loadpage.html",
    parameters : {
          "page" : ""+page,
          "sid" : ""+document.getElementById('sid').innerHTML          
    },
    onSuccess : function(obj) { document.getElementById(objId).innerHTML = obj.responseText; },
    onError : function(obj) { alert("Error: " + obj.status); },
    "var3" : "value3"
}); 

}



function saveForm(destination, fields)
{
    var postFields = new Array();

    fieldArray = fields.split(",");

    for(i=0; i<fieldArray.length; i++)
	postFields[fieldArray[i]] = document.getElementById(fieldArray[i]).value;

    postFields['sid']  = document.getElementById('sid').innerHTML;

    advAJAX.post({
	url: "http://oggole.pl/ajax/"+destination+".html",
	parameters : postFields,
	onSuccess : function(obj) { document.getElementById('saveResponse').innerHTML = obj.responseText; },
	onError : function(obj) { alert("Error: " + obj.status); }
    }); 

}



function init() {
	document.getElementById("file_upload_form").target = "upload_target";
	document.getElementById("upload_target").onload = uploadDone;
}

				    
function uploadDone() {
    var ret = frames['upload_target'].document.getElementsByTagName("body")[0].innerHTML;
    
    document.getElementById("avatarImage").src = ret; 
}


function loadPlaylist(id)
{
    advAJAX.post({
	url: "http://oggole.pl/ajax/loadplaylist.html",
	parameters : {
            "playlist_id" : ""+id,
            "sid" : ""+document.getElementById('sid').innerHTML          
	},
	onSuccess : function(obj) { document.getElementById('playList').innerHTML = obj.responseText; },
	onError : function(obj) { alert("Error: " + obj.status); }
    }); 

    advAJAX.post({
	url: "http://oggole.pl/ajax/loadplaylistlink.html",
	parameters : {
            "playlist_id" : ""+id,
            "sid" : ""+document.getElementById('sid').innerHTML          
	},
	onSuccess : function(obj) { document.getElementById('playListId').innerHTML = obj.responseText; 
				    document.getElementById('playListIdBox').style.display = '';
				  },
	onError : function(obj) { alert("Error: " + obj.status); }
    }); 

}


function delPlaylist(id)
{
    advAJAX.post({
	url: "http://oggole.pl/ajax/delplaylist.html",
	parameters : {
            "playlist_id" : ""+id,
            "sid" : ""+document.getElementById('sid').innerHTML          
	},
	onSuccess : function(obj) { document.getElementById('saveResponse').innerHTML = obj.responseText; },
	onError : function(obj) { alert("Error: " + obj.status); }
    }); 

}


function delPlaylistRecord(id, record_id)
{
    advAJAX.post({
	url: "http://oggole.pl/ajax/delplaylistrecord.html",
	parameters : {
            "id" : ""+id,
            "playlist_id" : ""+record_id,
            "sid" : ""+document.getElementById('sid').innerHTML          
	},
	onSuccess : function(obj) { document.getElementById('playList').innerHTML = obj.responseText; },
	onError : function(obj) { alert("Error: " + obj.status); }
    }); 

}


function playlistAdd()
{
    advAJAX.post({
	url: "http://oggole.pl/ajax/loadplaylistpublic.html",
	parameters : {
            "sid" : ""+document.getElementById('sid').innerHTML          
	},
	onSuccess : function(obj) { document.getElementById('comment_box').innerHTML = obj.responseText; },
	onError : function(obj) { alert("Error: " + obj.status); },
	"var3" : "value3"
    }); 

}


function playlistAddRecord()
{
    advAJAX.post({
	url: "http://oggole.pl/ajax/playlistaddrecord.html",
	parameters : {
            "playlist_id" : ""+document.getElementById('playlist_id').value,
            "record_id"   : ""+document.getElementById('record_id').value,
            "sid"         : ""+document.getElementById('sid').innerHTML          
	},
	onSuccess : function(obj) { document.getElementById('comment_box').innerHTML = obj.responseText; },
	onError : function(obj) { alert("Error: " + obj.status); }
    }); 

}


    var letters='ABCDEFGHIJKLMNOPRSTUQVWXYZabcdefghijklmnoprstuqvwxyz-_'
    var numbers='1234567890'
    var signs=',.:;@-\''
    var mathsigns='+-=()*/'

function alpha(e,allow)
{
    var custom='<>#$%&?.'

    var k;
    k=document.all?parseInt(e.keyCode): parseInt(e.which);
    return (allow.indexOf(String.fromCharCode(k))!=-1 || k == 8);
}


function shAd()
{
    setTimeout("actAd()", 1100);
}

function shAdWyniki()
{
    setTimeout("actAdWyniki()", 2000);
}

function actAd()
{
    document.getElementById('rekBox').style.display="";
}

function actAdWyniki()
{
    document.getElementById('rekBoxWyniki').style.display="";
}
