if condition doesn't work with input variable
<p>I have a problem in slideAC(data) function.</p>

<p>If condition seem to have some problem in the picture condition (data[0] == "picture")</p>

<p>I have already try to alert the data for testing the input value by alert(data[0]);</p>

<p>and the result is "picture" as well I have no idea what is the problem??</p>

<p>since other test condition work correctly.</p>

<hr>

<p>HERE IS THE INPUT DATA IN THE extractData(data &lt;-- array) FUCNCTION </p>

<p>(It's Already Split from other function by use split("\n"))</p>

<pre><code>slide
,- width 400
,- height 300
,- into #slide1
,- picture
,+[pic/001.png]
,+[pic/002.jpg]
,+[pic/003.jpg]
,+[pic/004.jpg]
,
</code></pre>

<p><strong>The purpose of the code is extract the words from the above text and generate some code.</strong></p>

<pre><code>  function extractData(data){

    alert(data);
    var n = 0;
    var step1 = "";
    var step2 = "";
    var step3 = "";
    var step4 = "";
    var picture =[];
        //check '@' command by call the first line data
        if(data[0].indexOf("slide") !== -1){

            for(var i=1; i&lt;data.length; i++){
//                alert(n);

                switch (n){
                    case 0:///////////////////////////////////////
//                    alert("case1");
                    //extract from '-'
                    if(data[i].indexOf('-') !== -1){
                        step1 = data[i].replace('-','');
                        step2 = step1.split(' ');
                        step3 = step2.slice(1,step2.length);
                        //slide Attribute Compiler
                        n = slideAC(step3);

                    }else{
                        alert("out");
                    }//end of if condition
                    break;

                    case 1:///////////////////////////////////////
//                    alert("case2");
                    //extract from '+'
                    if(data[i].indexOf('+') !== -1){
                        step1 = data[i].replace('+','');
                        step2 = step1.replace("[","");
                        step3 = step2.replace("]","");
                        picture.push(step3);
                        alert(step3);

                    }else if(data[i].indexOf('-') !== -1){
                        step1 = data[i].replace('-','');
                        step2 = step1.split(' ');
                        step3 = step2.slice(1,step2.length);
                        //slide Attribute Compiler
                        n = slideAC(step3);
                    }else{
                        //Error
//                        alert("wrong pic syntax");
//                        javascript_abort();
                    }//end of if condition
                    break;

                }//end of iswitch case

            }//end of item for loop

        }else if(data[0].indexOf("menu") !== -1){
            //Provision
        }else if(data[0].indexOf("form") !== -1){
            //Provision
        }else{
            javascript_abort();
        }//end of if condition


    }//end of syntaxCompiler


    //slide Attribute Compiler
    function slideAC(data){
//    alert(data[0]);

    var a = 0

            if(data[0] == "width"){
                var propWidth = data[1];
//                alert(data[0] + " : " + propWidth);
//                alert(typeof data);
                a = 0;
            }else if(data[0] == "height"){
                 var propHeight = data[1];
//                alert(data[0] + " : " + propHeight);
//                alert(typeof data);
                a = 0;
            }else if(data[0] == "into"){
                var propInto = data[1];
//                alert(data[0] + " : " + propInto);
//                alert(typeof data);
                a = 0;
            }else if(data[0] == "picture"){
                a = 1;
            }else{
                alert("why");
//                javascript_abort();
            }//end of if condition

        return a;

    }//end of slide attribute compiler
</code></pre>

<p>Do you have some advise ?? Please help</p>

<p>I just want the if condition work correctly</p>

<p>Thanks in advance</p>

<p>PS. Sorry If my wording make you confuse.  </p>
