// Just a stub function we'll tell ajaxObject to call when it's done
// callback functions get responseText, and responseStat respectively
// in their arguments.
function fin(responseTxt,responseStat) {
  //alert(responseStat+' - '+responseTxt);
}

// create a new ajaxObject, give it a url it will be calling and
// tell it to call the function "fin" when its got data back from the server.
//var test1 = new ajaxObject('http://someurl.com/server.cgi',fin);
//    test1.update();
               
// create a new ajaxObject, give it a url and tell it to call fin when it
// gets data back from the server.  When we initiate the ajax call we'll
// be passing 'id=user4379' to the server.           
//var test2 = new ajaxObject('http://someurl.com/program.php',fin);
//    test2.update('id=user4379');
               
// create a new ajaxObject but we'll overwrite the callback function inside
// the object to more tightly bind the object with the response hanlder.


// create a new ajaxObject and pass the data to the server (in update) as
// a POST method instead of a GET method.
//var test4 = new ajaxObject('http://someurl.com/postit.cgi', fin);
//   test4.update('coolData=47&userId=user49&log=true','POST'); 


function ajaxObject(url, callbackFunction) {
	var that=this;     
  	this.updating = false;
  	this.abort = function() {
    	if (that.updating) {
      		that.updating=false;
      		that.AJAX.abort();
      		that.AJAX=null;
    	}
	}
	this.update = function(passData,postMethod) {
    	if (that.updating) { 
			return false;
		}
    	that.AJAX = null;                         
    	if (window.XMLHttpRequest) {             
      		that.AJAX=new XMLHttpRequest();             
    	} else {                                 
      		that.AJAX=new ActiveXObject("Microsoft.XMLHTTP");
    	}                                             
    	if (that.AJAX==null) {                             
      		return false;                               
    	} else {
      		that.AJAX.onreadystatechange = function() { 
        		if (that.AJAX.readyState==4) {             
          			that.updating=false;               
          			that.callback(that.AJAX.responseText,that.AJAX.status,that.AJAX.responseXML);       
          			that.AJAX=null;                                         
        		}                                                     
      		}                                                       
      		that.updating = new Date();                             
      		if (/post/i.test(postMethod)) {
        		var uri=urlCall+'?'+that.updating.getTime();
        		that.AJAX.open("POST", uri, true);
        		that.AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        		that.AJAX.send(passData);
      		} else {
        		var uri=urlCall+'?'+passData+'&timestamp='+(that.updating.getTime());
        		that.AJAX.open("GET", uri, true);                             
        		that.AJAX.send(null);                                         
      		}             
      		return true;                                             
    	}                                                                           
  	}
  	var urlCall = url;       
  	this.callback = callbackFunction || function () { };
  
}

var AjaxCategoryIdArr=new  Array();


