// JavaScript Document
var x;
var y;
jQuery(document).ready(function(){
   $().mousemove(function(e){
      x = e.pageX;
	  y = e.pageY;
   }); 
});

function editTop(id){
	document.getElementById( 'diaboxtop' ).style.visibility = 'visible';
}

function editTop2(id){
	document.getElementById( 'diaboxtop2' ).style.visibility = 'visible';
}

function editTop3(id){
	document.getElementById( 'diaboxtop3' ).style.visibility = 'visible';
}


function editList(id){
	y = y - 368;
	x = 250;
	var top = y +'px';
	var left = x +'px';
	document.getElementById( 'diaboxlist' ).style.visibility = 'visible';
	document.getElementById( 'diaboxlist' ).style.top = top ;
	document.getElementById( 'diaboxlist' ).style.left = left ;
	
	
	var titleID = id+'titlelist';
	var title = document.getElementById( titleID ).innerHTML; 

	var urlID = id+'contentlist';
	var url = document.getElementById( urlID ).innerHTML ;

	var emailID = id+'emaillist';
	var email = document.getElementById( emailID ).innerHTML ;

	
	document.getElementById( 'titlelist' ).value = title;
	document.getElementById( 'indexlist' ).value = id;
	document.getElementById( 'emaillist' ).value = email;
	document.getElementById( 'contentlist' ).focus();
	tinyMCE.activeEditor.setContent( url );

	
	document.getElementById( 'toptitlelist' ).innerHTML = "Edit entry - " + title;	
}

function addList(){
	y = y - 368;
	x = 250;
	var top = y +'px';
	var left = x +'px';
	document.getElementById( 'diaboxlist' ).style.visibility = 'visible';
	document.getElementById( 'diaboxlist' ).style.top = top ;
	document.getElementById( 'diaboxlist' ).style.left = left ;
	document.getElementById( 'toptitlelist' ).innerHTML = "Add entry...";
	
	document.getElementById( 'titlelist' ).value = '';
	document.getElementById( 'emaillist' ).value = '';
	document.getElementById( 'indexlist' ).value = 'x';

	document.getElementById( 'contentlist' ).focus();
	tinyMCE.activeEditor.setContent( '' );

}

function deleteList(id){
 var where_to= confirm("Do you really want to delete this entry? ");
 if (where_to== true)
 {
 	var delurl = "delete_lace.php?id="+id;
    window.location=delurl;
 }
}

function deleteListTeam(id){
 var where_to= confirm("Do you really want to delete this entry? ");
 if (where_to== true)
 {
 	var delurl = "delete_team.php?id="+id;
    window.location=delurl;
 }
}

function deleteListAk(id){
 var where_to= confirm("Do you really want to delete this entry? ");
 if (where_to== true)
 {
 	var delurl = "delete_Ak.php?id="+id;
    window.location=delurl;
 }
}


function deleteLight(id){
 var where_to= confirm("Do you really want to delete this entry? ");
 if (where_to== true)
 {
 	var delurl = "delete_light.php?id="+id;
    window.location=delurl;
 }
}

function delGal(id,page){
 var where_to= confirm("Do you really want to delete this image? ");
 if (where_to== true)
 {
 	var delurl = "delete_gal.php?id="+id+"&page="+page;
    window.location=delurl;
 }
}

function delgallart(id){
 var where_to= confirm("Do you really want to delete this image? ");
 if (where_to== true)
 {
 	var delurl = "delete_gal_art.php?id="+id;
    window.location=delurl;
 }
}


function editLink(id){
	y = y - 241;
	var top = y +'px';
	var left = x +'px';
	document.getElementById( 'diabox' ).style.visibility = 'visible';
	document.getElementById( 'diabox' ).style.top = top ;
	document.getElementById( 'diabox' ).style.left = left ;
	document.getElementById( 'toptitle' ).innerHTML = "Edit link...";
	
	var titleID = id+'title';
	var title = document.getElementById( titleID ).innerHTML; 
	var urlID = id+'URL';
	var url = document.getElementById( urlID ).innerHTML ;
	
	document.getElementById( 'linkURL' ).value = url;
	document.getElementById( 'linkTitle' ).value = title;
	document.getElementById( 'linkIndex' ).value = id;
	document.getElementById( 'linkTitle' ).focus();
}

function addLink(){
	y = y - 222;
	var top = y +'px';
	var left = x +'px';
	document.getElementById( 'diabox' ).style.visibility = 'visible';
	document.getElementById( 'diabox' ).style.top = top ;
	document.getElementById( 'diabox' ).style.left = left ;
	document.getElementById( 'toptitle' ).innerHTML = "Add link...";
	
	document.getElementById( 'linkURL' ).value = '';
	document.getElementById( 'linkTitle' ).value = '';
	document.getElementById( 'linkIndex' ).value = 'x';
	document.getElementById( 'linkTitle' ).focus();
}

function deleteLink(id){
 var where_to= confirm("Do you really want to delete this link? ");
 if (where_to== true)
 {
 	var delurl = "delete_link.php?id="+id;
    window.location=delurl;
 }
}


function editDl(id){
	y = y - 222;
	var top = y +'px';
	var left = x +'px';
	document.getElementById( 'diaboxdl' ).style.visibility = 'visible';
	document.getElementById( 'diaboxdl' ).style.top = top ;
	document.getElementById( 'diaboxdl' ).style.left = left ;
	document.getElementById( 'toptitledl' ).innerHTML = "Edit download...";
	document.getElementById( 'fileuploadwarning' ).style.visibility = 'visible';
	
	var titleID = id+'titledl';
	var title = document.getElementById( titleID ).innerHTML; 
	var urlID = id+'URLdl';
	var url = document.getElementById( urlID ).innerHTML ;
	
	document.getElementById( 'linkTitledl' ).value = title;
	document.getElementById( 'linkIndexdl' ).value = id;
	document.getElementById( 'linkTitledl' ).focus();
}

