function slidehide(){
$("#slider").hide("slide", { direction: "right" }, 500);
}function slideContent(surl){
$('#slideContent').html('');
asget(surl,'','slideContent');
$("#slider").show("slide", { direction: "left" }, 500);
}function bootsystem(id,url,nokkel,inbound){
$("#content>div").fadeOut();
if(id=="start"){
$("#apps").fadeIn();
}
else{
$("#appStage>iframe").hide();
if($("#app"+id).length>0){
$("#app"+id).fadeIn();
}
else{
var merger="?";
if( url.indexOf("?") > 0 ){
merger="&";
}
if(inbound==1){
//alert(url + merger +"asID="+ nokkel);
window.top.location=url + merger +"asID="+ nokkel;
console.log("Inbound");
}
else{
var addapp="";
$("#appStage").append(addapp);
}
}
setTimeout(function(){
$("#appStage").fadeIn();
},600);
}
}function asget(url,x,ajxtarget){
$.get( "ajax.php?cach="+ Date.now() +"&"+url, function(data){
//Function
if ( typeof x === "function" ) {
x(data);
}
//TargetContainer
if(ajxtarget){
$("#"+ajxtarget).html(data);
if(ajxtarget!="slideContent"){
$("#"+ajxtarget).slideDown();
}
}
});
}function boot(id,app){
var xtimeout=1;
if($("#app"+app).length==1){
$("#content>div").fadeOut();
$("#appStage>iframe").hide();
$("#app"+app).show();
$("#appStage").fadeIn();
xtimeout=600;
}
setTimeout(function(){
asget('do=boot&id='+id,function(data){
$('#asConsole').html(data);
});
},xtimeout);
}function home(){
if($('#apps').length > 0){
bootsystem('start');
}
else{
window.top.location="?";
}
}function scale(){
var winh=0;
var ifheight=0;
winh=$(window).height();
ifheight= ($(window).height() - $("#mainmenu").height()-25 );
console.log(ifheight);
if($("#appStage iframe:visible").height()!=ifheight){
$("#appStage iframe:visible").height(ifheight);
}
$("#slider").height(winh-100);
}
setInterval(function(){
scale();
},1000);
$(function() {
scale();
});function master(m,id){
asget("do=master&m="+m+"&id="+id,function(data){
if($("#masterC:visible").length==0){
$("#appStage").fadeOut();
$("#apps").fadeOut();
$("#masterC").html(data);
$("#masterC").fadeIn();
}
else{
$("#masterdo").html(data);
$("#masterdo").effect("highlight");
}
});
}function endandstart(app,id){
asget("do=getlogout&id="+app, function(data){
if(data>""){
if($("#app"+app).length>0){
$("#app"+app).attr("src",data);
}
else{
var appendFrame= "";
$("#appStage").append(appendFrame);
}
setTimeout(function(){
$("#app"+app).remove();
},700);
setTimeout(function(){
boot(id,app);
},800)
}
else{
alert("Error: 6767123");
}
});
}function aspost(form,target,ani){
if(ani=="return"){
var ret="";
}
ajaxurl=$("#"+form).attr("href");
if(ani=='index'){
var burl="./";
}
else{
var burl="ajax.php";
}
$.post( burl+"?"+ajaxurl, $( "#"+form ).serialize(), function(data){
if(ani=='fade'){
$("#"+target).fadeOut();
$("#"+target).html(data);
$("#"+target).fadeIn();
}
else if(ani=="return"){
ret=data;
}
else{
$("#"+target).html(data);
}
});
}