function OnCategoryChange(sender,ID){
 $("#trProduct_"+ID).fadeOut('slow');
 xajax_Shop_OnCategoryChange(ID,getselectedvalue(sender));
}

function OnSelectedCategoryChanged(sender){
 document.location.href = '#';
 xajax_Shop_GetProductList($('#selCategory').val());
}

var editors = new Array();
var newseditors = new Array();
function OnEditNews(ID){
 $('tr[@id^="trNewsDetail_"]').hide();
 $('#trNewsDetail_'+ID).fadeIn('slow');
 
  
 for(n=0;n<newseditors.length;n++)
  if(newseditors[n] == ID)
  return;
 var oFCKeditor = new FCKeditor('edtText'+ID) ;
 oFCKeditor.BasePath = "fckeditor/" ;
 oFCKeditor.Height = "200" ;
 oFCKeditor.ReplaceTextarea() ;
 newseditors.push(ID); 
}


function OnEdit(ID){
 $('tr[@id^="trProductDetail_"]').hide();
 $('#trProductDetail_'+ID).fadeIn('slow');
 
 for(n=0;n<editors.length;n++)
  if(editors[n] == ID)
  return;
 var oFCKeditor = new FCKeditor('edtText'+ID) ;
 oFCKeditor.BasePath = "fckeditor/" ;
 oFCKeditor.Height = "200" ;
 oFCKeditor.ReplaceTextarea() ; 
 
 
 var oFCKeditor2 = new FCKeditor('edtBottomText'+ID) ;
 oFCKeditor2.BasePath = "fckeditor/" ;
 oFCKeditor2.Height = "200" ;
 
 
 oFCKeditor2.ReplaceTextarea() ;
 editors.push(ID);
}




function MyClass()
{
        this.UpdateEditorFormValue = function()
        {
                for ( i = 0; i < parent.frames.length; ++i )
                        if ( parent.frames[i].FCK )
                                parent.frames[i].FCK.UpdateLinkedField();
        }
}
// instantiate the class
var MyObject = new MyClass();


function OnDel(ID){
 if(!confirm('Wirklich entfernen?'))
  return;
 xajax_Shop_DeleteProd(ID);
}

function OnDelCat(ID){
 if(!confirm('Wirklich komplette Kategorie "'+$('#selCategory option:selected').text()+'" entfernen? Alle in der Kategorie Artikel werden entfernt!'))
  return;
 xajax_Shop_DeleteCat(ID);
}


function OnMoveUp(ID){
 $('tr[@id^="trProductDetail_"]').hide();
 $("#trProduct_"+ID).fadeOut('slow');
 xajax_Shop_ChangePosi(ID,1);
}

function OnMoveDown(ID){
 $('tr[@id^="trProductDetail_"]').hide();
 $("#trProduct_"+ID).fadeOut('slow');
 xajax_Shop_ChangePosi(ID,-1);
}

function OnSave(ID){
 $('#edtName_'+ID).val()
 $('#edtName_'+ID).val()
 $("#trProduct_"+ID).fadeOut('slow');
 xajax_Shop_ChangePosi(ID,-1);
}
function OnAddCat(){
 var name = $('#edtNewCat').val();
 if(name == ''){
  alert('Bitte Namen eingeben');
  return;
 }
 //$("#trProduct_"+ID).fadeOut('slow');
 xajax_Shop_AddCat(name);
}

function getselectedvalue(target) {
 with (target)
  return options[selectedIndex].value;
}

function OnDeleteProperty(id){
 xajax_Shop_DeleteProperty(id);
}
function OnAddProperty(name,art,menge,prodid){
 name = $('#'+name).val();
 art = $('#'+art).val();
 menge = $('#'+menge).val();

 xajax_Shop_AddProperty(name,art,menge,prodid);
}

function OnEditProperty(autoid){
 name = $('#name_'+autoid).val();
 art = $('#number_'+autoid).val();
 menge = $('#quantity_'+autoid).val();

 xajax_Shop_UpdateProperty(name,art,menge,autoid);
}

function OnDeleteNews(newsID){
 if(!confirm('Wirklich entfernen?'))
  return;
 xajax_News_DeleteNews(newsID);
}
function OnAddNews(){
 var headline = $('#edtHeadline').val();
 var content = $('#edtText').val();
 xajax_News_AddNews(headline,content);
}
