// JavaScript Document
   function LoadWlist(str2,value)
    { 
        if (str2 == "")
        {
            document.getElementById("PNodeI").innerHTML = "";
			document.getElementById("PNodeIP").innerHTML = "";
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttpw = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttpw = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttpw.onreadystatechange = function ()
        {
            if (xmlhttpw.readyState == 4 && xmlhttpw.status == 200)
            {
                //document.getElementById("PNodeI").style.display = '';
				document.getElementById("PNodeIP").style.display = '';
               BetterInnerHTML( document.getElementById("PNodeI"), xmlhttpw.responseText);
			   BetterInnerHTML( document.getElementById("PNodeIP"), xmlhttpw.responseText);
			   
            }
        }

        xmlhttpw.open("GET", "../../DB/03-scope/loadWBS-G.php?q="+value+"&p=" + str2, true);
        xmlhttpw.send();

    }


    function LoadItemList(str, str2)
    {
        if (str == "")
        {
            document.getElementById("itemList").innerHTML = "";
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
               document.getElementById("itemList").style.display = '';
               BetterInnerHTML( document.getElementById("itemList"), xmlhttp1.responseText);
            }
        }

        xmlhttp1.open("GET", "../../DB/03-scope/LoadItemList.php?q=" + str + "&p=" + str2, true);
        xmlhttp1.send();

    }


	//load Add before wbs form
    function LoadWBSG(str, str2, str3,event)
    {
        if (str == "")
        {
            document.getElementById("loadForm").innerHTML = "";
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
                document.getElementById("loadForm").style.display = '';
                document.getElementById("loadForm").innerHTML = xmlhttp1.responseText;
				$('#description').focus();
    			var frm = $('#addBeforeForm');
    			frm.submit(function (ev) {
        		$.ajax({
				type: frm.attr('method'),
				url: frm.attr('action'),
				data: frm.serialize(),
				//dataType:"html",
				success: function (data) {
					
				document.getElementById("loadWBStable").innerHTML = data;
				$('#myModal').modal('toggle');
				 LoadWlist(str2);
				 frm.trigger("reset");
					}
				
        });

        ev.preventDefault();
    });
	
            }
        }

        xmlhttp1.open("GET", "../../DB/03-scope/loadWBSbeforeForm-simple.php?q=" + str + "&p=" + str2 + "&parent=" + str3, true);
        xmlhttp1.send();

    }
	//load Add before wbs form
    function LoadWBSA(str, str2, str3,event)
    {
        if (str == "")
        {
            document.getElementById("loadForm").innerHTML = "";
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
                document.getElementById("loadForm").style.display = '';
                document.getElementById("loadForm").innerHTML = xmlhttp1.responseText;
				$('#description').focus();
    			var frm = $('#addAfterForm');
    			frm.submit(function (ev) {
        		$.ajax({
				type: frm.attr('method'),
				url: frm.attr('action'),
				data: frm.serialize(),
				//dataType:"html",
				success: function (data) {

				document.getElementById("loadWBStable").innerHTML = data;
				$('#myModal').modal('toggle');
				 LoadWlist(str2);
				 frm.trigger("reset");
					}

        });

        ev.preventDefault();
    });

            }
        }

        xmlhttp1.open("GET", "../../DB/03-scope/loadWBSAfterForm-simple.php?q=" + str + "&p=" + str2 + "&parent=" + str3, true);
        xmlhttp1.send();

    }


    function LoadWBStable(str, str2)
    {
        $('#loader').show();
        if (str == "")
        {
            $('#loadWBStable').html("");
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp21 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp21 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp21.onreadystatechange = function ()
        {
            if (xmlhttp21.readyState == 4 && xmlhttp21.status == 200)
            {
                document.getElementById("loadWBStable").style.display = ''; 
                document.getElementById("loadWBStable").innerHTML = xmlhttp21.responseText;
 				$('#loader').hide();
                

            }
            else{
                $('#loader').hide();
            }
        }
      
        xmlhttp21.open("GET", "../../DB/03-scope/loadWBStable-simple.php?WID=" + str + "&p=" + str2, true);
        xmlhttp21.send();

    }

//loadWBSEditform
    function LoadWBSEditForm(str, str2, event)
    {
        if (str == "")
        {
            $('#loadForm').html("");
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
                document.getElementById("loadForm").style.display = ''; 
                $('#loadForm').html(xmlhttp1.responseText);
				$('#WEdescription').focus();
				var frm = $('#editWBSForm');
    			frm.submit(function (ev) {
        		$.ajax({
				type: frm.attr('method'),
				url: frm.attr('action'),
				data: frm.serialize(),
				//dataType:"html",
				success: function (data) {
					
				document.getElementById("loadWBStable").innerHTML = data;
				$('#myModal').modal('toggle');

				 frm.trigger("reset");
					}
				
        });

        ev.preventDefault();
    });
            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/loadWBSEditForm-simple.php?EditW=" + str + "&WID=" + str2, true);
        xmlhttp1.send();
    }



//loadITEMEditform
    function LoadITEMEditForm(str, str2, event)
    {
        if (str == "")
        {
            document.getElementById("loadForm").innerHTML = "";
           
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
                document.getElementById("loadForm").style.display = '';
                document.getElementById("loadForm").innerHTML = xmlhttp1.responseText;
				$('#description').focus();
				var frm = $('#editITEMForm');
					frm.submit(function (ev) {
					$.ajax({
					type: frm.attr('method'),
					url: frm.attr('action'),
					data: frm.serialize(),
					//dataType:"html",
					success: function (data) {
						
					document.getElementById("loadWBStable").innerHTML = data;
					$('#myModal').modal('toggle');
					//showloader();
					 frm.trigger("reset");
						}
					
					});
					ev.preventDefault();
    			});
            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/loadITEMEditForm-simple.php?EditI=" + str + "&WID=" + str2, true);
        xmlhttp1.send();

    }


//loadITEMInsertform

    function LoadIITEMForm(str, str2, event)
    { 
        if (str == "")
        {
             $('#loadForm').html("");
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
                document.getElementById("loadForm").style.display = '';
                $('#loadForm').html(xmlhttp1.responseText);
				$('#description').focus();
					var frm = $('#IITEMForm');
					frm.submit(function (ev) {
					$.ajax({
					type: frm.attr('method'),
					url: frm.attr('action'),
					data: frm.serialize(),
					//dataType:"html",
					success: function (data) {
						
					document.getElementById("loadWBStable").innerHTML = data;
					$('#myModal').modal('toggle');
					//showloader();
					 frm.trigger("reset");
						}
					
					});
					ev.preventDefault();
    			});
	
            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/loadITEMIForm-simple.php?WBSID=" + str + "&WID=" + str2, true);
        xmlhttp1.send();

    }


//loadSubITEMInsertform
    function LoadSIITEMForm(str, str3, str2, event)
    {
        if (str == "")
        {
            $('#loadForm').html("");
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
                document.getElementById("loadForm").style.display = '';
                $('#loadForm').html(xmlhttp1.responseText);
				$('#description').focus();
					var frm = $('#IITEMForm');
					frm.submit(function (ev) {
					$.ajax({
					type: frm.attr('method'),
					url: frm.attr('action'),
					data: frm.serialize(),
					//dataType:"html",
					success: function (data) {
					document.getElementById("loadWBStable").innerHTML = data;
					//$('#myModal').hide();$
					$('#myModal').modal('toggle');
					//showloader();
					 frm.trigger("reset");
						}
					
					});
					ev.preventDefault();
    			});
				
            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/loadITEMIForm-simple.php?WBSID=" + str + "&WID=" + str2 + "&pItem=" + str3, true);
        xmlhttp1.send();

    }


    function PNodeLoadItem(str)
    {
        if (str == "")
        {
            document.getElementById("itemList1").innerHTML = "";
            $('#itemList1').html("");
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
                document.getElementById("itemList1").style.display = '';
                $('#itemList1').html(xmlhttp1.responseText);

            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/LoadItemWBS.php?q=" + str, true);
        xmlhttp1.send();

    }

    function call_del_DB(str, str2,event)
    {

        var answer = confirm("This deleted information cannot be retrieved. Press OK to Delete.")
        if (!answer) {
            event.stopPropagation();
            return;
        }
        if (str == "")
        {
             $('#loadWBStable').html("");
            
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {

                document.getElementById("loadWBStable").style.display = '';
          		document.getElementById("loadWBStable").innerHTML = xmlhttp1.responseText;
                 LoadWlist(str2);
            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/GWBSDB-G-simple.php?del=" + str + "&WID=" + str2, true);
        xmlhttp1.send();

    }


// call del item
    function call_del_IDB(str, str2,event)
    {

        var answer = confirm("This deleted information cannot be retrieved. Press OK to Delete.")
        if (!answer)
            return;
        if (str == "")
        {
            $('#loadWBStable').html("");
         
            return;
        }
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari

            xmlhttp1 = new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp1.onreadystatechange = function ()
        {
            if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200)
            {
                document.getElementById("loadWBStable").style.display = '';
                $('#loadWBStable').html(xmlhttp1.responseText);

            }
        }
        xmlhttp1.open("GET", "../../DB/03-scope/GWBSITEMDB-G-simple.php?del=" + str + "&WID=" + str2, true);
        xmlhttp1.send();

    }
	
/////////////
/*$(document).ready(function() {

$("#loadWBStable table tr td:nth-child(2):contains('WBS')").addClass('bold_row_2').siblings('td').addClass('bold_row_2');

$("#loadWBStable table tr td:nth-child(2):contains('MWBS')").addClass('bold_row_1').siblings('td').addClass('bold_row_1');

$("#loadWBStable table tr td:nth-child(2):contains('ITEM')").addClass('bold_row_3').siblings('td').addClass('bold_row_3');

$("#loadWBStable table tr td:nth-child(2):contains('SITEM')").addClass('bold_row_4').siblings('td').addClass('bold_row_4');

});*/