function addDL(){
	y = y - 222;
	var top = y +'px';
	var left = x +'px';
	document.getElementById( 'diaboxdl' ).style.visibility = 'visible';
	document.getElementById( 'diaboxdl' ).style.top = top ;
	document.getElementById( 'diaboxdl' ).style.left = left ;
	document.getElementById( 'toptitledl' ).innerHTML = "Add download...";
	document.getElementById( 'fileuploadwarning' ).style.visibility = 'hidden';
	
	document.getElementById( 'linkURLdl' ).value = '';
	document.getElementById( 'linkTitledl' ).value = '';
	document.getElementById( 'linkIndexdl' ).value = 'x';
	document.getElementById( 'linkTitledl' ).focus();
}

function addGal(id){
	y = y - 222;
	x = 330;
	var top = y +'px';
	var left = x +'px';
	document.getElementById( 'diaboxgal' ).style.visibility = 'visible';
	document.getElementById( 'diaboxgal' ).style.top = top ;
	document.getElementById( 'diaboxgal' ).style.left = left ;
	document.getElementById( 'indexgal' ).value = id;
}

function addGalrp(id){
	y = y - 222;
	x = 330;
	var top = y +'px';
	var left = x +'px';
	document.getElementById( 'diaboxgalrp' ).style.visibility = 'visible';
	document.getElementById( 'diaboxgalrp' ).style.top = top ;
	document.getElementById( 'diaboxgalrp' ).style.left = left ;
}

function addGalnk(id){
	y = y - 222;
	x = 270;
	var top = y +'px';
	var left = x +'px';
	document.getElementById( 'diaboxgalnk' ).style.visibility = 'visible';
	document.getElementById( 'diaboxgalnk' ).style.top = top ;
	document.getElementById( 'diaboxgalnk' ).style.left = left ;
}


function editHomepic() {
	y = y - 222;
	x = 330;
	var top = y +'px';
	var left = x +'px';
	document.getElementById( 'diaboxdl' ).style.visibility = 'visible';
	document.getElementById( 'diaboxdl' ).style.top = top ;
	document.getElementById( 'diaboxdl' ).style.left = left ;
}

function editMareelpic() {
	y = y - 222;
	x = 330;
	var top = y +'px';
	var left = x +'px';
	document.getElementById( 'diaboxgal' ).style.visibility = 'visible';
	document.getElementById( 'diaboxgal' ).style.top = top ;
	document.getElementById( 'diaboxgal' ).style.left = left ;
}


function deleteDl(id){
 var where_to= confirm("Do you really want to delete this download? ");
 if (where_to== true)
 {
 	var delurl = "delete_download.php?id="+id;
    window.location=delurl;
 }
}


function closeObj(ref){
	document.getElementById( ref ).style.visibility = 'hidden';
	document.getElementById( 'fileuploadwarning' ).style.visibility = 'hidden';
}


function moveright(id){
   	 $(id).animate({"left": "+=354px"}, "slow");
}

function moveleft(id){
   $(id).animate({"left": "-=354px"}, "slow");
}


function addNotice(){
	y = y - 368;
	x = 250;
	var top = y +'px';
	var left = x +'px';
	document.getElementById( 'diaboxlist' ).style.visibility = 'visible';
	document.getElementById( 'diaboxlist' ).style.top = top ;
	document.getElementById( 'diaboxlist' ).style.left = left ;
	document.getElementById( 'toptitlelist' ).innerHTML = "Add entry...";
	
	document.getElementById( 'datenotice' ).value = '';
	document.getElementById( 'timessnotice' ).value = '';
	document.getElementById( 'placenotice' ).value = '';
	document.getElementById( 'descnotice' ).value = '';
	
	
	document.getElementById( 'indexnotice' ).value = 'x';

	document.getElementById( 'titlenotice' ).focus();
	tinyMCE.activeEditor.setContent( '' );
}


function editNotice(id){
	y = y - 368;
	x = 250;
	var top = y +'px';
	var left = x +'px';
	document.getElementById( 'diaboxlist' ).style.visibility = 'visible';
	document.getElementById( 'diaboxlist' ).style.top = top ;
	document.getElementById( 'diaboxlist' ).style.left = left ;
	document.getElementById( 'toptitlelist' ).innerHTML = "Edit entry...";

	var dateID = id+'datenotice';
	var date = document.getElementById( dateID ).innerHTML; 

	var timesID = id+'timessnotice';
	var times = document.getElementById( timesID ).innerHTML; 

	var placeID = id+'placenotice';
	var place = document.getElementById( placeID ).innerHTML; 

	var descID = id+'descnotice';
	var desc = document.getElementById( descID ).innerHTML; 

	var notesID = id+'noticecontent';
	var notes = document.getElementById( notesID ).innerHTML; 

	
	document.getElementById( 'datenotice' ).value = date;
	document.getElementById( 'timessnotice' ).value = times;
	document.getElementById( 'placenotice' ).value = place;
	document.getElementById( 'descnotice' ).value = desc;
	
	
	document.getElementById( 'indexnotice' ).value = id;

	document.getElementById( 'datenotice' ).focus();
	tinyMCE.activeEditor.setContent( notes );
}





function deleteNotice(id){
 var where_to= confirm("Do you really want to delete this notice? ");
 if (where_to== true)
 {
 	var delurl = "delete_notice.php?id="+id;
    window.location=delurl;
 }
}