var update=0;
function ShowProcess(baseurl,cid){
   //alert(attributeDisplay);
  AjaxCategoryIdArr.push(cid);
  
 //if(update!=1){
  
	link= baseurl+'process.php?cid='+cid;
	
	var linkComp = link.split( "?");
		var result;
		
				
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {
           
			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('result'+cid).innerHTML = result;  
		    document.getElementById('result'+cid).style.display = "block";
            document.getElementById('showCat'+cid).style.display = "none";
            document.getElementById('HideCat'+cid).style.display = "block";
            
            // for internet explorer
        if(( document.getElementById('catArray'+cid).innerHTML=="")&&  
        ( document.getElementById('ProductArray'+cid).innerHTML=="")){
            document.getElementById('result'+cid).style.display = "none";
        } 
           
          // code for category drag and drop 
       if( document.getElementById('catArray'+cid).innerHTML!=""){
     	
          var test;
          test=document.getElementById('catArray'+cid).innerHTML;  
    	  var temp1; 
          temp1 =test.split(","); 
    	for(var j=0;j<temp1.length;j++){
    		   new Draggable("item-"+ temp1[j] , {revert:true})
               var initStr = "";
               
			  initStr ="Droppables.add(\"box\"+ "+ temp1[j] + ", {accept:'products', hoverclass:'cart-active',";
			  initStr +=" onDrop: function(element ) {    \n";
			  initStr += "temp2 =element.id.split(\"-\")\n";
			  initStr += "var TempLink \n";
		   
		      initStr +="if(temp2[1]=="+ temp1[j] +" && temp2[0]==\"item\"){ \n";
              initStr +=     "  return; \n"
			
			  
			 initStr += "}else if(temp2[0]==\"item\"){";
			 initStr += "TempLink=\"order.php?dropid="+temp1[j]+"&id=\"+temp2[1] \n";
			 initStr +="   Shadowbox.open({ \n" ;
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move', \n";
		     initStr +="   content:    TempLink, \n";
		     initStr +="   height:     150,\n";
		     initStr +="   width:      350\n";
		     initStr +="  }); \n";
			 initStr +="}else if(temp2[0]==\"product\"){ \n";
			 initStr +=" TempLink=\"order1.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			 initStr +="   Shadowbox.open({ \n" ;
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
			 initStr +="   content:    TempLink, \n";
			 initStr +="   height:     150,\n";
			 initStr +="   width:      350\n";
			 initStr +="  }); \n";
			 initStr +=" }else if(temp2[0]==\"Indproduct\"){ \n";
			 
	        initStr +=" TempLink=\"ind_cat.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			
      		initStr +="   Shadowbox.open({ \n" ;
			initStr +="    player:     'iframe', \n";
			initStr +="   title:      'Move or Copy', \n";
			initStr +="   content:    TempLink, \n";
			initStr +="   height:     150,\n";
			initStr +="   width:      350\n";
			initStr +="  }); \n";
			

			 initStr +=" }else if(temp2[0]==\"attributeIcon\"){ \n";
			 
		        initStr +=" TempLink=\"attribute_cat.php?dropid="+temp1[j]+"&id=\"+temp2[1] \n";
				
	      		initStr +="   Shadowbox.open({ \n" ;
				initStr +="    player:     'iframe', \n";
				initStr +="   title:      'Move or Copy', \n";
				initStr +="   content:    TempLink, \n";
				initStr +="   height:     150,\n";
				initStr +="   width:      350\n";
				initStr +="  }); \n";
			
			
			
			
			initStr +="}else{ \n";
			initStr +=" alert(\"Invalid move\"); \n";
			initStr += "} \n"; 
			initStr +=" }}) \n";
				
			eval(initStr);
			
		}	
	       
	 }
	  // code for product drag and drop 
     if( document.getElementById('ProductArray'+cid).innerHTML!=""){
     	
          var testProduct;
          testProduct=document.getElementById('ProductArray'+cid).innerHTML;  
    	  var tempProduct; 
          tempProduct =testProduct.split(","); 
    	for(var j=0;j<tempProduct.length;j++){
    	
             new Draggable("product-"+tempProduct[j]+"-"+cid , {revert:true})
           
              var ProductToCatId;
              
             if( document.getElementById('ProductToCatId'+tempProduct[j]).innerHTML!=""){
                ProductToCatId=document.getElementById('ProductToCatId'+tempProduct[j]).innerHTML;
             }
             //alert(ProductToCatId);
              
              var initStr1 = "";
           
			 initStr1 ="Droppables.add(\"boxProduct\"+ "+ tempProduct[j] + ", {accept:'products', hoverclass:'cart-active',";
				
			 initStr1 +=" onDrop: function(element ) {    \n";
			 initStr1 += "temp2 =element.id.split(\"-\")\n";
			 initStr1 += "var TempLink \n";
			  
			 initStr1 +="if(temp2[1]=="+ tempProduct[j] +" && temp2[0]==\"product\"){ \n";
             initStr1 +=     " return; \n"
			 initStr1 += "}else if(temp2[0]==\"partProduct\"){";                                 
			 initStr1 += "TempLink=\"part_product.php?dropid="+tempProduct[j]+"&productcatId="+ProductToCatId+"&id=\"+temp2[1]+\"&catId=\"+temp2[2]\n";
			 initStr1 +="   Shadowbox.open({ \n"
			 initStr1 +="    player:     'iframe', \n";
			 initStr1 +="   title:      'Move or Copy', \n";
		     initStr1 +="   content:    TempLink, \n";
		     initStr1 +="   height:     150,\n";
		     initStr1 +="   width:      350\n";
		     initStr1 +="  }); \n";
             initStr1 +="}else{ \n";
			 initStr1 +=" alert(\"Invalid move\"); \n";
			 initStr1 += "} \n"; 
			 initStr1 +=" }}) \n";
				
			 eval(initStr1);
		   
             if(attributeDisplay==true){
                HideProduct(tempProduct[j]);
            }else{
                ShowProduct(tempProduct[j]);
            }
		}	
	       
	 }
	   Shadowbox.deact();
	   Shadowbox.init();
	 
  }
}
	
function ShowPage(){
      
	
	
 //alert(tabAction);AjaxSystemArr
 //if(tabAction=="")  AjaxPartIdArrr
    if(AjaxCategoryIdArr!="" && AjaxIndustryArr!="" && AjaxPartIdArrr!="" && AjaxSystemArr!="" ){
    	link= 'index1.php?id='+AjaxCategoryIdArr+'&industryId='+AjaxIndustryArr+'&partId='+AjaxPartIdArrr+'&systemId='+AjaxSystemArr+'&tabAction='+tabAction;
	}else if(AjaxCategoryIdArr!="" && AjaxIndustryArr=="" && AjaxPartIdArrr==""  && AjaxSystemArr!=""){
		link= 'index1.php?id='+AjaxCategoryIdArr+'&systemId='+AjaxSystemArr+'&tabAction='+tabAction;
    }else if(AjaxCategoryIdArr=="" && AjaxIndustryArr!=""  && AjaxPartIdArrr==""   && AjaxSystemArr!=""){
    	link= 'index1.php?industryId='+AjaxIndustryArr+'&systemId='+AjaxSystemArr+'&tabAction='+tabAction;
    }else if(AjaxCategoryIdArr!="" && AjaxIndustryArr=="" && AjaxPartIdArrr!=""  && AjaxSystemArr!=""){
		link= 'index1.php?id='+AjaxCategoryIdArr+'&partId='+AjaxPartIdArrr+'&systemId='+AjaxSystemArr+'&tabAction='+tabAction;
    }else if(AjaxCategoryIdArr=="" && AjaxIndustryArr!=""  && AjaxPartIdArrr!="" && AjaxSystemArr!=""){
    	link= 'index1.php?industryId='+AjaxIndustryArr+'&partId='+AjaxPartIdArrr+'&systemId='+AjaxSystemArr+'&tabAction='+tabAction;
   }else if(AjaxCategoryIdArr=="" && AjaxIndustryArr==""  && AjaxPartIdArrr!="" && AjaxSystemArr!=""){
    	link= 'index1.php?partId='+AjaxPartIdArrr+'&systemId='+AjaxSystemArr+'&tabAction='+tabAction;
   
   }else if(AjaxCategoryIdArr!="" && AjaxIndustryArr=="" && AjaxPartIdArrr==""  && AjaxSystemArr==""){
		link= 'index1.php?id='+AjaxCategoryIdArr+'&tabAction='+tabAction;
    }else if(AjaxCategoryIdArr=="" && AjaxIndustryArr!=""  && AjaxPartIdArrr==""   && AjaxSystemArr==""){
    	link= 'index1.php?industryId='+AjaxIndustryArr+'&tabAction='+tabAction;
    }else if(AjaxCategoryIdArr!="" && AjaxIndustryArr=="" && AjaxPartIdArrr!=""  && AjaxSystemArr==""){
		link= 'index1.php?id='+AjaxCategoryIdArr+'&partId='+AjaxPartIdArrr+'&tabAction='+tabAction;
    }else if(AjaxCategoryIdArr=="" && AjaxIndustryArr!=""  && AjaxPartIdArrr!="" && AjaxSystemArr==""){
    	link= 'index1.php?industryId='+AjaxIndustryArr+'&partId='+AjaxPartIdArrr+'&tabAction='+tabAction;
    
  }else if(AjaxCategoryIdArr!="" && AjaxIndustryArr!=""  && AjaxPartIdArrr=="" && AjaxSystemArr!=""){	
  	 link= 'index1.php?id='+AjaxCategoryIdArr+'&industryId='+AjaxIndustryArr+'&systemId='+AjaxSystemArr+'&tabAction='+tabAction;
   }else if(AjaxCategoryIdArr=="" && AjaxIndustryArr==""  && AjaxPartIdArrr!="" && AjaxSystemArr!=""){
    	link= 'index1.php?partId='+AjaxPartIdArrr+'&systemId='+AjaxSystemArr+'&tabAction='+tabAction;
    }else if(AjaxCategoryIdArr!="" && AjaxIndustryArr!=""  && AjaxPartIdArrr=="" && AjaxSystemArr==""){	
  	 link= 'index1.php?id='+AjaxCategoryIdArr+'&industryId='+AjaxIndustryArr+'&tabAction='+tabAction;
  	
  	}else if(AjaxCategoryIdArr!="" && AjaxIndustryArr!=""  && AjaxPartIdArrr!="" && AjaxSystemArr==""){	
  	 link= 'index1.php?id='+AjaxCategoryIdArr+'&industryId='+AjaxIndustryArr+'&partId='+AjaxPartIdArrr+'&tabAction='+tabAction;
  	
    }else if(AjaxCategoryIdArr=="" && AjaxIndustryArr==""  && AjaxPartIdArrr=="" && AjaxSystemArr!=""){
       link= 'index1.php?systemId='+AjaxSystemArr+'&tabAction='+tabAction;
   
    }else if(AjaxCategoryIdArr=="" && AjaxIndustryArr==""  && AjaxPartIdArrr!="" && AjaxSystemArr==""){
       link= 'index1.php?partId='+AjaxPartIdArrr+'&tabAction='+tabAction;
  
   }else{
    	 link= 'index1.php?tabAction='+tabAction;
    }
    
	var linkComp = link.split( "?");
		var result;
		
				
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {
           
			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('left').innerHTML = result;  
		    document.getElementById('left').style.display = "block";
		    
		   
		    // code for category drag and drop 
       if( document.getElementById('catArray').innerHTML!=""){
     	   var test;
          test=document.getElementById('catArray').innerHTML;  
    	  var temp1; 
          temp1 =test.split(","); 
         
    	for(var j=0;j<temp1.length;j++){
    	   new Draggable("item-"+ temp1[j] , {revert:true})
    	
    		   
               var initStr = "";
               
			  initStr ="Droppables.add(\"box\"+ "+ temp1[j] + ", {accept:'products', hoverclass:'cart-active',";
			  initStr +=" onDrop: function(element ) {    \n";
			  initStr += "temp2 =element.id.split(\"-\")\n";
			  initStr += "var TempLink \n";
		   
		      initStr +="if(temp2[1]=="+ temp1[j] +" && temp2[0]==\"item\"){ \n";
              initStr +=     "  return; \n"
			
			  
			 initStr += "}else if(temp2[0]==\"item\"){";
			 initStr += "TempLink=\"order.php?dropid="+temp1[j]+"&id=\"+temp2[1] \n";
			 initStr +="   Shadowbox.open({ \n" ;
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
		     initStr +="   content:    TempLink, \n";
		     initStr +="   height:     150,\n";
		     initStr +="   width:      350\n";
		     initStr +="  }); \n";
			 initStr +="}else if(temp2[0]==\"product\"){ \n";
			 initStr +=" TempLink=\"order1.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			 initStr +="   Shadowbox.open({ \n" ;
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
			 initStr +="   content:    TempLink, \n";
			 initStr +="   height:     150,\n";
			 initStr +="   width:      350\n";
			 initStr +="  }); \n";
			 initStr +=" }else if(temp2[0]==\"Indproduct\"){ \n";
			 
	        initStr +=" TempLink=\"ind_cat.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			
      		initStr +="   Shadowbox.open({ \n" ;
			initStr +="    player:     'iframe', \n";
			initStr +="   title:      'Move or Copy', \n";
			initStr +="   content:    TempLink, \n";
			initStr +="   height:     150,\n";
			initStr +="   width:      350\n";
			initStr +="  }); \n";
			

			 initStr +=" }else if(temp2[0]==\"attributeIcon\"){ \n";
			 
		        initStr +=" TempLink=\"attribute_cat.php?dropid="+temp1[j]+"&id=\"+temp2[1] \n";
				
	      		initStr +="   Shadowbox.open({ \n" ;
				initStr +="    player:     'iframe', \n";
				initStr +="   title:      'Move or Copy', \n";
				initStr +="   content:    TempLink, \n";
				initStr +="   height:     150,\n";
				initStr +="   width:      350\n";
				initStr +="  }); \n";
			
			
			
			
			initStr +="}else{ \n";
			initStr +=" alert(\"Invalid move\"); \n";
			initStr += "} \n"; 
			initStr +=" }}) \n";
				
			eval(initStr);
			
		}	
	       
	 }
	 
	 for(var k=0;k< AjaxCategoryIdArr.length;k++){ 
	
	   // code for product drag and drop 
     if( document.getElementById('ProductArray'+AjaxCategoryIdArr[k]).innerHTML!="" &&
    document.getElementById('ProductArray'+AjaxCategoryIdArr[k])!=null
     ){
     	
          var testProduct;
          testProduct=document.getElementById('ProductArray'+AjaxCategoryIdArr[k]).innerHTML;  
    	  var tempProduct; 
          tempProduct =testProduct.split(","); 
    	for(var j=0;j<tempProduct.length;j++){
    	
             new Draggable("product-"+tempProduct[j]+"-"+AjaxCategoryIdArr[k] , {revert:true})
           
              var ProductToCatId;
              
             if( document.getElementById('ProductToCatId'+tempProduct[j]).innerHTML!=""){
                ProductToCatId=document.getElementById('ProductToCatId'+tempProduct[j]).innerHTML;
             }
             //alert(ProductToCatId);
              
              var initStr1 = "";
           
			 initStr1 ="Droppables.add(\"boxProduct\"+ "+ tempProduct[j] + ", {accept:'products', hoverclass:'cart-active',";
				
			 initStr1 +=" onDrop: function(element ) {    \n";
			 initStr1 += "temp2 =element.id.split(\"-\")\n";
			 initStr1 += "var TempLink \n";
			  
			 initStr1 +="if(temp2[1]=="+ tempProduct[j] +" && temp2[0]==\"product\"){ \n";
             initStr1 +=     " return; \n"
			 initStr1 += "}else if(temp2[0]==\"partProduct\"){";                                 
			 initStr1 += "TempLink=\"part_product.php?dropid="+tempProduct[j]+"&productcatId="+ProductToCatId+"&id=\"+temp2[1]+\"&catId=\"+temp2[2]\n";
			 initStr1 +="   Shadowbox.open({ \n"
			 initStr1 +="    player:     'iframe', \n";
			 initStr1 +="   title:      'Move or Copy', \n";
		     initStr1 +="   content:    TempLink, \n";
		     initStr1 +="   height:     150,\n";
		     initStr1 +="   width:      350\n";
		     initStr1 +="  }); \n";
             initStr1 +="}else{ \n";
			 initStr1 +=" alert(\"Invalid move\"); \n";
			 initStr1 += "} \n"; 
			 initStr1 +=" }}) \n";
				
			 eval(initStr1);
		   
            
		}	
	       
	 }
		    
	}	    
		///////////////////for industry    
		   // code for category drag and drop 
       if( document.getElementById('IndArray').innerHTML!=""){
     	
          var test;
          test=document.getElementById('IndArray').innerHTML;  
    	  var temp1; 
          temp1 =test.split(","); 
    	for(var j=0;j<temp1.length;j++){
    		   new Draggable("industryIcon-"+ temp1[j] , {revert:true})
               var initStr = "";
           
			 initStr ="Droppables.add(\"boxIndustry\"+ "+ temp1[j] + ", {accept:'products', hoverclass:'cart-active',";
				
			 initStr +=" onDrop: function(element ) {    \n";
			 initStr += "temp2 =element.id.split(\"-\")\n";
			 initStr += "var TempLink \n";
			 
			 initStr +="if(temp2[1]=="+ temp1[j] +" && temp2[0]==\"industryIcon\"){ \n";
             initStr +=     " return; \n"
			  
			 initStr += "}else if(temp2[0]==\"industryIcon\"){";
			 initStr += "TempLink=\"industry_order.php?dropid="+temp1[j]+"&id=\"+temp2[1] \n";
			 initStr +="   Shadowbox.open({ \n"
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
		     initStr +="   content:    TempLink, \n";
		     initStr +="   height:     150,\n";
		     initStr +="   width:      350\n";
		     initStr +="  }); \n";
			 initStr +="}else if(temp2[0]==\"Indproduct\"){";
			 initStr +=" TempLink=\"industry_order1.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			 initStr +="   Shadowbox.open({ \n"
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
			 initStr +="   content:    TempLink, \n";
			 initStr +="   height:     150,\n";
			 initStr +="   width:      350\n";
			 initStr +="  }); \n";
			 initStr +="}else if(temp2[0]==\"product\"){";
			 initStr +=" TempLink=\"cat_ind.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			 initStr +="   Shadowbox.open({ \n"
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
			 initStr +="   content:    TempLink, \n";
			 initStr +="   height:     150,\n";
			 initStr +="   width:      350\n";
			 initStr +="  }); \n";
			 initStr +="}else{ \n";
			 initStr +=" alert(\"Invalid move\");"
			 initStr += "} \n"; 
			 initStr +=" }}) \n";    
				
				eval(initStr);
         }
        }  
        
        // code for product drag and drop 
         for(var k=0;k< AjaxIndustryArr.length;k++){ 
     if( document.getElementById('IndProductArray'+AjaxIndustryArr[k]).innerHTML!=""){
     	
          var testProduct;
          testProduct=document.getElementById('IndProductArray'+AjaxIndustryArr[k]).innerHTML;  
    	  var tempProduct; 
          tempProduct =testProduct.split(","); 
    	for(var j=0;j<tempProduct.length;j++){
            
             new Draggable("Indproduct-"+tempProduct[j]+"-"+AjaxIndustryArr[k] , {revert:true})
            
		}	
	       
	 } 
		}    
		    
	    
		///////////////industry    
		/////////////////part  
		if( tabAction=="parts"){
		    if(partrStatus==true && productStatus == true){
		   
			 document.getElementById("applyButton").style.display = "block";
			 document.getElementById("partDiv").style.display = "none";
			
			}else{
			   document.getElementById("applyButton").style.display = "none";
			   document.getElementById("partMessage").style.display = "block";
			}
	       
	   }else{
	  
			  document.getElementById("partMessage").style.display = "none";
			  document.getElementById("applyButton").style.display = "none";
			  document.getElementById("partDiv").style.display = "none";
	   }	   
	   
		     // code for category drag and drop 
      if( document.getElementById('partcatArray').innerHTML!=""){
     	
          var test;
          test=document.getElementById('partcatArray').innerHTML;  
    	  var temp1; 
          temp1 =test.split(","); 
    	for(var j=0;j<temp1.length;j++){
    		   new Draggable("partIcon-"+ temp1[j] , {revert:true})
               var initStr = "";
               
			 initStr ="Droppables.add(\"boxPart\"+ "+ temp1[j] + ", {accept:'products', hoverclass:'cart-active',";
				
				
			 initStr +=" onDrop: function(element ) {    \n";
			 initStr += "temp2 =element.id.split(\"-\")\n";
			 initStr += "var TempLink \n";
		     
		     initStr +="if(temp2[1]=="+ temp1[j] +" && temp2[0]==\"partIcon\"){ \n";
             initStr +=     " return; \n"
			
			  
			 initStr += "}else if(temp2[0]==\"partIcon\"){";
			 initStr += "TempLink=\"partcat_move.php?dropid="+temp1[j]+"&id=\"+temp2[1] \n";
			 initStr +="   Shadowbox.open({ \n" ;
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
		     initStr +="   content:    TempLink, \n";
		     initStr +="   height:     150,\n";
		     initStr +="   width:      350\n";
		     initStr +="  }); \n";
			 initStr +="}else if(temp2[0]==\"partProduct\"){ \n";
			 initStr +=" TempLink=\"partcat_move1.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			 initStr +="   Shadowbox.open({ \n" ;
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
			 initStr +="   content:    TempLink, \n";
			 initStr +="   height:     150,\n";
			 initStr +="   width:      350\n";
			 initStr +="  }); \n";
			 initStr +="}else{ \n";
			initStr +=" alert(\"Invalid move\"); \n";
			initStr += "} \n"; 
			initStr +=" }}) \n";
				
			eval(initStr);
			
		}	
	       
	 }
	  // code for product drag and drop
	//alert(AjaxPartIdArrr.length); 
	 for(var m=0;m < AjaxPartIdArrr.length;m++){ 
	
     if( document.getElementById('PartProductArray'+AjaxPartIdArrr[m]).innerHTML!=""){
     	
          var testProduct;
          testProduct=document.getElementById('PartProductArray'+AjaxPartIdArrr[m]).innerHTML;  
    	  var tempProduct; 
          tempProduct =testProduct.split(","); 
    	for(var j=0;j<tempProduct.length;j++){
             new Draggable("partProduct-"+tempProduct[j]+"-"+AjaxPartIdArrr[m] , {revert:true})
             
             
             
		}	
	       
	 }
	 }
		    
		/////////////////part end  
		/////////////system
		 // code for category drag and drop 
       if( document.getElementById('SystemArray').innerHTML!=""){
     	
          var test;
          test=document.getElementById('SystemArray').innerHTML;  
    	  var temp1; 
          temp1 =test.split(","); 
    	for(var j=0;j<temp1.length;j++){
    		 new Draggable("systemIcon-"+ temp1[j] , {revert:true})
             var initStr = "";
          	 initStr ="Droppables.add(\"boxSystem\"+ "+ temp1[j] + ", {accept:'products', hoverclass:'cart-active',";
				
			 initStr +=" onDrop: function(element ) {   \n";
			 initStr += "temp2 =element.id.split(\"-\")\n";
			 initStr += "var TempLink \n";
			  
			 initStr +="if(temp2[1]=="+ temp1[j] +" && temp2[0]==\"systemIcon\"){ \n";
             initStr +=     " return; \n"
			   
			 initStr += "}else if(temp2[0]==\"systemIcon\"){";
			 initStr += "TempLink=\"system_order.php?dropid="+temp1[j]+"&id=\"+temp2[1] \n";
			 initStr +="   Shadowbox.open({ \n"
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
		     initStr +="   content:    TempLink, \n";
		     initStr +="   height:     150,\n";
		     initStr +="   width:      350\n";
		     initStr +="  }); \n";
		     initStr += "}else if(temp2[0]==\"SystemProduct\"){";
			 initStr += "TempLink=\"system_order1.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			 initStr +="   Shadowbox.open({ \n"
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
		     initStr +="   content:    TempLink, \n";
		     initStr +="   height:     150,\n";
		     initStr +="   width:      350\n";
		     initStr +="  }); \n";
			 initStr +="}else if(temp2[0]==\"product\"){";
			 initStr +=" TempLink=\"cat_system.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			 initStr +="   Shadowbox.open({ \n"
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
			 initStr +="   content:    TempLink, \n";
			 initStr +="   height:     150,\n";
			 initStr +="   width:      350\n";
			 initStr +="  }); \n";
			 initStr +="}else{ \n";
			 initStr +=" alert(\"Invalid move\");"
			 initStr += "} \n"; 
			 initStr +=" }}) \n";    
			 eval(initStr);
         }
        }  
         // code for product drag and drop 
         for(l=0;l<AjaxSystemArr.length;l++){
 if( document.getElementById('SystemProductArray'+AjaxSystemArr[l]).innerHTML!=""){
     	
          var testProduct;
          testProduct=document.getElementById('SystemProductArray'+AjaxSystemArr[l]).innerHTML;  
    	  var tempProduct; 
          tempProduct =testProduct.split(","); 
    	for(var j=0;j<tempProduct.length;j++){
              
             new Draggable("SystemProduct-"+tempProduct[j]+"-"+AjaxSystemArr[l] , {revert:true})
		}	
	       
	 }  
	 }
		/////////////system end
         
         ////// attribute
         if( document.getElementById('AttributeArray').innerHTML!=""){
          	
             var testAtt;
             testAtt=document.getElementById('AttributeArray').innerHTML;  
       	  var tempAtt1; 
             tempAtt1 =testAtt.split(","); 
       	for(var j=0;j<tempAtt1.length;j++){
       		 new Draggable("attributeIcon-"+ tempAtt1[j] , {revert:true})
       	}
         }
         
		//for selct valus for delete
if(InputcatIdArr.length!=0){
 for(var p1=0;p1<InputcatIdArr.length;p1++){
  document.getElementById("category"+InputcatIdArr[p1]).checked=true;
 }
}
if(InputindustryIdArr.length!=0){
 for(var p2=0;p2<InputindustryIdArr.length;p2++){
  document.getElementById("industry"+InputindustryIdArr[p2]).checked=true;
 }
}

if(InputsystemIdArr.length!=0){
 for(var p3=0;p3<InputsystemIdArr.length;p3++){
  document.getElementById("system"+InputsystemIdArr[p3]).checked=true;
 }
}
if(InputAttributeIdArr.length!=0){
 for(var p4=0;p4<InputAttributeIdArr.length;p4++){
  document.getElementById("attribute"+InputAttributeIdArr[p4]).checked=true;
 }
}
if(InputPartCatIdArr.length!=0){

 for(var p5=0;p5<InputPartCatIdArr.length;p5++){
  document.getElementById("part"+InputPartCatIdArr[p5]).checked=true;
 }
}
if(InputproductIdArr1.length!=0){
 for(var p6=0;p6<InputproductIdArr1.length;p6++){
 
  document.getElementById("productCheckId"+InputproductIdArr1[p6]).checked=true;
 }
}
if(InputIndustryProductIdArr1.length!=0){
 for(var p7=0;p7<InputIndustryProductIdArr1.length;p7++){
 
  document.getElementById("productIndustry"+InputIndustryProductIdArr1[p7]).checked=true;
 }
}

if(InputSystemProductIdArr1.length!=0){
 for(var p8=0;p8<InputSystemProductIdArr1.length;p8++){
 
  document.getElementById("productSystem"+InputSystemProductIdArr1[p8]).checked=true;
 }
}
if(InputPartProductIdArr1.length!=0){
 for(var p9=0;p9<InputPartProductIdArr1.length;p9++){
 
  document.getElementById("partCheck"+InputPartProductIdArr1[p9]).checked=true;
 }
}

//for attribute
if( tabAction=="attribute"){
	   attributeDisplay=true;
	   }else{
		   attributeDisplay=false;
	   }
	   //for attribute  to hide product 
	   var str,tmpId;
	   var els = document.getElementsByTagName("div"); 
	   var elsLen = els.length;
	 if(attributeDisplay==false){
	    
		  for (var k=0;k < elsLen;k++) {
		  tmpId= els[k].id;     
			str = tmpId; 
	    	// use to find AttProduct
		     if (str.search("AttProduct")!=-1 && str!=null) {      
		        document.getElementById( els[k].id).style.display = "block";
		
		     }
		  } 
	 
	 }else{
		 
		  for (var k=0;k < elsLen;k++) {
		  tmpId= els[k].id;     
			str = tmpId; 
	    	// use to find AttProduct
		     if (str.search("AttProduct")!=-1 && str!=null) {      
	             document.getElementById( els[k].id).style.display = "none";
	              
		     }
		  } 
		
	}



		  
		    Shadowbox.deact();
	        Shadowbox.init();
	       }  
          
}          

function HideProcess(baseurl,cid){
    //AjaxCategoryIdArr.pop(cid);
	 for ( var i in AjaxCategoryIdArr )
		{
		
			if(AjaxCategoryIdArr[i]==cid){
				AjaxCategoryIdArr.splice(i,1);
	
			}
     }
    
    
	link= baseurl+'process.php?cid='+cid;
	var linkComp = link.split( "?");
		var result;
		
				
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {

			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('result'+cid).innerHTML = result;  
			 
			document.getElementById('result'+cid).style.display = "none";
            document.getElementById('showCat'+cid).style.display = "block";
            document.getElementById('HideCat'+cid).style.display = "none";
			//document.getElementById('main').style.display = 'block';         

		}

	}
function HideProduct(id){
var str,tmpId;
 var els = document.getElementsByTagName("div"); 
 var elsLen = els.length;
for (var k=0;k < elsLen;k++) {
 tmpId= els[k].id;     
str = tmpId; 
     	// use to find AttProduct
    if (str.search("AttProduct")!=-1 && str!=null) {      
       document.getElementById( els[k].id).style.display = "none";
 }
} 


}	
function ShowProduct(id){
var str,tmpId;
 var els = document.getElementsByTagName("div"); 
 var elsLen = els.length;
for (var k=0;k < elsLen;k++) {
 tmpId= els[k].id;     
str = tmpId; 
     	// use to find AttProduct
    if (str.search("AttProduct")!=-1 && str!=null) {      
       document.getElementById( els[k].id).style.display = "block";
    }
}
}
function ShowCategory(baseurl,cid,id){
	link= baseurl+'process.php?cid='+cid+'&id='+id;
	var linkComp = link.split( "?");
		var result;
		
				
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {

			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('result'+cid).innerHTML = result;  
			 document.getElementById('result'+cid).style.display = "block";
            document.getElementById('showCat'+cid).style.display = "none";
            document.getElementById('HideCat'+cid).style.display = "block";
            
                 // for internet explorer
        if( document.getElementById('result'+cid).innerHTML==""){
            document.getElementById('result'+cid).style.display = "none";
        } 
         
            
		}

	}	
function HideCategory(baseurl,cid,id){
	link= baseurl+'process.php?cid='+cid+'&id='+id;
	var linkComp = link.split( "?");
    var result;
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");
	    obj.callback = function (responseTxt, responseStat) {

			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('result'+cid).innerHTML = result;  
			document.getElementById('result'+cid).style.display = "none";
            document.getElementById('showCat'+cid).style.display = "block";
            document.getElementById('HideCat'+cid).style.display = "none";
		}

	}
	//*********** INDUSTRY ***********
var AjaxIndustryArr=new Array();
function ShowIndustry(baseurl,cid,id){

	link= baseurl+'industry.php?cid='+cid+'&id='+id;
	var linkComp = link.split( "?");
	var result;
	AjaxIndustryArr.push(cid);
	var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {

			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('resultIndustry'+cid).innerHTML = result;  
			document.getElementById('resultIndustry'+cid).style.display = "block";
            document.getElementById('showCatIndustry'+cid).style.display = "none";
            document.getElementById('HideCatIndustry'+cid).style.display = "block";
            
             // for internet explorer
           if(( document.getElementById('IndArray'+cid).innerHTML=="")&&  
        ( document.getElementById('ProductArray'+cid).innerHTML=="")){
            document.getElementById('resultIndustry'+cid).style.display = "none";
        } 
            
            // code for category drag and drop 
       if( document.getElementById('IndArray'+cid).innerHTML!=""){
     	
          var test;
          test=document.getElementById('IndArray'+cid).innerHTML;  
    	  var temp1; 
          temp1 =test.split(","); 
    	for(var j=0;j<temp1.length;j++){
    		   new Draggable("industryIcon-"+ temp1[j] , {revert:true})
               var initStr = "";
           
			 initStr ="Droppables.add(\"boxIndustry\"+ "+ temp1[j] + ", {accept:'products', hoverclass:'cart-active',";
				
			 initStr +=" onDrop: function(element ) {    \n";
			 initStr += "temp2 =element.id.split(\"-\")\n";
			 initStr += "var TempLink \n";
			 
			 initStr +="if(temp2[1]=="+ temp1[j] +" && temp2[0]==\"industryIcon\"){ \n";
             initStr +=     " return; \n"
			  
			 initStr += "}else if(temp2[0]==\"industryIcon\"){";
			 initStr += "TempLink=\"industry_order.php?dropid="+temp1[j]+"&id=\"+temp2[1] \n";
			 initStr +="   Shadowbox.open({ \n"
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
		     initStr +="   content:    TempLink, \n";
		     initStr +="   height:     150,\n";
		     initStr +="   width:      350\n";
		     initStr +="  }); \n";
			 initStr +="}else if(temp2[0]==\"Indproduct\"){";
			 initStr +=" TempLink=\"industry_order1.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			 initStr +="   Shadowbox.open({ \n"
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
			 initStr +="   content:    TempLink, \n";
			 initStr +="   height:     150,\n";
			 initStr +="   width:      350\n";
			 initStr +="  }); \n";
			 initStr +="}else if(temp2[0]==\"product\"){";
			 initStr +=" TempLink=\"cat_ind.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			 initStr +="   Shadowbox.open({ \n"
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
			 initStr +="   content:    TempLink, \n";
			 initStr +="   height:     150,\n";
			 initStr +="   width:      350\n";
			 initStr +="  }); \n";
			 initStr +="}else{ \n";
			 initStr +=" alert(\"Invalid move\");"
			 initStr += "} \n"; 
			 initStr +=" }}) \n";    
				
				eval(initStr);
         }
        }  
        
        // code for product drag and drop 
     if( document.getElementById('ProductArray'+cid).innerHTML!=""){
     	
          var testProduct;
          testProduct=document.getElementById('ProductArray'+cid).innerHTML;  
    	  var tempProduct; 
          tempProduct =testProduct.split(","); 
    	for(var j=0;j<tempProduct.length;j++){
            
             new Draggable("Indproduct-"+tempProduct[j]+"-"+cid , {revert:true})
            
		}	
	       
	 }
	       
		 Shadowbox.deact();
         Shadowbox.init();
		}

	}	
function HideIndustry(baseurl,cid,id){
	link= baseurl+'industry.php?cid='+cid+'&id='+id;
	var linkComp = link.split( "?");
	//AjaxIndustryArr.pop(cid);
	for ( var i in AjaxIndustryArr )
	{
	
		if(AjaxIndustryArr[i]==cid){
			AjaxIndustryArr.splice(i,1);

		}
   }
	var result;
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {

			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('resultIndustry'+cid).innerHTML = result;  
			document.getElementById('resultIndustry'+cid).style.display = "none";
            document.getElementById('showCatIndustry'+cid).style.display = "block";
            document.getElementById('HideCatIndustry'+cid).style.display = "none";
		
		}

	}
		
function ShowIndustryList(baseurl,cid,id){
	link= baseurl+'industry.php?cid='+cid+'&id='+id;
	var linkComp = link.split( "?");
      var result;
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {

			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('result'+cid).innerHTML = result;  
			 document.getElementById('result'+cid).style.display = "block";
            document.getElementById('showCat'+cid).style.display = "none";
            document.getElementById('HideCat'+cid).style.display = "block";
		}

	}	
function HideIndustryList(baseurl,cid,id){
	link= baseurl+'industry.php?cid='+cid+'&id='+id;
	var linkComp = link.split( "?");
	var result;
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {

			// we'll do something to process the data here.
			result = responseTxt
			document.getElementById('result'+cid).innerHTML = result;  
			document.getElementById('result'+cid).style.display = "none";
            document.getElementById('showCat'+cid).style.display = "block";
            document.getElementById('HideCat'+cid).style.display = "none";
	
		}

	}

//*********** SYSTEM ***********
var AjaxSystemArr=new Array();
function ShowSystem(baseurl,cid,id){
       AjaxSystemArr.push(cid);
	link= baseurl+'system.php?cid='+cid+'&id='+id;
	var linkComp = link.split( "?");
	var result;
	var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {

			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('resultSystem'+cid).innerHTML = result;  
			document.getElementById('resultSystem'+cid).style.display = "block";
            document.getElementById('showSystem'+cid).style.display = "none";
            document.getElementById('HideSystem'+cid).style.display = "block";
          
           // for internet explorer  
         if(( document.getElementById('SystemArray'+cid).innerHTML=="")&&  
        ( document.getElementById('ProductArray'+cid).innerHTML=="")){
            document.getElementById('resultSystem'+cid).style.display = "none";
        }    
            
            
            // code for category drag and drop 
       if( document.getElementById('SystemArray'+cid).innerHTML!=""){
     	
          var test;
          test=document.getElementById('SystemArray'+cid).innerHTML;  
    	  var temp1; 
          temp1 =test.split(","); 
    	for(var j=0;j<temp1.length;j++){
    		 new Draggable("systemIcon-"+ temp1[j] , {revert:true})
             var initStr = "";
          	 initStr ="Droppables.add(\"boxSystem\"+ "+ temp1[j] + ", {accept:'products', hoverclass:'cart-active',";
				
			 initStr +=" onDrop: function(element ) {   \n";
			 initStr += "temp2 =element.id.split(\"-\")\n";
			 initStr += "var TempLink \n";
			  
			 initStr +="if(temp2[1]=="+ temp1[j] +" && temp2[0]==\"systemIcon\"){ \n";
             initStr +=     " return; \n"
			   
			 initStr += "}else if(temp2[0]==\"systemIcon\"){";
			 initStr += "TempLink=\"system_order.php?dropid="+temp1[j]+"&id=\"+temp2[1] \n";
			 initStr +="   Shadowbox.open({ \n"
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
		     initStr +="   content:    TempLink, \n";
		     initStr +="   height:     150,\n";
		     initStr +="   width:      350\n";
		     initStr +="  }); \n";
		     initStr += "}else if(temp2[0]==\"SystemProduct\"){";
			 initStr += "TempLink=\"system_order1.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			 initStr +="   Shadowbox.open({ \n"
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
		     initStr +="   content:    TempLink, \n";
		     initStr +="   height:     150,\n";
		     initStr +="   width:      350\n";
		     initStr +="  }); \n";
			 initStr +="}else if(temp2[0]==\"product\"){";
			 initStr +=" TempLink=\"cat_system.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			 initStr +="   Shadowbox.open({ \n"
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
			 initStr +="   content:    TempLink, \n";
			 initStr +="   height:     150,\n";
			 initStr +="   width:      350\n";
			 initStr +="  }); \n";
			 initStr +="}else{ \n";
			 initStr +=" alert(\"Invalid move\");"
			 initStr += "} \n"; 
			 initStr +=" }}) \n";    
			 eval(initStr);
         }
        }  
         // code for product drag and drop 
 if( document.getElementById('ProductArray'+cid).innerHTML!=""){
     	
          var testProduct;
          testProduct=document.getElementById('ProductArray'+cid).innerHTML;  
    	  var tempProduct; 
          tempProduct =testProduct.split(","); 
    	for(var j=0;j<tempProduct.length;j++){
              
             new Draggable("SystemProduct-"+tempProduct[j]+"-"+cid , {revert:true})
		}	
	       
	 }  
           
		 Shadowbox.deact();
         Shadowbox.init();
		}

	}	
function HideSystem(baseurl,cid,id){
  //AjaxSystemArr.push(cid);
	for ( var i in AjaxSystemArr )
	{
	
		if(AjaxSystemArr[i]==cid){
			AjaxSystemArr.splice(i,1);

		}
 }

	
	link= baseurl+'system.php?cid='+cid+'&id='+id;
	var linkComp = link.split( "?");
	var result;
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {

			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('resultSystem'+cid).innerHTML = result;  
			document.getElementById('resultSystem'+cid).style.display = "none";
            document.getElementById('showSystem'+cid).style.display = "block";
            document.getElementById('HideSystem'+cid).style.display = "none";
		
		}

}

/// PARTS 
 var AjaxPartIdArrr =new  Array();
function ShowPart(baseurl,cid){
   //alert(attributeDisplay);
   AjaxPartIdArrr.push(cid);
	link= baseurl+'part.php?cid='+cid ;
	var linkComp = link.split( "?");
		var result;
		
				
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {
           
			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('resultPart'+cid).innerHTML = result;  
		    document.getElementById('resultPart'+cid).style.display = "block";
            document.getElementById('showCatPart'+cid).style.display = "none";
            document.getElementById('HideCatPart'+cid).style.display = "block";
           
           
           // for internet explorer  
         if(( document.getElementById('partcatArray'+cid).innerHTML=="")&&  
        ( document.getElementById('PartProductArray'+cid).innerHTML=="")){
            document.getElementById('resultPart'+cid).style.display = "none";
        }  
        
          // code for category drag and drop 
      if( document.getElementById('partcatArray'+cid).innerHTML!=""){
     	
          var test;
          test=document.getElementById('partcatArray'+cid).innerHTML;  
    	  var temp1; 
          temp1 =test.split(","); 
    	for(var j=0;j<temp1.length;j++){
    		   new Draggable("partIcon-"+ temp1[j] , {revert:true})
               var initStr = "";
               
			 initStr ="Droppables.add(\"boxPart\"+ "+ temp1[j] + ", {accept:'products', hoverclass:'cart-active',";
				
				
			 initStr +=" onDrop: function(element ) {    \n";
			 initStr += "temp2 =element.id.split(\"-\")\n";
			 initStr += "var TempLink \n";
		     
		     initStr +="if(temp2[1]=="+ temp1[j] +" && temp2[0]==\"partIcon\"){ \n";
             initStr +=     " return; \n"
			
			  
			 initStr += "}else if(temp2[0]==\"partIcon\"){";
			 initStr += "TempLink=\"partcat_move.php?dropid="+temp1[j]+"&id=\"+temp2[1] \n";
			 initStr +="   Shadowbox.open({ \n" ;
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
		     initStr +="   content:    TempLink, \n";
		     initStr +="   height:     150,\n";
		     initStr +="   width:      350\n";
		     initStr +="  }); \n";
			 initStr +="}else if(temp2[0]==\"partProduct\"){ \n";
			 initStr +=" TempLink=\"partcat_move1.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			 initStr +="   Shadowbox.open({ \n" ;
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
			 initStr +="   content:    TempLink, \n";
			 initStr +="   height:     150,\n";
			 initStr +="   width:      350\n";
			 initStr +="  }); \n";
			/*  initStr +=" }else if(temp2[0]==\"Indproduct\"){ \n";
			 
	        initStr +=" TempLink=\"ind_cat.php?dropid="+temp1[j]+"&id=\"+temp2[1]+\"&catId=\"+temp2[2] \n";
			
      		initStr +="   Shadowbox.open({ \n" ;
			initStr +="    player:     'iframe', \n";
			initStr +="   title:      'Move or Copy', \n";
			initStr +="   content:    TempLink, \n";
			initStr +="   height:     150,\n";
			initStr +="   width:      350\n";
			initStr +="  }); \n"; */
			initStr +="}else{ \n";
			initStr +=" alert(\"Invalid move\"); \n";
			initStr += "} \n"; 
			initStr +=" }}) \n";
				
			eval(initStr);
			
		}	
	       
	 }
	  // code for product drag and drop 
     if( document.getElementById('PartProductArray'+cid).innerHTML!=""){
     	
          var testProduct;
          testProduct=document.getElementById('PartProductArray'+cid).innerHTML;  
    	  var tempProduct; 
          tempProduct =testProduct.split(","); 
    	for(var j=0;j<tempProduct.length;j++){
             new Draggable("partProduct-"+tempProduct[j]+"-"+cid , {revert:true})
             
             
             
		}	
	       
	 }
	  Shadowbox.deact();
      Shadowbox.init();
    
		}
 
	}	
function HidePart(baseurl,cid){
//AjaxPartIdArrr.pop(cid);
	 for ( var i in AjaxPartIdArrr )
		{
		
			if(AjaxPartIdArrr[i]==cid){
				AjaxPartIdArrr.splice(i,1);
	
			}
   }

	link= baseurl+'part.php?cid='+cid;
	var linkComp = link.split( "?");
		var result;
		
				
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {

			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('resultPart'+cid).innerHTML = result;  
			document.getElementById('resultPart'+cid).style.display = "none";
            document.getElementById('showCatPart'+cid).style.display = "block";
            document.getElementById('HideCatPart'+cid).style.display = "none";
			
		}

	}
	
	
function ShowMessageDetails(baseurl,i){
 	link= baseurl+'process.php?id='+i ;
	var linkComp = link.split( "?");
		var result;
		
				
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {
           
			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('messageDetails').innerHTML = result;  
			document.getElementById('messageDetails').style.display = "block";
		   
			
		Shadowbox.deact();
        Shadowbox.init();
	  }
}	  
function ShowContactMessageDetails(baseurl,i){
 	link= baseurl+'contact.php?id='+i ;
	var linkComp = link.split( "?");
		var result;
		
				
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {
           
			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('messageDetails1').innerHTML = result;  
			document.getElementById('messageDetails1').style.display = "block";
		   
			
		Shadowbox.deact();
        Shadowbox.init();
	  }	  
        
}         	
	
	/********** pages       **********/
var AjaxMenuIdArr=new Array();
	var DeparmentIdArr=new Array();
function ShowPages(baseurl,cid){
	AjaxMenuIdArr.push(cid);
	link= baseurl+'process.php?cid='+cid;
	var linkComp = link.split( "?");
		var result;
		
				
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {

			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('result'+cid).innerHTML = result;  
			 document.getElementById('result'+cid).style.display = "block";
            document.getElementById('showCat'+cid).style.display = "none";
            document.getElementById('HideCat'+cid).style.display = "block";
            
             // for internet explorer  
         if( document.getElementById('menuArray'+cid).innerHTML==""){
            document.getElementById('result'+cid).style.display = "none";
        }  
            
            // code for category drag and drop 
      if( document.getElementById('menuArray'+cid).innerHTML!=""){
     	
          var test;
          test=document.getElementById('menuArray'+cid).innerHTML;  
    	  var temp1; 
          temp1 =test.split(","); 
        
    	for(var j=0;j<temp1.length;j++){
    		 new Draggable("item-"+ temp1[j] , {revert:true})
    		
    		 var initStr = "";
             initStr ="Droppables.add(\"boxMenu\"+ "+ temp1[j] + ", {accept:'products', hoverclass:'cart-active',";
           
			 initStr +=" onDrop: function(element ) {    \n";
			 initStr += "temp2 =element.id.split(\"-\")\n";
			 initStr += "var TempLink \n";
		     
		     initStr += " if(temp2[0]==\"item\"){";
			 initStr += "TempLink=\"order.php?dropid="+temp1[j]+"&id=\"+temp2[1] \n";
			 initStr +="   Shadowbox.open({ \n" ;
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
		     initStr +="   content:    TempLink, \n";
		     initStr +="   height:     150,\n";
		     initStr +="   width:      350\n";
		     initStr +="  }); \n";
			initStr +="}else{ \n";
			initStr +=" alert(\"Invalid move\"); \n";
			initStr += "} \n"; 
			initStr +=" }}) \n";
				
		     eval(initStr);
			
		}	
	 
	 }   
            Shadowbox.deact();
            Shadowbox.init();
		}

	}	
function HidePages(baseurl,cid){
	//AjaxMenuIdArr.pop(cid);
	 for ( var i in AjaxMenuIdArr )
		{
		
			if(AjaxMenuIdArr[i]==cid){
				AjaxMenuIdArr.splice(i,1);
	
			}
   }
	link= baseurl+'process.php?cid='+cid;
	var linkComp = link.split( "?");
    var result;
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");
	    obj.callback = function (responseTxt, responseStat) {

			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('result'+cid).innerHTML = result;  
			document.getElementById('result'+cid).style.display = "none";
            document.getElementById('showCat'+cid).style.display = "block";
            document.getElementById('HideCat'+cid).style.display = "none";
		}

	}
	
//*********** INDUSTRY ***********
function ShowSystemIndustry(baseurl,cid){
	link= baseurl+'industry.php?cid='+cid;
	var linkComp = link.split( "?");
	var result;
	var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {

			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('resultIndustry'+cid).innerHTML = result;  
			document.getElementById('resultIndustry'+cid).style.display = "block";
            document.getElementById('showCatIndustry'+cid).style.display = "none";
            document.getElementById('HideCatIndustry'+cid).style.display = "block";
            
          // for internet explorer
        if( document.getElementById('resultIndustry'+cid).innerHTML==""){
            document.getElementById('resultIndustry'+cid).style.display = "none";
        } 
	       
		// Shadowbox.deact();
        // Shadowbox.init();
		}

	}	
function HideSystemIndustry(baseurl,cid,id){
	link= baseurl+'industry.php?cid='+cid+'&id='+id;
	var linkComp = link.split( "?");
	var result;
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {

			// we'll do something to process the data here.
			result = responseTxt
			
			document.getElementById('resultIndustry'+cid).innerHTML = result;  
			document.getElementById('resultIndustry'+cid).style.display = "none";
            document.getElementById('showCatIndustry'+cid).style.display = "block";
            document.getElementById('HideCatIndustry'+cid).style.display = "none";
		
		}

	}	
function ProductMove(cid,orderid,parentid,task){
 
	link='ordering.php?task='+task+'&parentid='+parentid+'&category='+cid+'&orderid='+orderid;
	var linkComp = link.split( "?");
		
		
		var result;
		
				
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {
           
           ShowPage();  
			// we'll do something to process the data here.
			result = responseTxt
			//alert(result);
		//	return; 

		}

	}
	
function MenuMove(cid,orderid,parentid,task){
 // alert(parentid);
 //alert(orderid);
 //alert(cid);
	link='ordering.php?task='+task+'&parentid='+parentid+'&menu='+cid+'&orderid='+orderid;
	var linkComp = link.split( "?");
		
		
		var result;
		
				
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {
           
           ShowBlogPage();  
			// we'll do something to process the data here.
			result = responseTxt
		//	alert(result);
		//	return; 

		}

	}	
function deleteSelectedValues(){

  link='index_process.php?category='+InputcatIdArr+'&product='+InputproductIdArr+'&industry='+InputindustryIdArr+'&productIndustry='+InputIndustryProductIdArr+'&productSystem='+InputSystemProductIdArr+'&attribute='+InputAttributeIdArr+'&partcat='+InputPartCatIdArr+'&PartProduct='+InputPartProductIdArr+'&mainsystem='+InputsystemIdArr;
  InputcatIdArr=[];
  InputproductIdArr=[];
  InputindustryIdArr=[];
  InputIndustryProductIdArr=[];
  InputSystemProductIdArr=[];
  InputAttributeIdArr=[];
  InputPartCatIdArr=[];
  InputPartProductIdArr=[];
  InputsystemIdArr=[];															  
  
	var linkComp = link.split( "?");
		
		
		var result;
		
				
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {
           
           ShowPage();  
			// we'll do something to process the data here.
			result = responseTxt
			alert(result);
			 Shadowbox.deact();
		       Shadowbox.init();
		

		}
}
function deleteSelectedMenus(){
	 //alert(InputisystemIdArr);
	   link='index_process.php?page='+InputMenuPageIdArr+'&link='+InputMenuLinkIdArr+'&placeholder='+InputMenuPlaceholderIdArr;
		var linkComp = link.split( "?");
			
			
			var result;
			
					
			var obj = new ajaxObject(linkComp[0], fin);

			obj.update(linkComp[1],"GET");

			obj.callback = function (responseTxt, responseStat) {
	           
	           ShowPage();  
				// we'll do something to process the data here.
				result = responseTxt
				alert(result);
				 Shadowbox.deact();
			    Shadowbox.init();
			

			}
	}	
function ShowBlogPage(){
 //alert(AjaxBlogIdArray);
  //alert(AjaxMenuIdArr);
   link='index1.php?tabAction='+tabAction+'&idArr='+AjaxMenuIdArr+'&BlogIdArray='+AjaxBlogIdArray;
	var linkComp = link.split( "?");
		
		
		var result;
		
				
		var obj = new ajaxObject(linkComp[0], fin);

		obj.update(linkComp[1],"GET");

		obj.callback = function (responseTxt, responseStat) {
           
          
			// we'll do something to process the data here.
			result = responseTxt
			document.getElementById('left').innerHTML = result;  
		    document.getElementById('left').style.display = "block";
		
		if( document.getElementById('catArray').innerHTML!=""){
     	
          var test;
          test=document.getElementById('catArray').innerHTML;  
    	  var temp1; 
          temp1 =test.split(","); 
        
    	for(var j=0;j<temp1.length;j++){
    		 new Draggable("item-"+ temp1[j] , {revert:true})
    		
    		 var initStr = "";
             initStr ="Droppables.add(\"boxMenu\"+ "+ temp1[j] + ", {accept:'products', hoverclass:'cart-active',";
           
			 initStr +=" onDrop: function(element ) {    \n";
			 initStr += "temp2 =element.id.split(\"-\")\n";
			 initStr += "var TempLink \n";
		     
		     initStr += " if(temp2[0]==\"item\"){";
			 initStr += "TempLink=\"order.php?dropid="+temp1[j]+"&id=\"+temp2[1] \n";
			 initStr +="   Shadowbox.open({ \n" ;
			 initStr +="    player:     'iframe', \n";
			 initStr +="   title:      'Move or Copy', \n";
		     initStr +="   content:    TempLink, \n";
		     initStr +="   height:     150,\n";
		     initStr +="   width:      350\n";
		     initStr +="  }); \n";
			initStr +="}else{ \n";
			initStr +=" alert(\"Invalid move\"); \n";
			initStr += "} \n"; 
			initStr +=" }}) \n";
				
		     eval(initStr);
			
		}	
	 
	 } 
		if(InputMenuPageIdArr.length!=0){
			 for(var p1=0;p1<InputMenuPageIdArr.length;p1++){
			 
			  document.getElementById("menu"+InputMenuPageIdArr[p1]).checked=true;
			 }
			}
		if(InputMenuLinkIdArr.length!=0){
			 for(var p2=0;p2<InputMenuLinkIdArr.length;p2++){
			 
			  document.getElementById("menu"+InputMenuPageIdArr[p2]).checked=true;
			 }
			}
		if(InputMenuPlaceholderIdArr.length!=0){
			 for(var p3=0;p3<InputMenuPlaceholderIdArr.length;p3++){
			 
			  document.getElementById("menu"+InputMenuPlaceholderIdArr[p3]).checked=true;
			 }
			}
		Shadowbox.deact();
         Shadowbox.init();
	
	
	}
}

			
