function ExpColCateg(docnumber, view){
var form = document.forms[0].action.substring(0, document.forms[0].action.indexOf("?") + 9);
var url = window.location.href;
var strlen = url.length;
var before = url.indexOf("DocNum=");
var result = url.substring(before + 7 , strlen);
aux = "IMG" + docnumber;
// SE CLICAR EM EXPAND
if(url.indexOf("ExpandView") != -1){
window.open( form + "&Collapse="+ docnumber + "&View="+view +"&DocNum=" + docnumber , "_self") ;
}else{
// SE CLICAR EM COLLAPSE
if(url.indexOf("CollapseView") != -1){
window.open( form + "&Expand="+ docnumber + "&View=" +view +"&DocNum=" + docnumber , "_self") ;
}else{
// SE A ÚLTIMA AÇÃO FOR UM EXPAND
if(url.indexOf("Expand") != -1){
// SE O ÚLTIMO NÚMERO É O NÜMERO ATUAL
if(result == docnumber){
window.open( form + "&Collapse="+ docnumber + "&View="+view +"&DocNum=" + docnumber , "_self") ;
}else{
if(window.document.images[aux].src == location.protocol+"//"+location.host+ caminho +"/icon_epm_collapse.gif"){
window.open( form + "&Collapse="+ docnumber + "&View="+view +"&DocNum=" + docnumber , "_self") ; }else{
window.open( form + "&Expand="+ docnumber + "&View="+view +"&DocNum=" + docnumber , "_self") ;
}
}
}else{
// SE A ÚLTIMA AÇÃO FOR UM COLLAPSE
if(url.indexOf("Collapse") != -1){
if(result == docnumber){
window.open( form + "&Expand="+ docnumber + "&View="+view +"&DocNum=" + docnumber , "_self") ;
}else{
if(window.document.images[aux].src == location.protocol+"//"+location.host+ caminho +"/icon_epm_collapse.gif"){
window.open( form + "&Collapse="+ docnumber + "&View="+view +"&DocNum=" + docnumber , "_self") ;
}else{
window.open( form + "&Expand="+ docnumber + "&View="+view +"&DocNum=" + docnumber , "_self") ;
}
}
}else{
// DEFAULT
if(url.indexOf("Collapse") == -1 && url.indexOf("Expand") == -1){
window.open( form + "&Expand="+ docnumber + "&View="+view +"&DocNum=" + docnumber ,"_self") ;
}else{
window.open( form + "&Collapse="+ docnumber + "&View="+view +"&DocNum=" + docnumber , "_self") ;
}
}
}
}
}
}
Nenhum comentário:
Postar um comentário