 
 /* General Functions */

  function base64_encode(data){
  var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
    ac = 0,
    enc = "",
    tmp_arr = [];

  if (!data) {
    return data;
  }

  do { // pack three octets into four hexets
    o1 = data.charCodeAt(i++);
    o2 = data.charCodeAt(i++);
    o3 = data.charCodeAt(i++);

    bits = o1 << 16 | o2 << 8 | o3;

    h1 = bits >> 18 & 0x3f;
    h2 = bits >> 12 & 0x3f;
    h3 = bits >> 6 & 0x3f;
    h4 = bits & 0x3f;

    // use hexets to index into b64, and append result to encoded string
    tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
  } while (i < data.length);

  enc = tmp_arr.join('');

  var r = data.length % 3;

  return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);

}

  function delsp(name){

    if (confirm('Are you sure you want to delete this profile?')) {
      
      $.post("php/xmlreq.php", { q: "d", n: name})
     .done(function(data) {
      });

      alert('Profile successfully deleted!');
      return (elem=document.getElementById(name)).parentNode.removeChild(elem);

    } 

  }


 function validate(evt) {
  var theEvent = evt || window.event;
  var key = theEvent.keyCode || theEvent.which;
  key = String.fromCharCode( key );
  var regex = /[0-9]|\./;
  if( !regex.test(key) ) {
    theEvent.returnValue = false;
    if(theEvent.preventDefault) theEvent.preventDefault();
  }
}

function errgen(t,v){
  return '<div class="alert alert-dismissable alert-danger"><strong>'+ t +'</strong> '+ v +'</div>';
}

function strpos (haystack, needle, offset) {
  var i = (haystack+'').indexOf(needle, (offset || 0));
  return i === -1 ? false : i;
}

function colorpick(id){

  parts = id.split('_');
  color = parts[1];
  ident = parts[0];

  if(color == 'g'){
    $('#'+ ident +'_o').removeAttr("style");
    $('#'+ ident +'_r').removeAttr("style");
  }
  else if(color == 'o'){
    $('#'+ ident +'_g').removeAttr("style");
    $('#'+ ident +'_r').removeAttr("style");
  }
  else if(color == 'r'){
    $('#'+ ident +'_o').removeAttr("style");
    $('#'+ ident +'_g').removeAttr("style");
  }   

  $('#' + id).attr('style', 'font-size:18px;');
  ident = replaceAll('-','_',ident);
  str = 'c_' + ident +' = '+ '"' +color+ '"';
  eval(str)
}

function initform(){

        colorpick('head-title-lenght-1_r');
        colorpick('head-title-lenght-2_o');
        colorpick('head-title-lenght-3_g');
        colorpick('head-title-lenght-4_r');

        colorpick('head-title-relevance-1_r');
        colorpick('head-title-relevance-2_o');
        colorpick('head-title-relevance-3_g');

        // head - meta kw

        colorpick('head-metakw-count-1_r');
        colorpick('head-metakw-count-2_o');
        colorpick('head-metakw-count-3_g');
        colorpick('head-metakw-count-4_r');

        colorpick('head-metakw-relevance-1_r');
        colorpick('head-metakw-relevance-2_o');
        colorpick('head-metakw-relevance-3_g');

        // head - meta desc



        colorpick('head-metadesc-lenght-1_r');
        colorpick('head-metadesc-lenght-2_o');
        colorpick('head-metadesc-lenght-3_g');
        colorpick('head-metadesc-lenght-4_r');

        colorpick('head-metadesc-relevance-1_r');
        colorpick('head-metadesc-relevance-2_o');
        colorpick('head-metadesc-relevance-3_g');

        //content checks

        colorpick('content-charcount-1_r');
        colorpick('content-charcount-2_o');
        colorpick('content-charcount-3_g');
        colorpick('content-charcount-4_r');

        colorpick('content-wordcount-1_r');
        colorpick('content-wordcount-2_o');
        colorpick('content-wordcount-3_g');
        colorpick('content-wordcount-4_r');

        colorpick('content-content-relevance-1_r');
        colorpick('content-content-relevance-2_o');
        colorpick('content-content-relevance-3_g');

        //url structure 

        colorpick('url-lenght-1_g');
        colorpick('url-lenght-2_o');
        //colorpick('url-lenght-3_g');
        colorpick('url-lenght-4_r');

        //links checks

        colorpick('links-ilinks-1_r');
        colorpick('links-ilinks-2_o');
        colorpick('links-ilinks-3_g');
        colorpick('links-ilinks-4_r');

        colorpick('links-elinks-1_r');
        colorpick('links-elinks-2_o');
        colorpick('links-elinks-3_g');
        colorpick('links-elinks-4_r');

        // ux checks

        colorpick('ux-speed-1_r');
        colorpick('ux-speed-2_o');
        colorpick('ux-speed-3_g');
        //colorpick('ux-speed-4_r');

        colorpick('ux-gram-1_g');
        colorpick('ux-gram-3_o');
        colorpick('ux-gram-4_r');
       }

        function replaceAll(find, replace, str) {
          return str.replace(new RegExp(find, 'g'), replace);
        }

       function switch_tabs(obj){
         $('.tab-content').hide();
         $('.tabs button').removeClass("selected");
         var id = obj.attr("rel");
        
         $('#'+id).show();
         obj.addClass("selected");
       }

        function isEmpty(str) {
            return (!str || 0 === str.length);
        }

      /* Auto complete fields functions */

       function updateFields_1(){
            var init = parseFloat($("#head_title_lenght-1-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#head_title_lenght-2-b").val(finit);
            }
            
         }
          function updateFields_2(){
            var init = parseFloat($("#head_title_lenght-2-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#head_title_lenght-3-b").val(finit);
            }
         }
         function updateFields_3(){
            var init = parseFloat($("#head_title_lenght-3-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#head_title_lenght-4-b").val(finit);
            }
         }
         function updateFields_4(){
            var init = parseFloat($("#head_title_relevance-1-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#head_title_relevance-2-b").val(finit);
            }
         }
         function updateFields_5(){
            var init = parseFloat($("#head_title_relevance-2-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#head_title_relevance-3-b").val(finit);
            }
         }   


    function updateFields_6(){
            var init = parseFloat($("#head_metakw_count-1-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#head_metakw_count-2-b").val(finit);
            }
         }
          function updateFields_7(){
            var init = parseFloat($("#head_metakw_count-2-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#head_metakw_count-3-b").val(finit);
            }
         }
          function updateFields_8(){
            var init = parseFloat($("#head_metakw_count-3-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#head_metakw_count-4-b").val(finit);
            }
         }
          function updateFields_9(){
            var init = parseFloat($("#head_metakw_relevance-1-l").val());
           if(!isNaN(init)){
                finit = init + 1;
                $("#head_metakw_relevance-2-b").val(finit);
            }
         }
         function updateFields_10(){
            var init = parseFloat($("#head_metakw_relevance-2-l").val());
           if(!isNaN(init)){
             finit = init + 1;
             $("#head_metakw_relevance-3-b").val(finit);
            }
         }   


        function updateFields_11(){
            var init = parseFloat($("#head_metadesc_lenght-1-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#head_metadesc_lenght-2-b").val(finit);
            }
         }
          function updateFields_12(){
            var init = parseFloat($("#head_metadesc_lenght-2-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#head_metadesc_lenght-3-b").val(finit);
            }
         }
          function updateFields_13(){
            var init = parseFloat($("#head_metadesc_lenght-3-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#head_metadesc_lenght-4-b").val(finit);
            }
         }  
          function updateFields_14(){
            var init = parseFloat($("#head_metadesc_relevance-1-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#head_metadesc_relevance-2-b").val(finit);
            }
         }
         function updateFields_15(){
            var init = parseFloat($("#head_metadesc_relevance-2-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#head_metadesc_relevance-3-b").val(finit);
            }
         }  


        function updateFields_16(){
            var init = parseFloat($("#content_charcount-1-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#content_charcount-2-b").val(finit);
            }
         }
          function updateFields_17(){
            var init = parseFloat($("#content_charcount-2-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#content_charcount-3-b").val(finit);
            }
         }
          function updateFields_18(){
            var init = parseFloat($("#content_charcount-3-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#content_charcount-4-b").val(finit);
            }
         }  


         function updateFields_19(){
            var init = parseFloat($("#content_wordcount-1-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#content_wordcount-2-b").val(finit);
            }
         }
          function updateFields_20(){
            var init = parseFloat($("#content_wordcount-2-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#content_wordcount-3-b").val(finit);
            }
         }
          function updateFields_21(){
            var init = parseFloat($("#content_wordcount-3-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#content_wordcount-4-b").val(finit);
            }
         }  

       function updateFields_22(){
            var init = parseFloat($("#content_content_relevance-1-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#content_content_relevance-2-b").val(finit);
            }
         }
         function updateFields_23(){
            var init = parseFloat($("#content_content_relevance-2-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#content_content_relevance-3-b").val(finit);
            }
         }  


         function updateFields_24(){
            var init = parseFloat($("#url_lenght-1-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#url_lenght-2-b").val(finit);
            }
         }
          function updateFields_25(){
            var init = parseFloat($("#url_lenght-2-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#url_lenght-4-b").val(finit);
            }
         }
          function updateFields_26(){
            var init = parseFloat($("#url_lenght-3-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#url_lenght-4-b").val(finit);
            }
         }  

          function updateFields_27(){
            var init = parseFloat($("#links_ilinks-1-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#links_ilinks-2-b").val(finit);
            }
         }
          function updateFields_28(){
            var init = parseFloat($("#links_ilinks-2-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#links_ilinks-3-b").val(finit);
            }
         }
          function updateFields_29(){
            var init = parseFloat($("#links_ilinks-3-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#links_ilinks-4-b").val(finit);
            }
         } 

        function updateFields_30(){
            var init = parseFloat($("#links_elinks-1-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#links_elinks-2-b").val(finit);
            }
         }
          function updateFields_31(){
            var init = parseFloat($("#links_elinks-2-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#links_elinks-3-b").val(finit);
            }
         }
          function updateFields_32(){
            var init = parseFloat($("#links_elinks-3-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#links_elinks-4-b").val(finit);
            }
         } 

         function updateFields_33(){
            var init = parseFloat($("#ux_speed-1-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#ux_speed-2-b").val(finit);
            }
         }
          function updateFields_34(){
            var init = parseFloat($("#ux_speed-2-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#ux_speed-3-b").val(finit);
            }
         }
          function updateFields_35(){
            var init = parseFloat($("#ux_speed-3-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#ux_speed-4-b").val(finit);
            }
         } 

         function updateFields_36(){
            var init = parseFloat($("#ux_gram-1-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#ux_gram-3-b").val(finit);
            }
         }
          function updateFields_37(){
            var init = parseFloat($("#ux_gram-2-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#ux_gram-3-b").val(finit);
            }
         }
          function updateFields_38(){
            var init = parseFloat($("#ux_gram-3-l").val());
            if(!isNaN(init)){
                finit = init + 1;
                $("#ux_gram-4-b").val(finit);
            }
         } 

       /* Loading Bar functions */

       bar_val = 100


       function ubmain(){
           $('.bar').width(bar_val + '%');
           $('#ldtime').html(bar_val);
       }

       function ub1(){
        if($('#crawling_http').is(':checked') == true){
          bar_val += 4;
        }
        else{
          bar_val -= 4;
        }
        ubmain();
       }

       function ub2(){
        if($('#crawling_robots').is(':checked') == true){
          bar_val += 4;
        }
        else{
          bar_val -= 4;
        }
        ubmain();
       }


       function ub3(){
        if($('#crawling_sitemap').is(':checked') == true){
          bar_val += 4;
        }
        else{
          bar_val -= 4;
        }
        ubmain();
       }

       function ub4(){
        if($('#head_title_show').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }


       function ub5(){
        if($('#head_title_lenght').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub6(){
        if($('#head_title_stop_words').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub7(){
        if($('#head_title_kw_in_title').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub8(){
        if($('#head_title_relevance').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub9(){
        if($('#head_metakw_show').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub10(){
        if($('#head_metakw_count').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub11(){
        if($('#head_metakw_relevance').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub12(){
        if($('#head_metadesc_show').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub13(){
        if($('#head_metadesc_lenght').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub14(){
        if($('#head_title_kw_in_metadesc').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub15(){
        if($('#head_metadesc_relevance').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub16(){
        if($('#content_language').is(':checked') == true){
          bar_val += 6;
        }
        else{
          bar_val -= 6;
        }
        ubmain();
       }

       function ub17(){
        if($('#content_charcount').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub18(){
        if($('#content_wordcount').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub19(){
        if($('#content_kwin').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub20(){
        if($('#content_content_relevance').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub21(){
        if($('#content_kwinitalic').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub22(){
        if($('#content_kwinbold').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub23(){
        if($('#content_headings').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub24(){
        if($('#content_iframes').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub25(){
        if($('#url_display').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub26(){
        if($('#url_kwin').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub27(){
        if($('#url_lenght').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub28(){
        if($('#url_subdomains').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub29(){
        if($('#links_ilinks').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub30(){
        if($('#links_elinks').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }

       function ub31(){
        if($('#ux_speed').is(':checked') == true){
          bar_val += 6;
        }
        else{
          bar_val -= 6;
        }
        ubmain();
       }

       function ub32(){
        if($('#ux_gram').is(':checked') == true){
          bar_val += 6;
        }
        else{
          bar_val -= 6;
        }
        ubmain();
       }

        function ub33(){
        if($('#ux_responsive').is(':checked') == true){
          bar_val += 6;
        }
        else{
          bar_val -= 6;
        }
        ubmain();
       }

       function ub34(){
        if($('#ux_feedback').is(':checked') == true){
          bar_val += 2;
        }
        else{
          bar_val -= 2;
        }
        ubmain();
       }


    /* A huge function for form submiting */

    function saveprofile(){

        /*

         General TAB

        */

        info_name  = $('#info_name').val();
        info_descr = $('#info_descr').val();
        info_ispb  = $('#info_ip').val();


        var errors_general = new Array(); 
        if(isEmpty(info_name) || isEmpty(info_descr)){
            errors_general.push("Please fill all the fields");
        }




        /*

         Crawling TAB

        */

        crawling_http    = $('#crawling_http').is(':checked');
        crawling_robots  = $('#crawling_robots').is(':checked');
        crawling_sitemap = $('#crawling_sitemap').is(':checked');
        crawling_label   = $('#crawling_label').is(':checked');
        crawling_label_c = $('#crawling_label_content').val();


        var errors_crawling = new Array();
        if(crawling_label == true){
          if(isEmpty(crawling_label_c)){
            errors_crawling.push("If setted ON, Info and Tips box, can not be empty.");
          }
        }

        


        /* 

        Head TAB

        */

        //
        // Title 
        //

        var errors_head = new Array(); 

        head_title_show          = $('#head_title_show').is(':checked');
        head_title_lenght        = $('#head_title_lenght').is(':checked');
        head_title_stop_words    = $('#head_title_stop_words').is(':checked');
        head_title_kw_in_title   = $('#head_title_kw_in_title').is(':checked');
        head_title_relevance     = $('#head_title_relevance').is(':checked');
        head_title_label         = $('#head_title_label').is(':checked');
        head_title_label_content = $('#head_title_label_content').val();



          //title lenght

          
          if(head_title_lenght == true){
            

            head_title_lenght_1 = parseFloat($('#head_title_lenght-1-l').val());
            head_title_lenght_2 = parseFloat($('#head_title_lenght-2-b').val());
            head_title_lenght_3 = parseFloat($('#head_title_lenght-2-l').val());
            head_title_lenght_4 = parseFloat($('#head_title_lenght-3-b').val());
            head_title_lenght_5 = parseFloat($('#head_title_lenght-3-l').val());
            head_title_lenght_6 = parseFloat($('#head_title_lenght-4-b').val());

            if(isEmpty(head_title_lenght_1) || isEmpty(head_title_lenght_2 ) || isEmpty(head_title_lenght_3) || isEmpty(head_title_lenght_4) ||  isEmpty(head_title_lenght_5) || isEmpty(head_title_lenght_6)){
              errors_head.push("Title lenght Check -> None of the boxes can be empty");
            }
            else{
              if(head_title_lenght_1 >= head_title_lenght_2 || head_title_lenght_1 >= head_title_lenght_3 || head_title_lenght_1 >= head_title_lenght_4 || head_title_lenght_1 >= head_title_lenght_5 || head_title_lenght_1 >= head_title_lenght_6){
                 errors_head.push("Title lenght Check -> Boxes should have unequal, ascending values");
              }
              else if(head_title_lenght_2 >= head_title_lenght_3 || head_title_lenght_2 >= head_title_lenght_4 || head_title_lenght_2 >= head_title_lenght_5 || head_title_lenght_2 >= head_title_lenght_6){
                 errors_head.push("Title lenght Check -> Boxes should have unequal, ascending values");
              }
              else if(head_title_lenght_3 >= head_title_lenght_4 || head_title_lenght_3 >= head_title_lenght_5 || head_title_lenght_3 >= head_title_lenght_6){
                 errors_head.push("Title lenght Check -> Boxes should have unequal, ascending values");
              }
               else if(head_title_lenght_4 >= head_title_lenght_5 || head_title_lenght_4 >= head_title_lenght_6){
                 errors_head.push("Title lenght Check -> Boxes should have unequal, ascending values");
              }
               else if(head_title_lenght_5 >= head_title_lenght_6){
                 errors_head.push("Title lenght Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            head_title_lenght_1 = false;
            head_title_lenght_2 = false;
            head_title_lenght_3 = false;
            head_title_lenght_4 = false;
            head_title_lenght_5 = false;
            head_title_lenght_6 = false;

          }

          //end of title lenght

          //kw in title rel

          if(head_title_relevance == true){

            head_title_relevance_1 = parseFloat($('#head_title_relevance-1-l').val());
            head_title_relevance_2 = parseFloat($('#head_title_relevance-2-b').val());
            head_title_relevance_3 = parseFloat($('#head_title_relevance-2-l').val());
            head_title_relevance_4 = parseFloat($('#head_title_relevance-3-b').val());

            if(isEmpty(head_title_relevance_1) || isEmpty(head_title_relevance_2 ) || isEmpty(head_title_relevance_3) || isEmpty(head_title_relevance_4)){
              errors_head.push("Title Relevance Check -> None of the boxes can be empty");
            }
            else{

                 if(head_title_relevance_1 >= head_title_relevance_2 || head_title_relevance_1 >= head_title_relevance_3 ||head_title_relevance_1 >= head_title_relevance_4){
                   errors_head.push("Title Relevance Check -> Boxes should have unequal, ascending values");
                }
                else if(head_title_relevance_2 >= head_title_relevance_3 || head_title_relevance_2 >= head_title_relevance_4 ){
                   errors_head.push("Title Relevance Check -> Boxes should have unequal, ascending values");
                }
                else if(head_title_relevance_3 >= head_title_relevance_4 ){
                   errors_head.push("Title Relevance Check -> Boxes should have unequal, ascending values");
                }
                 

            }
            
          }
          else{
            head_title_relevance_1 = false;
            head_title_relevance_2 = false;
            head_title_relevance_3 = false;
            head_title_relevance_4 = false;
          }

          //end of kw in title rel

         if(head_title_label == true){
            if(isEmpty(head_title_label_content)){
              errors_head.push("If setted ON, Info and Tips box, can not be empty.");
            }
          }



        //
        //Meta keywords
        //

        head_metakw_show        = $('#head_metakw_show').is(':checked');
        head_metakw_count       = $('#head_metakw_count').is(':checked');
        head_metakw_relevance   = $('#head_metakw_relevance').is(':checked');
        head_metakw_label       = $('#head_metakw_label').is(':checked');
        head_metakw_label_c     = $('#head_metakw_label_content').val();





          //meta kw count

          
          if(head_metakw_count == true){
            

            head_metakw_count_1 = parseFloat($('#head_metakw_count-1-l').val());
            head_metakw_count_2 = parseFloat($('#head_metakw_count-2-b').val());
            head_metakw_count_3 = parseFloat($('#head_metakw_count-2-l').val());
            head_metakw_count_4 = parseFloat($('#head_metakw_count-3-b').val());
            head_metakw_count_5 = parseFloat($('#head_metakw_count-3-l').val());
            head_metakw_count_6 = parseFloat($('#head_metakw_count-4-b').val());

            if(isEmpty(head_metakw_count_1) || isEmpty(head_metakw_count_2 ) || isEmpty(head_metakw_count_3) || isEmpty(head_metakw_count_4) ||  isEmpty(head_metakw_count_5) || isEmpty(head_metakw_count_6)){
              errors_head.push("Meta keywords count Check -> None of the boxes can be empty");
            }
            else{
              if(head_metakw_count_1 >= head_metakw_count_2 || head_metakw_count_1 >= head_metakw_count_3 || head_metakw_count_1 >= head_metakw_count_4 || head_metakw_count_1 >= head_metakw_count_5 || head_metakw_count_1 >= head_metakw_count_6){
                 errors_head.push("Meta keywords count Check -> Boxes should have unequal, ascending values");
              }
              else if(head_metakw_count_2 >= head_metakw_count_3 || head_metakw_count_2 >= head_metakw_count_4 || head_metakw_count_2 >= head_metakw_count_5 || head_metakw_count_2 >= head_metakw_count_6){
                 errors_head.push("Meta keywords count Check -> Boxes should have unequal, ascending values");
              }
              else if(head_metakw_count_3 >= head_metakw_count_4 || head_metakw_count_3 >= head_metakw_count_5 || head_metakw_count_3 >= head_metakw_count_6){
                 errors_head.push("Meta keywords count Check -> Boxes should have unequal, ascending values");
              }
               else if(head_metakw_count_4 >= head_metakw_count_5 || head_metakw_count_4 >= head_metakw_count_6){
                 errors_head.push("Meta keywords count Check -> Boxes should have unequal, ascending values");
              }
               else if(head_metakw_count_5 >= head_metakw_count_6){
                 errors_head.push("Meta keywords count Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            head_metakw_count_1 = false;
            head_metakw_count_2 = false;
            head_metakw_count_3 = false;
            head_metakw_count_4 = false;
            head_metakw_count_5 = false;
            head_metakw_count_6 = false;

          }

          //end of meta kw count

          //kw rel with site

          if(head_metakw_relevance == true){

            head_metakw_relevance_1 = parseFloat($('#head_metakw_relevance-1-l').val());
            head_metakw_relevance_2 = parseFloat($('#head_metakw_relevance-2-b').val());
            head_metakw_relevance_3 = parseFloat($('#head_metakw_relevance-2-l').val());
            head_metakw_relevance_4 = parseFloat($('#head_metakw_relevance-3-b').val());

            if(isEmpty(head_metakw_relevance_1) || isEmpty(head_metakw_relevance_2 ) || isEmpty(head_metakw_relevance_3) || isEmpty(head_metakw_relevance_4)){
              errors_head.push("Meta keywords relevance with site Check -> None of the boxes can be empty");
            }
            else{

                 if(head_metakw_relevance_1 >= head_metakw_relevance_2 || head_metakw_relevance_1 >= head_metakw_relevance_3 ||head_metakw_relevance_1 >= head_metakw_relevance_4){
                   errors_head.push("Meta keywords relevance with site Check -> Boxes should have unequal, ascending values");
                }
                else if(head_metakw_relevance_2 >= head_metakw_relevance_3 || head_metakw_relevance_2 >= head_metakw_relevance_4 ){
                   errors_head.push("Meta keywords relevance with site Check -> Boxes should have unequal, ascending values");
                }
                else if(head_metakw_relevance_3 >= head_metakw_relevance_4 ){
                   errors_head.push("Meta keywords relevance with site Check -> Boxes should have unequal, ascending values");
                }
                 

            }
            
          }
          else{
            head_metakw_relevance_1 = false;
            head_metakw_relevance_2 = false;
            head_metakw_relevance_3 = false;
            head_metakw_relevance_4 = false;
          }

          //end of kw in metadesc rel

         if(head_metakw_label == true){
            if(isEmpty(head_metakw_label_c)){
              errors_head.push("If setted ON, Info and Tips box, can not be empty.");
            }
          }





        //
        // Meta Description
        //

        head_metadesc_show          = $('#head_metadesc_show').is(':checked');
        head_metadesc_lenght        = $('#head_metadesc_lenght').is(':checked');
        head_title_kw_in_metadesc   = $('#head_title_kw_in_metadesc').is(':checked');
        head_metadesc_relevance     = $('#head_metadesc_relevance').is(':checked');
        head_metadesc_label         = $('#head_metadesc_label').is(':checked');
        head_metadesc_label_content = $('#head_metadesc_label_content').val();




          //metadesc lenght

          
          if(head_metadesc_lenght == true){
            

            head_metadesc_lenght_1 = parseFloat($('#head_metadesc_lenght-1-l').val());
            head_metadesc_lenght_2 = parseFloat($('#head_metadesc_lenght-2-b').val());
            head_metadesc_lenght_3 = parseFloat($('#head_metadesc_lenght-2-l').val());
            head_metadesc_lenght_4 = parseFloat($('#head_metadesc_lenght-3-b').val());
            head_metadesc_lenght_5 = parseFloat($('#head_metadesc_lenght-3-l').val());
            head_metadesc_lenght_6 = parseFloat($('#head_metadesc_lenght-4-b').val());

            if(isEmpty(head_metadesc_lenght_1) || isEmpty(head_metadesc_lenght_2 ) || isEmpty(head_metadesc_lenght_3) || isEmpty(head_metadesc_lenght_4) ||  isEmpty(head_metadesc_lenght_5) || isEmpty(head_metadesc_lenght_6)){
              errors_head.push("Meta Description lenght Check -> None of the boxes can be empty");
            }
            else{
              if(head_metadesc_lenght_1 >= head_metadesc_lenght_2 || head_metadesc_lenght_1 >= head_metadesc_lenght_3 || head_metadesc_lenght_1 >= head_metadesc_lenght_4 || head_metadesc_lenght_1 >= head_metadesc_lenght_5 || head_metadesc_lenght_1 >= head_metadesc_lenght_6){
                 errors_head.push("Meta Description lenght Check -> Boxes should have unequal, ascending values");
              }
              else if(head_metadesc_lenght_2 >= head_metadesc_lenght_3 || head_metadesc_lenght_2 >= head_metadesc_lenght_4 || head_metadesc_lenght_2 >= head_metadesc_lenght_5 || head_metadesc_lenght_2 >= head_metadesc_lenght_6){
                 errors_head.push("Meta Description lenght Check -> Boxes should have unequal, ascending values");
              }
              else if(head_metadesc_lenght_3 >= head_metadesc_lenght_4 || head_metadesc_lenght_3 >= head_metadesc_lenght_5 || head_metadesc_lenght_3 >= head_metadesc_lenght_6){
                 errors_head.push("Meta Description lenght Check -> Boxes should have unequal, ascending values");
              }
               else if(head_metadesc_lenght_4 >= head_metadesc_lenght_5 || head_metadesc_lenght_4 >= head_metadesc_lenght_6){
                 errors_head.push("Meta Description lenght Check -> Boxes should have unequal, ascending values");
              }
               else if(head_metadesc_lenght_5 >= head_metadesc_lenght_6){
                 errors_head.push("Meta Description lenght Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            head_metadesc_lenght_1 = false;
            head_metadesc_lenght_2 = false;
            head_metadesc_lenght_3 = false;
            head_metadesc_lenght_4 = false;
            head_metadesc_lenght_5 = false;
            head_metadesc_lenght_6 = false;

          }

          //end of metadesc lenght

          //kw in metadesc rel

          if(head_metadesc_relevance == true){

            head_metadesc_relevance_1 = parseFloat($('#head_metadesc_relevance-1-l').val());
            head_metadesc_relevance_2 = parseFloat($('#head_metadesc_relevance-2-b').val());
            head_metadesc_relevance_3 = parseFloat($('#head_metadesc_relevance-2-l').val());
            head_metadesc_relevance_4 = parseFloat($('#head_metadesc_relevance-3-b').val());

            if(isEmpty(head_metadesc_relevance_1) || isEmpty(head_metadesc_relevance_2 ) || isEmpty(head_metadesc_relevance_3) || isEmpty(head_metadesc_relevance_4)){
              errors_head.push("Meta Description Relevance Check -> None of the boxes can be empty");
            }
            else{

                 if(head_metadesc_relevance_1 >= head_metadesc_relevance_2 || head_metadesc_relevance_1 >= head_metadesc_relevance_3 ||head_metadesc_relevance_1 >= head_metadesc_relevance_4){
                   errors_head.push("Meta Description Relevance Check -> Boxes should have unequal, ascending values");
                }
                else if(head_metadesc_relevance_2 >= head_metadesc_relevance_3 || head_metadesc_relevance_2 >= head_metadesc_relevance_4 ){
                   errors_head.push("Meta Description Relevance Check -> Boxes should have unequal, ascending values");
                }
                else if(head_metadesc_relevance_3 >= head_metadesc_relevance_4 ){
                   errors_head.push("Meta Description Relevance Check -> Boxes should have unequal, ascending values");
                }
                 

            }
            
          }
          else{
            head_metadesc_relevance_1 = false;
            head_metadesc_relevance_2 = false;
            head_metadesc_relevance_3 = false;
            head_metadesc_relevance_4 = false;
          }

          //end of kw in metadesc rel

         if(head_metadesc_label == true){
            if(isEmpty(head_metadesc_label_content)){
              errors_head.push("If setted ON, Info and Tips box, can not be empty.");
            }
          }




        /*

        Content TAB

        */

        errors_content = new Array();

        content_language          = $('#content_language').is(':checked');
        content_charcount         = $('#content_charcount').is(':checked');
        content_wordcount         = $('#content_wordcount').is(':checked');
        content_kwin              = $('#content_kwin').is(':checked');
        content_content_relevance = $('#content_content_relevance').is(':checked');
        content_kwinitalic        = $('#content_kwinitalic').is(':checked');
        content_kwinbold          = $('#content_kwinbold').is(':checked');
        content_headings          = $('#content_headings').is(':checked');
        content_iframes           = $('#content_iframes').is(':checked');
        content_label             = $('#content_label').is(':checked');
        content_label_c           = $('#content_label_content').val();

        // Characters count

        if(content_charcount == true){
            

            content_charcount_1 = parseFloat($('#content_charcount-1-l').val());
            content_charcount_2 = parseFloat($('#content_charcount-2-b').val());
            content_charcount_3 = parseFloat($('#content_charcount-2-l').val());
            content_charcount_4 = parseFloat($('#content_charcount-3-b').val());
            content_charcount_5 = parseFloat($('#content_charcount-3-l').val());
            content_charcount_6 = parseFloat($('#content_charcount-4-b').val());

            if(isEmpty(content_charcount_1) || isEmpty(content_charcount_2 ) || isEmpty(content_charcount_3) || isEmpty(content_charcount_4) ||  isEmpty(content_charcount_5) || isEmpty(content_charcount_6)){
              errors_content.push("Characters count Check -> None of the boxes can be empty");
            }
            else{
              if(content_charcount_1 >= content_charcount_2 || content_charcount_1 >= content_charcount_3 || content_charcount_1 >= content_charcount_4 || content_charcount_1 >= content_charcount_5 || content_charcount_1 >= content_charcount_6){
                 errors_content.push("Characters count Check -> Boxes should have unequal, ascending values");
              }
              else if(content_charcount_2 >= content_charcount_3 || content_charcount_2 >= content_charcount_4 || content_charcount_2 >= content_charcount_5 || content_charcount_2 >= content_charcount_6){
                 errors_content.push("Characters count Check -> Boxes should have unequal, ascending values");
              }
              else if(content_charcount_3 >= content_charcount_4 || content_charcount_3 >= content_charcount_5 || content_charcount_3 >= content_charcount_6){
                 errors_content.push("Characters count Check -> Boxes should have unequal, ascending values");
              }
               else if(content_charcount_4 >= content_charcount_5 || content_charcount_4 >= content_charcount_6){
                 errors_content.push("Meta Description lenght Check -> Boxes should have unequal, ascending values");
              }
               else if(content_charcount_5 >= content_charcount_6){
                 errors_content.push("Characters count Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            content_charcount_1 = false;
            content_charcount_2 = false;
            content_charcount_3 = false;
            content_charcount_4 = false;
            content_charcount_5 = false;
            content_charcount_6 = false;

          }

          // Words count


          if(content_wordcount == true){
            

            content_wordcount_1 = parseFloat($('#content_wordcount-1-l').val());
            content_wordcount_2 = parseFloat($('#content_wordcount-2-b').val());
            content_wordcount_3 = parseFloat($('#content_wordcount-2-l').val());
            content_wordcount_4 = parseFloat($('#content_wordcount-3-b').val());
            content_wordcount_5 = parseFloat($('#content_wordcount-3-l').val());
            content_wordcount_6 = parseFloat($('#content_wordcount-4-b').val());

            if(isEmpty(content_wordcount_1) || isEmpty(content_wordcount_2 ) || isEmpty(content_wordcount_3) || isEmpty(content_wordcount_4) ||  isEmpty(content_wordcount_5) || isEmpty(content_wordcount_6)){
              errors_content.push("Words count Check -> None of the boxes can be empty");
            }
            else{
              if(content_wordcount_1 >= content_wordcount_2 || content_wordcount_1 >= content_wordcount_3 || content_wordcount_1 >= content_wordcount_4 || content_wordcount_1 >= content_wordcount_5 || content_wordcount_1 >= content_wordcount_6){
                 errors_content.push("Words count Check -> Boxes should have unequal, ascending values");
              }
              else if(content_wordcount_2 >= content_wordcount_3 || content_wordcount_2 >= content_wordcount_4 || content_wordcount_2 >= content_wordcount_5 || content_wordcount_2 >= content_wordcount_6){
                 errors_content.push("Words count Check -> Boxes should have unequal, ascending values");
              }
              else if(content_wordcount_3 >= content_wordcount_4 || content_wordcount_3 >= content_wordcount_5 || content_wordcount_3 >= content_wordcount_6){
                 errors_content.push("Words count Check -> Boxes should have unequal, ascending values");
              }
               else if(content_wordcount_4 >= content_wordcount_5 || content_wordcount_4 >= content_wordcount_6){
                 errors_content.push("Words count Check -> Boxes should have unequal, ascending values");
              }
               else if(content_wordcount_5 >= content_wordcount_6){
                 errors_content.push("Words count Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            content_wordcount_1 = false;
            content_wordcount_2 = false;
            content_wordcount_3 = false;
            content_wordcount_4 = false;
            content_wordcount_5 = false;
            content_wordcount_6 = false;

          }

          //Relevance with keywords

          if(content_content_relevance == true){

            content_content_relevance_1 = parseFloat($('#content_content_relevance-1-l').val());
            content_content_relevance_2 = parseFloat($('#content_content_relevance-2-b').val());
            content_content_relevance_3 = parseFloat($('#content_content_relevance-2-l').val());
            content_content_relevance_4 = parseFloat($('#content_content_relevance-3-b').val());

            if(isEmpty(content_content_relevance_1) || isEmpty(content_content_relevance_2 ) || isEmpty(content_content_relevance_3) || isEmpty(content_content_relevance_4)){
              errors_content.push("Relevance with keywords Check -> None of the boxes can be empty");
            }
            else{

                 if(content_content_relevance_1 >= content_content_relevance_2 || content_content_relevance_1 >= content_content_relevance_3 ||content_content_relevance_1 >= content_content_relevance_4){
                   errors_content.push("Relevance with keywords Check -> Boxes should have unequal, ascending values");
                }
                else if(content_content_relevance_2 >= content_content_relevance_3 || content_content_relevance_2 >= content_content_relevance_4 ){
                   errors_content.push("Relevance with keywords Check -> Boxes should have unequal, ascending values");
                }
                else if(content_content_relevance_3 >= content_content_relevance_4 ){
                   errors_content.push("Relevance with keywords Check -> Boxes should have unequal, ascending values");
                }
                 

            }
            
          }
          else{
            content_content_relevance_1 = false;
            content_content_relevance_2 = false;
            content_content_relevance_3 = false;
            content_content_relevance_4 = false;
          }


         if(content_label == true){
            if(isEmpty(content_label_c)){
              errors_content.push("If setted ON, Info and Tips box, can not be empty.");
            }
          }


        /*

        URL Structure TAB
  
        */

        errors_url = new Array();

        url_display    = $('#url_display').is(':checked');
        url_kwin       = $('#url_kwin').is(':checked');
        url_lenght     = $('#url_lenght').is(':checked');
        url_subdomains = $('#url_subdomains').is(':checked');
        url_label      = $('#url_label').is(':checked');
        url_label_c    = $('#url_label_content').val();

        //Domain lenght

          if(url_lenght == true){
            

            url_lenght_1 = parseFloat($('#url_lenght-1-l').val());
            url_lenght_2 = parseFloat($('#url_lenght-2-b').val());
            url_lenght_3 = parseFloat($('#url_lenght-2-l').val());
            //url_lenght_4 = parseFloat($('#url_lenght-3-b').val());
            //url_lenght_5 = parseFloat($('#url_lenght-3-l').val());
            url_lenght_6 = parseFloat($('#url_lenght-4-b').val());

            if(isEmpty(url_lenght_1) || isEmpty(url_lenght_2 ) || isEmpty(url_lenght_3) || /*isEmpty(url_lenght_4) ||  isEmpty(url_lenght_5) ||*/ isEmpty(url_lenght_6)){
              errors_url.push("Domain length Check -> None of the boxes can be empty");
            }
            else{
              if(url_lenght_1 >= url_lenght_2 || url_lenght_1 >= url_lenght_3 || /*url_lenght_1 >= url_lenght_4 || url_lenght_1 >= url_lenght_5 ||*/ url_lenght_1 >= url_lenght_6){
                 errors_url.push("Domain length Check -> Boxes should have unequal, ascending values");
              }
              else if(url_lenght_2 >= url_lenght_3 ||/*url_lenght_2 >= url_lenght_4 || url_lenght_2 >= url_lenght_5 || */ url_lenght_2 >= url_lenght_6){
                 errors_url.push("Domain length Check -> Boxes should have unequal, ascending values");
              }
              /*else if(url_lenght_3 >= url_lenght_4 || url_lenght_3 >= url_lenght_5 || url_lenght_3 >= url_lenght_6){
                 errors_url.push("Domain length Check -> Boxes should have unequal, ascending values");
              }
               else if(url_lenght_4 >= url_lenght_5 || url_lenght_4 >= url_lenght_6){
                 errors_url.push("Domain length Check -> Boxes should have unequal, ascending values");
              }
               else if(url_lenght_5 >= url_lenght_6){
                 errors_url.push("Domain length Check -> Boxes should have unequal, ascending values");
              }*/

            }

          }
          else{

            url_lenght_1 = false;
            url_lenght_2 = false;
            url_lenght_3 = false;
            //url_lenght_4 = false;
            //url_lenght_5 = false;
            url_lenght_6 = false;

          }   


         if(url_label == true){
            if(isEmpty(url_label_c)){
              errors_url.push("If setted ON, Info and Tips box, can not be empty.");
            }
          }



        /*

        Links 

        */


        errors_links = new Array();

        links_ilinks    = $('#links_ilinks').is(':checked');
        links_elinks    = $('#links_elinks').is(':checked');
        links_label      = $('#links_label').is(':checked');
        links_label_c    = $('#links_label_content').val();

        //internal links count

          if(links_ilinks == true){
            

            links_ilinks_1 = parseFloat($('#links_ilinks-1-l').val());
            links_ilinks_2 = parseFloat($('#links_ilinks-2-b').val());
            links_ilinks_3 = parseFloat($('#links_ilinks-2-l').val());
            links_ilinks_4 = parseFloat($('#links_ilinks-3-b').val());
            links_ilinks_5 = parseFloat($('#links_ilinks-3-l').val());
            links_ilinks_6 = parseFloat($('#links_ilinks-4-b').val());

            if(isEmpty(links_ilinks_1) || isEmpty(links_ilinks_2 ) || isEmpty(links_ilinks_3) || isEmpty(links_ilinks_4) ||  isEmpty(links_ilinks_5) || isEmpty(links_ilinks_6)){
              errors_links.push("Internal links count Check -> None of the boxes can be empty");
            }
            else{
              if(links_ilinks_1 >= links_ilinks_2 || links_ilinks_1 >= links_ilinks_3 || links_ilinks_1 >= links_ilinks_4 || links_ilinks_1 >= links_ilinks_5 || links_ilinks_1 >= links_ilinks_6){
                 errors_links.push("Internal links count Check -> Boxes should have unequal, ascending values");
              }
              else if(links_ilinks_2 >= links_ilinks_3 || links_ilinks_2 >= links_ilinks_4 || links_ilinks_2 >= links_ilinks_5 || links_ilinks_2 >= links_ilinks_6){
                 errors_links.push("Internal links count Check -> Boxes should have unequal, ascending values");
              }
              else if(links_ilinks_3 >= links_ilinks_4 || links_ilinks_3 >= links_ilinks_5 || links_ilinks_3 >= links_ilinks_6){
                 errors_links.push("Internal links count Check -> Boxes should have unequal, ascending values");
              }
               else if(links_ilinks_4 >= links_ilinks_5 || links_ilinks_4 >= links_ilinks_6){
                 errors_links.push("Internal links count Check -> Boxes should have unequal, ascending values");
              }
               else if(links_ilinks_5 >= links_ilinks_6){
                 errors_links.push("Internal links count Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            links_ilinks_1 = false;
            links_ilinks_2 = false;
            links_ilinks_3 = false;
            links_ilinks_4 = false;
            links_ilinks_5 = false;
            links_ilinks_6 = false;

          }

          //external links count

         if(links_elinks == true){
            

            links_elinks_1 = parseFloat($('#links_elinks-1-l').val());
            links_elinks_2 = parseFloat($('#links_elinks-2-b').val());
            links_elinks_3 = parseFloat($('#links_elinks-2-l').val());
            links_elinks_4 = parseFloat($('#links_elinks-3-b').val());
            links_elinks_5 = parseFloat($('#links_elinks-3-l').val());
            links_elinks_6 = parseFloat($('#links_elinks-4-b').val());

            if(isEmpty(links_elinks_1) || isEmpty(links_elinks_2 ) || isEmpty(links_elinks_3) || isEmpty(links_elinks_4) ||  isEmpty(links_elinks_5) || isEmpty(links_elinks_6)){
              errors_links.push("External links count Check -> None of the boxes can be empty");
            }
            else{
              if(links_elinks_1 >= links_elinks_2 || links_elinks_1 >= links_elinks_3 || links_elinks_1 >= links_elinks_4 || links_elinks_1 >= links_elinks_5 || links_elinks_1 >= links_elinks_6){
                 errors_links.push("External links count Check -> Boxes should have unequal, ascending values");
              }
              else if(links_elinks_2 >= links_elinks_3 || links_elinks_2 >= links_elinks_4 || links_elinks_2 >= links_elinks_5 || links_elinks_2 >= links_elinks_6){
                 errors_links.push("External links count Check -> Boxes should have unequal, ascending values");
              }
              else if(links_elinks_3 >= links_elinks_4 || links_elinks_3 >= links_elinks_5 || links_elinks_3 >= links_elinks_6){
                 errors_links.push("External links count Check -> Boxes should have unequal, ascending values");
              }
               else if(links_elinks_4 >= links_elinks_5 || links_elinks_4 >= links_elinks_6){
                 errors_links.push("External links count Check -> Boxes should have unequal, ascending values");
              }
               else if(links_elinks_5 >= links_elinks_6){
                 errors_links.push("External links count Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            links_elinks_1 = false;
            links_elinks_2 = false;
            links_elinks_3 = false;
            links_elinks_4 = false;
            links_elinks_5 = false;
            links_elinks_6 = false;

          }


         if(links_label == true){
            if(isEmpty(links_label_c)){
              errors_links.push("If setted ON, Info and Tips box, can not be empty.");
            }
          }

        /*

        User Experience
  
        */


        errors_ux = new Array();

        ux_speed      = $('#ux_speed').is(':checked');
        ux_gram       = $('#ux_gram').is(':checked');
        ux_responsive = $('#ux_responsive').is(':checked');
        ux_feedback   = $('#ux_feedback').is(':checked');
        ux_label      = $('#ux_label').is(':checked');
        ux_label_c    = $('#ux_label_content').val();


        //speed 

         if(ux_speed == true){
            

            ux_speed_1 = parseFloat($('#ux_speed-1-l').val());
            ux_speed_2 = parseFloat($('#ux_speed-2-b').val());
            ux_speed_3 = parseFloat($('#ux_speed-2-l').val());
            ux_speed_4 = parseFloat($('#ux_speed-3-b').val());
            ux_speed_5 = parseFloat($('#ux_speed-3-l').val());
            //ux_speed_6 = parseFloat($('#ux_speed-4-b').val());

            if(isEmpty(ux_speed_1) || isEmpty(ux_speed_2 ) || isEmpty(ux_speed_3) || isEmpty(ux_speed_4) ||  isEmpty(ux_speed_5)){
              errors_ux.push("Page Speed Check -> None of the boxes can be empty");
            }
            else{
              if(ux_speed_1 >= ux_speed_2 || ux_speed_1 >= ux_speed_3 || ux_speed_1 >= ux_speed_4 || ux_speed_1 >= ux_speed_5){
                 errors_ux.push("Page Speed Check -> Boxes should have unequal, ascending values");
              }
              else if(ux_speed_2 >= ux_speed_3 || ux_speed_2 >= ux_speed_4 || ux_speed_2 >= ux_speed_5){
                 errors_ux.push("Page Speed Check -> Boxes should have unequal, ascending values");
              }
              else if(ux_speed_3 >= ux_speed_4 || ux_speed_3 >= ux_speed_5){
                 errors_ux.push("Page Speed Check -> Boxes should have unequal, ascending values");
              }
               else if(ux_speed_4 >= ux_speed_5){
                 errors_ux.push("Page Speed Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            ux_speed_1 = false;
            ux_speed_2 = false;
            ux_speed_3 = false;
            ux_speed_4 = false;
            ux_speed_5 = false;

          }

          //grammar mistakes

         if(ux_gram == true){
            

            ux_gram_1 = parseFloat($('#ux_gram-1-l').val());
            //ux_gram_2 = parseFloat($('#ux_gram-2-b').val());
            //ux_gram_3 = parseFloat($('#ux_gram-2-l').val());
            ux_gram_4 = parseFloat($('#ux_gram-3-b').val());
            ux_gram_5 = parseFloat($('#ux_gram-3-l').val());
            ux_gram_6 = parseFloat($('#ux_gram-4-b').val());

            if(isEmpty(ux_gram_1) || isEmpty(ux_gram_4) ||  isEmpty(ux_gram_5) || isEmpty(ux_gram_6)){
              errors_ux.push("Grammar mistakes Check -> None of the boxes can be empty");
            }
            else{
              if(ux_gram_1 >= ux_gram_4 || ux_gram_1 >= ux_gram_5 || ux_gram_1 >= ux_gram_6){
                 errors_ux.push("Grammar mistakes Check -> Boxes should have unequal, ascending values");
              }
               else if(ux_gram_4 >= ux_gram_5 || ux_gram_4 >= ux_gram_6){
                 errors_ux.push("Grammar mistakes Check -> Boxes should have unequal, ascending values");
              }
               else if(ux_gram_5 >= ux_gram_6){
                 errors_ux.push("Grammar mistakes Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            ux_gram_1 = false;
            ux_gram_4 = false;
            ux_gram_5 = false;
            ux_gram_6 = false;

          }

         if(ux_label == true){
            if(isEmpty(ux_label_c)){
              errors_ux.push("If setted ON, Info and Tips box, can not be empty.");
            }
          }

        //end of verifications

        //clearing all the previous errors

        $('#eb_general').html('');
        $('#eb_crawling').html('');
        $('#eb_head').html('');
        $('#eb_content').html('');
        $('#eb_url').html('');
        $('#eb_links').html('');
        $('#eb_ux').html('');
        $('#main_msgbox').html('');
 

        // Debbugging pourpouse
        //console.log('-----Errors----');

        if( errors_general.length > 0 || errors_crawling.length > 0 || errors_head.length > 0 || errors_content.length > 0 || errors_url.length > 0 || errors_links.length > 0 || errors_ux.length > 0){
            $('#main_msgbox').html('<div class="alert alert-dismissable alert-danger">\
                <strong>Error(s) occured in the following tab(s):</strong> <i><span id="errtabs"></span></i>\
                .Please correct the error(s) and then try again.</div>')
        }

        errtabs = new Array();

        if(errors_general.length > 0){   
            
           // Debbugging pourpouse 
           // console.log('General: ' + errors_general);
           errtabs.push('General');
           $('#btn_1').css( "color", "red" );

           for (err = 0; err < errors_general.length; ++err) {
              $('#eb_general').html($('#eb_general').html() + errgen('Error:',errors_general[err]));
          }

        }else{

          // Debbugging pourpouse
          // console.log('No errors occured in the General tab');
          $('#btn_1').css( "color", "green" );

        }

        if(errors_crawling.length > 0){   
           
           // Debbugging pourpouse 
           // console.log('Crawling: ' + errors_crawling);
           errtabs.push('Crawling');
           $('#btn_2').css( "color", "red" );

          for (err = 0; err < errors_crawling.length; ++err) {
              $('#eb_crawling').html($('#eb_crawling').html() + errgen('Error:',errors_crawling[err]));
          }

        }else{

          // Debbugging pourpouse
          // console.log('No errors occured in the Crawling tab');
          $('#btn_2').css( "color", "green" );


        }

        if(errors_head.length > 0){  

           // Debbugging pourpouse 
           // console.log('Head: ' + errors_head);
           errtabs.push('Head Elements');
           $('#btn_3').css( "color", "red" );


          for (err = 0; err < errors_head.length; ++err) {

            if(strpos(errors_head[err],'->')){
              error = errors_head[err].split('->');
              $('#eb_head').html($('#eb_head').html() + errgen(error[0] + ' -> ' ,error[1]));
            }
            else{
              $('#eb_head').html($('#eb_head').html() + errgen('Error:',errors_head[err]));
            }

          }

        }else{

          // Debbugging pourpouse
          // console.log('No errors occured in the Head tab');
          $('#btn_3').css( "color", "green" );


        }

        if(errors_content.length > 0){   
           
           // Debbugging pourpouse
           // console.log('Content: ' + errors_content);
           errtabs.push('Content');
           $('#btn_4').css( "color", "red" );

          for (err = 0; err < errors_content.length; ++err) {

            if(strpos(errors_content[err],'->')){
              error = errors_content[err].split('->');
              $('#eb_content').html($('#eb_content').html() + errgen(error[0] + ' -> ' ,error[1]));
            }
            else{
              $('#eb_content').html($('#eb_content').html() + errgen('Error:',errors_content[err]));
            }

          }

        }else{
          
          // Debbugging pourpouse
          // console.log('No errors occured in the Content tab');
          $('#btn_4').css( "color", "green" );

        }

        if(errors_url.length > 0){   
           
           // Debbugging pourpouse
           // console.log('URL: ' + errors_url);
           errtabs.push('URL Structure');
           $('#btn_5').css( "color", "red" );

          for (err = 0; err < errors_url.length; ++err) {

            if(strpos(errors_url[err],'->')){
              error = errors_url[err].split('->');
              $('#eb_url').html($('#eb_url').html() + errgen(error[0] + ' -> ' ,error[1]));
            }
            else{
              $('#eb_url').html($('#eb_url').html() + errgen('Error:',errors_url[err]));
            }

          }

        }else{

          // Debbugging pourpouse
          // console.log('No errors occured in the URL Strucutre tab');
          $('#btn_5').css( "color", "green" );

        } 

        if(errors_links.length > 0){   
           
           // Debbugging pourpouse
           // console.log('Links: ' + errors_links);
           errtabs.push('Links');
           $('#btn_6').css( "color", "red" );

          for (err = 0; err < errors_links.length; ++err) {

            if(strpos(errors_links[err],'->')){
              error = errors_links[err].split('->');
              $('#eb_links').html($('#eb_links').html() + errgen(error[0] + ' -> ' ,error[1]));
            }
            else{
              $('#eb_links').html($('#eb_links').html() + errgen('Error:',errors_links[err]));
            }

          }

        }else{

          // Debbugging pourpouse
          // console.log('No errors occured in the Links tab');
          $('#btn_6').css( "color", "green" );

        } 

        if(errors_ux.length > 0){   
           
           // Debbugging pourpouse
           // console.log('User Experience: ' + errors_ux);
           errtabs.push('User Experience');
           $('#btn_7').css( "color", "red" );

          for (err = 0; err < errors_ux.length; ++err) {

            if(strpos(errors_ux[err],'->')){
              error = errors_ux[err].split('->');
              $('#eb_ux').html($('#eb_links').html() + errgen(error[0] + ' -> ' ,error[1]));
            }
            else{
              $('#eb_ux').html($('#eb_ux').html() + errgen('Error:',errors_ux[err]));
            }

          }

        }else{

          // Debbugging pourpouse
          // console.log('No errors occured in the UX tab');
          $('#btn_7').css( "color", "green" );

        } 

        if(errtabs.length > 0){  
          $('#errtabs').html(errtabs.join());
          // Debbugging pourpouse
          // console.log('failure');
        }
        else{
           $('#main_msgbox').html('<div class="alert alert-dismissable alert-success">\
                <strong>Success:</strong> Your SEO Profile has been saved. Now you can run it trough the main page (if you made it public).\
                </div>')

           $('#zabtn').attr('disabled', 'disabled').html("Loading...");

           $.post("php/xmlreq.php", {
           //request data
           q: "a",
           //general data
           g_barvalue: bar_val,
           g_name: info_name,
           g_descr: info_descr,
           g_ispb: info_ispb,
           //crawling
           c_http: crawling_http,
           c_robots: crawling_robots,
           c_sitemap: crawling_sitemap,
           c_label: crawling_label,
           c_label_c: crawling_label_c,
           //head: title
           h_t_show: head_title_show,
           h_t_length: head_title_lenght,
           h_t_length_d: new Array(head_title_lenght_1, head_title_lenght_2,head_title_lenght_3,head_title_lenght_4,head_title_lenght_5,head_title_lenght_6),
           h_t_length_c: new Array(c_head_title_lenght_1,c_head_title_lenght_2,c_head_title_lenght_3,c_head_title_lenght_4),
           h_t_stopwords: head_title_stop_words,
           h_t_kwin: head_title_kw_in_title,
           h_t_rel: head_title_relevance,
           h_t_rel_d: new Array(head_title_relevance_1,head_title_relevance_2,head_title_relevance_3,head_title_relevance_4),
           h_t_rel_c: new Array(c_head_title_relevance_1,c_head_title_relevance_2,c_head_title_relevance_3),
           h_t_label: head_title_label,
           h_t_label_c: head_title_label_content,
           //head:meta kw
           h_k_show: head_metakw_show,
           h_k_count: head_metakw_count,
           h_k_count_d: new Array(head_metakw_count_1, head_metakw_count_2,head_metakw_count_3,head_metakw_count_4,head_metakw_count_5,head_metakw_count_6),
           h_k_count_c: new Array(c_head_metakw_count_1,c_head_metakw_count_2,c_head_metakw_count_3,c_head_metakw_count_4),
           h_k_rel: head_metakw_relevance,
           h__k_rel_d: new Array(head_metakw_relevance_1,head_metakw_relevance_2,head_metakw_relevance_3,head_metakw_relevance_4),
           h__k_rel_c: new Array(c_head_metakw_relevance_1,c_head_metakw_relevance_2,c_head_metakw_relevance_3),
           h_k_label: head_metakw_label,
           h_k_label_c: head_metakw_label_c,
           //head:meta desc
           h_d_show: head_metadesc_show,
           h_d_length: head_metadesc_lenght,
           h_d_length_d: new Array(head_metadesc_lenght_1, head_metadesc_lenght_2,head_metadesc_lenght_3,head_metadesc_lenght_4,head_metadesc_lenght_5,head_metadesc_lenght_6),
           h_d_length_c: new Array(c_head_metadesc_lenght_1, c_head_metadesc_lenght_2,c_head_metadesc_lenght_3,c_head_metadesc_lenght_4),
           h_d_kwin: head_title_kw_in_metadesc,
           h_d_rel: head_metadesc_relevance,
           h_d_rel_d: new Array(head_metadesc_relevance_1,head_metadesc_relevance_2,head_metadesc_relevance_3,head_metadesc_relevance_4),
           h_d_rel_c: new Array(c_head_metadesc_relevance_1,c_head_metadesc_relevance_2,c_head_metadesc_relevance_3),
           h_d_label: head_metadesc_label,
           h_d_label_c: head_metadesc_label_content,
           //content
           ct_lang: content_language,
           ct_chars: content_charcount,
           ct_chars_d: new Array(content_charcount_1, content_charcount_2,content_charcount_3,content_charcount_4,content_charcount_5,content_charcount_6),
           ct_chars_c: new Array(c_content_charcount_1,c_content_charcount_2,c_content_charcount_3,c_content_charcount_4),
           ct_words: content_wordcount,
           ct_words_d: new Array(content_wordcount_1, content_wordcount_2,content_wordcount_3,content_wordcount_4,content_wordcount_5,content_wordcount_6),
           ct_words_c: new Array(c_content_wordcount_1, c_content_wordcount_2,c_content_wordcount_3,c_content_wordcount_4),
           ct_kwin: content_kwin,
           ct_rel: content_content_relevance,
           ct_rel_d: new Array(content_content_relevance_1,content_content_relevance_2,content_content_relevance_3,content_content_relevance_4),
           ct_rel_c: new Array(c_content_content_relevance_1,c_content_content_relevance_2,c_content_content_relevance_3),
           ct_kwini: content_kwinitalic,
           ct_kwinb: content_kwinbold,
           ct_headings: content_headings,
           ct_iframes: content_iframes,
           ct_label: content_label,
           ct_label_c: content_label_c,
           //url structure
           ul_show: url_display,
           ul_kwin: url_kwin,
           ul_length: url_lenght,
           ul_length_d: new Array(url_lenght_1, url_lenght_2,url_lenght_3,/*url_lenght_4,url_lenght_5,*/url_lenght_6),
           ul_length_c: new Array(c_url_lenght_1, c_url_lenght_2,/*c_url_lenght_3*/c_url_lenght_4),
           ul_sub: url_subdomains,
           ul_label: url_label,
           ul_label_c: url_label_c,
           //links
           l_ilinks: links_ilinks,
           l_ilinks_d: new Array(links_ilinks_1, links_ilinks_2,links_ilinks_3,links_ilinks_4,links_ilinks_5,links_ilinks_6),
           l_ilinks_c: new Array(c_links_ilinks_1, c_links_ilinks_2,c_links_ilinks_3,c_links_ilinks_4),
           l_elinks: links_elinks,
           l_elinks_d: new Array(links_elinks_1, links_elinks_2,links_elinks_3,links_elinks_4,links_elinks_5,links_elinks_6),
           l_elinks_c: new Array(c_links_elinks_1, c_links_elinks_2,c_links_elinks_3,c_links_elinks_4),
           l_label: links_label,
           l_label_c: links_label_c,
           //user experience
           u_speed: ux_speed,
           u_speed_d: new Array(ux_speed_1, ux_speed_2,ux_speed_3,ux_speed_4,ux_speed_5),
           u_speed_c: new Array(c_ux_speed_1, c_ux_speed_2,c_ux_speed_3),
           u_gram: ux_gram,
           u_gram_d: new Array(ux_gram_1, ux_gram_4,ux_gram_5,ux_gram_6),
           u_gram_c: new Array(c_ux_gram_1, c_ux_gram_3,c_ux_gram_4),
           u_res: ux_responsive,
           u_fb: ux_feedback,
           u_label: ux_label,
           u_label_c: ux_label_c
           })
           .done(function(data) {
                 //alert(data);
                 $('#zabtn').removeAttr('disabled').html('Add the profile')
           });

        }


        /*

         Debugging pourpouse 


        console.log('-----Data----');


        console.log('General: '  + info_name, info_descr, info_ispb);
        console.log('Crawling: ' + crawling_http,crawling_robots,crawling_sitemap,crawling_label,crawling_label_c);

        console.log("\r");
        console.log('Head:');
        console.log("\r");

        console.log('Title relevance  -> ' +head_title_relevance_1,head_title_relevance_2,head_title_relevance_3,head_title_relevance_4);
        console.log('Title lenght -> ' +head_title_lenght_1, head_title_lenght_2,head_title_lenght_3,head_title_lenght_4,head_title_lenght_5,head_title_lenght_6);
        console.log('Title other -> ' + head_title_show,head_title_lenght,head_title_stop_words,head_title_kw_in_title,head_title_relevance,head_title_label,head_title_label_content);
        console.log("\r");

        console.log('Metadesc relevance  -> ' +head_metadesc_relevance_1,head_metadesc_relevance_2,head_metadesc_relevance_3,head_metadesc_relevance_4);
        console.log('Metadesc lenght -> '    +head_metadesc_lenght_1, head_metadesc_lenght_2,head_metadesc_lenght_3,head_metadesc_lenght_4,head_metadesc_lenght_5,head_metadesc_lenght_6);
        console.log('Metadesc other -> '    + head_metadesc_show,head_title_kw_in_metadesc,head_metadesc_label,head_metadesc_label_content);
        console.log("\r");

        console.log('MetaKw relevance  -> ' +head_metakw_relevance_1,head_metakw_relevance_2,head_metakw_relevance_3,head_metakw_relevance_4);
        console.log('MetaKw lenght -> '    +head_metakw_count_1, head_metakw_count_2,head_metakw_count_3,head_metakw_count_4,head_metakw_count_5,head_metakw_count_6);
        console.log('MetaKw lenght -> '    + head_metakw_show,head_metakw_count,head_metakw_relevance,head_metakw_label,head_metakw_label_c);

        console.log("\r");
        console.log('Content:');
        console.log("\r");

        console.log('Characters  -> ' + content_charcount_1, content_charcount_2,content_charcount_3,content_charcount_4,content_charcount_5,content_charcount_6);
        console.log('Words       -> ' + content_wordcount_1, content_wordcount_2,content_wordcount_3,content_wordcount_4,content_wordcount_5,content_wordcount_6);
        console.log('Relevance -> '   + content_content_relevance_1,content_content_relevance_2,content_content_relevance_3,content_content_relevance_4);
        console.log('Others -> '      + content_language,content_kwin, content_kwinitalic,content_kwinbold,content_headings,content_iframes,content_label,content_label_c);

        console.log("\r");
        console.log('Url Structure:');
        console.log("\r");              

        console.log('Domain length  -> ' + url_lenght_1, url_lenght_2,url_lenght_3,url_lenght_4,url_lenght_5,url_lenght_6);
        console.log('Others -> '      + url_display,url_kwin,url_subdomains,url_label,url_label,url_label_c);

        console.log("\r");
        console.log('Links:');
        console.log("\r");  

        console.log('Internal links  -> ' + links_ilinks_1, links_ilinks_2,links_ilinks_3,links_ilinks_4,links_ilinks_5,links_ilinks_6);
        console.log('External links  -> ' + links_elinks_1, links_elinks_2,links_elinks_3,links_elinks_4,links_elinks_5,links_elinks_6);
        console.log('Others -> '      + links_label,links_label_c);

        console.log("\r");
        console.log('User Experience:');
        console.log("\r");  
      
        console.log('Ux Speed  -> ' + ux_speed_1, ux_speed_2,ux_speed_3,ux_speed_4,ux_speed_5,ux_speed_6);
        console.log('Ux GM  -> ' + ux_gram_1, ux_gram_2,ux_gram_3,ux_gram_4,ux_gram_5,ux_gram_6);
        console.log('Others -> '      + ux_label,ux_label_c,ux_responsive,ux_feedback);


        */

      }


    /* Another huge function for form submiting */

    function editprofile(fn){

        /*

         General TAB

        */

        info_name  = $('#info_name').val();
        info_descr = $('#info_descr').val();
        info_ispb  = $('#info_ip').val();


        var errors_general = new Array(); 
        if(isEmpty(info_name) || isEmpty(info_descr)){
            errors_general.push("Please fill all the fields");
        }




        /*

         Crawling TAB

        */

        crawling_http    = $('#crawling_http').is(':checked');
        crawling_robots  = $('#crawling_robots').is(':checked');
        crawling_sitemap = $('#crawling_sitemap').is(':checked');
        crawling_label   = $('#crawling_label').is(':checked');
        crawling_label_c = $('#crawling_label_content').val();


        var errors_crawling = new Array();
        if(crawling_label == true){
          if(isEmpty(crawling_label_c)){
            errors_crawling.push("If setted ON, Info and Tips box, can not be empty.");
          }
        }

        


        /* 

        Head TAB

        */

        //
        // Title 
        //

        var errors_head = new Array(); 

        head_title_show          = $('#head_title_show').is(':checked');
        head_title_lenght        = $('#head_title_lenght').is(':checked');
        head_title_stop_words    = $('#head_title_stop_words').is(':checked');
        head_title_kw_in_title   = $('#head_title_kw_in_title').is(':checked');
        head_title_relevance     = $('#head_title_relevance').is(':checked');
        head_title_label         = $('#head_title_label').is(':checked');
        head_title_label_content = $('#head_title_label_content').val();



          //title lenght

          
          if(head_title_lenght == true){
            

            head_title_lenght_1 = parseFloat($('#head_title_lenght-1-l').val());
            head_title_lenght_2 = parseFloat($('#head_title_lenght-2-b').val());
            head_title_lenght_3 = parseFloat($('#head_title_lenght-2-l').val());
            head_title_lenght_4 = parseFloat($('#head_title_lenght-3-b').val());
            head_title_lenght_5 = parseFloat($('#head_title_lenght-3-l').val());
            head_title_lenght_6 = parseFloat($('#head_title_lenght-4-b').val());

            if(isEmpty(head_title_lenght_1) || isEmpty(head_title_lenght_2 ) || isEmpty(head_title_lenght_3) || isEmpty(head_title_lenght_4) ||  isEmpty(head_title_lenght_5) || isEmpty(head_title_lenght_6)){
              errors_head.push("Title lenght Check -> None of the boxes can be empty");
            }
            else{
              if(head_title_lenght_1 >= head_title_lenght_2 || head_title_lenght_1 >= head_title_lenght_3 || head_title_lenght_1 >= head_title_lenght_4 || head_title_lenght_1 >= head_title_lenght_5 || head_title_lenght_1 >= head_title_lenght_6){
                 errors_head.push("Title lenght Check -> Boxes should have unequal, ascending values");
              }
              else if(head_title_lenght_2 >= head_title_lenght_3 || head_title_lenght_2 >= head_title_lenght_4 || head_title_lenght_2 >= head_title_lenght_5 || head_title_lenght_2 >= head_title_lenght_6){
                 errors_head.push("Title lenght Check -> Boxes should have unequal, ascending values");
              }
              else if(head_title_lenght_3 >= head_title_lenght_4 || head_title_lenght_3 >= head_title_lenght_5 || head_title_lenght_3 >= head_title_lenght_6){
                 errors_head.push("Title lenght Check -> Boxes should have unequal, ascending values");
              }
               else if(head_title_lenght_4 >= head_title_lenght_5 || head_title_lenght_4 >= head_title_lenght_6){
                 errors_head.push("Title lenght Check -> Boxes should have unequal, ascending values");
              }
               else if(head_title_lenght_5 >= head_title_lenght_6){
                 errors_head.push("Title lenght Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            head_title_lenght_1 = false;
            head_title_lenght_2 = false;
            head_title_lenght_3 = false;
            head_title_lenght_4 = false;
            head_title_lenght_5 = false;
            head_title_lenght_6 = false;

          }

          //end of title lenght

          //kw in title rel

          if(head_title_relevance == true){

            head_title_relevance_1 = parseFloat($('#head_title_relevance-1-l').val());
            head_title_relevance_2 = parseFloat($('#head_title_relevance-2-b').val());
            head_title_relevance_3 = parseFloat($('#head_title_relevance-2-l').val());
            head_title_relevance_4 = parseFloat($('#head_title_relevance-3-b').val());

            if(isEmpty(head_title_relevance_1) || isEmpty(head_title_relevance_2 ) || isEmpty(head_title_relevance_3) || isEmpty(head_title_relevance_4)){
              errors_head.push("Title Relevance Check -> None of the boxes can be empty");
            }
            else{

                 if(head_title_relevance_1 >= head_title_relevance_2 || head_title_relevance_1 >= head_title_relevance_3 ||head_title_relevance_1 >= head_title_relevance_4){
                   errors_head.push("Title Relevance Check -> Boxes should have unequal, ascending values");
                }
                else if(head_title_relevance_2 >= head_title_relevance_3 || head_title_relevance_2 >= head_title_relevance_4 ){
                   errors_head.push("Title Relevance Check -> Boxes should have unequal, ascending values");
                }
                else if(head_title_relevance_3 >= head_title_relevance_4 ){
                   errors_head.push("Title Relevance Check -> Boxes should have unequal, ascending values");
                }
                 

            }
            
          }
          else{
            head_title_relevance_1 = false;
            head_title_relevance_2 = false;
            head_title_relevance_3 = false;
            head_title_relevance_4 = false;
          }

          //end of kw in title rel

         if(head_title_label == true){
            if(isEmpty(head_title_label_content)){
              errors_head.push("If setted ON, Info and Tips box, can not be empty.");
            }
          }



        //
        //Meta keywords
        //

        head_metakw_show        = $('#head_metakw_show').is(':checked');
        head_metakw_count       = $('#head_metakw_count').is(':checked');
        head_metakw_relevance   = $('#head_metakw_relevance').is(':checked');
        head_metakw_label       = $('#head_metakw_label').is(':checked');
        head_metakw_label_c     = $('#head_metakw_label_content').val();





          //meta kw count

          
          if(head_metakw_count == true){
            

            head_metakw_count_1 = parseFloat($('#head_metakw_count-1-l').val());
            head_metakw_count_2 = parseFloat($('#head_metakw_count-2-b').val());
            head_metakw_count_3 = parseFloat($('#head_metakw_count-2-l').val());
            head_metakw_count_4 = parseFloat($('#head_metakw_count-3-b').val());
            head_metakw_count_5 = parseFloat($('#head_metakw_count-3-l').val());
            head_metakw_count_6 = parseFloat($('#head_metakw_count-4-b').val());

            if(isEmpty(head_metakw_count_1) || isEmpty(head_metakw_count_2 ) || isEmpty(head_metakw_count_3) || isEmpty(head_metakw_count_4) ||  isEmpty(head_metakw_count_5) || isEmpty(head_metakw_count_6)){
              errors_head.push("Meta keywords count Check -> None of the boxes can be empty");
            }
            else{
              if(head_metakw_count_1 >= head_metakw_count_2 || head_metakw_count_1 >= head_metakw_count_3 || head_metakw_count_1 >= head_metakw_count_4 || head_metakw_count_1 >= head_metakw_count_5 || head_metakw_count_1 >= head_metakw_count_6){
                 errors_head.push("Meta keywords count Check -> Boxes should have unequal, ascending values");
              }
              else if(head_metakw_count_2 >= head_metakw_count_3 || head_metakw_count_2 >= head_metakw_count_4 || head_metakw_count_2 >= head_metakw_count_5 || head_metakw_count_2 >= head_metakw_count_6){
                 errors_head.push("Meta keywords count Check -> Boxes should have unequal, ascending values");
              }
              else if(head_metakw_count_3 >= head_metakw_count_4 || head_metakw_count_3 >= head_metakw_count_5 || head_metakw_count_3 >= head_metakw_count_6){
                 errors_head.push("Meta keywords count Check -> Boxes should have unequal, ascending values");
              }
               else if(head_metakw_count_4 >= head_metakw_count_5 || head_metakw_count_4 >= head_metakw_count_6){
                 errors_head.push("Meta keywords count Check -> Boxes should have unequal, ascending values");
              }
               else if(head_metakw_count_5 >= head_metakw_count_6){
                 errors_head.push("Meta keywords count Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            head_metakw_count_1 = false;
            head_metakw_count_2 = false;
            head_metakw_count_3 = false;
            head_metakw_count_4 = false;
            head_metakw_count_5 = false;
            head_metakw_count_6 = false;

          }

          //end of meta kw count

          //kw rel with site

          if(head_metakw_relevance == true){

            head_metakw_relevance_1 = parseFloat($('#head_metakw_relevance-1-l').val());
            head_metakw_relevance_2 = parseFloat($('#head_metakw_relevance-2-b').val());
            head_metakw_relevance_3 = parseFloat($('#head_metakw_relevance-2-l').val());
            head_metakw_relevance_4 = parseFloat($('#head_metakw_relevance-3-b').val());

            if(isEmpty(head_metakw_relevance_1) || isEmpty(head_metakw_relevance_2 ) || isEmpty(head_metakw_relevance_3) || isEmpty(head_metakw_relevance_4)){
              errors_head.push("Meta keywords relevance with site Check -> None of the boxes can be empty");
            }
            else{

                 if(head_metakw_relevance_1 >= head_metakw_relevance_2 || head_metakw_relevance_1 >= head_metakw_relevance_3 ||head_metakw_relevance_1 >= head_metakw_relevance_4){
                   errors_head.push("Meta keywords relevance with site Check -> Boxes should have unequal, ascending values");
                }
                else if(head_metakw_relevance_2 >= head_metakw_relevance_3 || head_metakw_relevance_2 >= head_metakw_relevance_4 ){
                   errors_head.push("Meta keywords relevance with site Check -> Boxes should have unequal, ascending values");
                }
                else if(head_metakw_relevance_3 >= head_metakw_relevance_4 ){
                   errors_head.push("Meta keywords relevance with site Check -> Boxes should have unequal, ascending values");
                }
                 

            }
            
          }
          else{
            head_metakw_relevance_1 = false;
            head_metakw_relevance_2 = false;
            head_metakw_relevance_3 = false;
            head_metakw_relevance_4 = false;
          }

          //end of kw in metadesc rel

         if(head_metakw_label == true){
            if(isEmpty(head_metakw_label_c)){
              errors_head.push("If setted ON, Info and Tips box, can not be empty.");
            }
          }





        //
        // Meta Description
        //

        head_metadesc_show          = $('#head_metadesc_show').is(':checked');
        head_metadesc_lenght        = $('#head_metadesc_lenght').is(':checked');
        head_title_kw_in_metadesc   = $('#head_title_kw_in_metadesc').is(':checked');
        head_metadesc_relevance     = $('#head_metadesc_relevance').is(':checked');
        head_metadesc_label         = $('#head_metadesc_label').is(':checked');
        head_metadesc_label_content = $('#head_metadesc_label_content').val();




          //metadesc lenght

          
          if(head_metadesc_lenght == true){
            

            head_metadesc_lenght_1 = parseFloat($('#head_metadesc_lenght-1-l').val());
            head_metadesc_lenght_2 = parseFloat($('#head_metadesc_lenght-2-b').val());
            head_metadesc_lenght_3 = parseFloat($('#head_metadesc_lenght-2-l').val());
            head_metadesc_lenght_4 = parseFloat($('#head_metadesc_lenght-3-b').val());
            head_metadesc_lenght_5 = parseFloat($('#head_metadesc_lenght-3-l').val());
            head_metadesc_lenght_6 = parseFloat($('#head_metadesc_lenght-4-b').val());

            if(isEmpty(head_metadesc_lenght_1) || isEmpty(head_metadesc_lenght_2 ) || isEmpty(head_metadesc_lenght_3) || isEmpty(head_metadesc_lenght_4) ||  isEmpty(head_metadesc_lenght_5) || isEmpty(head_metadesc_lenght_6)){
              errors_head.push("Meta Description lenght Check -> None of the boxes can be empty");
            }
            else{
              if(head_metadesc_lenght_1 >= head_metadesc_lenght_2 || head_metadesc_lenght_1 >= head_metadesc_lenght_3 || head_metadesc_lenght_1 >= head_metadesc_lenght_4 || head_metadesc_lenght_1 >= head_metadesc_lenght_5 || head_metadesc_lenght_1 >= head_metadesc_lenght_6){
                 errors_head.push("Meta Description lenght Check -> Boxes should have unequal, ascending values");
              }
              else if(head_metadesc_lenght_2 >= head_metadesc_lenght_3 || head_metadesc_lenght_2 >= head_metadesc_lenght_4 || head_metadesc_lenght_2 >= head_metadesc_lenght_5 || head_metadesc_lenght_2 >= head_metadesc_lenght_6){
                 errors_head.push("Meta Description lenght Check -> Boxes should have unequal, ascending values");
              }
              else if(head_metadesc_lenght_3 >= head_metadesc_lenght_4 || head_metadesc_lenght_3 >= head_metadesc_lenght_5 || head_metadesc_lenght_3 >= head_metadesc_lenght_6){
                 errors_head.push("Meta Description lenght Check -> Boxes should have unequal, ascending values");
              }
               else if(head_metadesc_lenght_4 >= head_metadesc_lenght_5 || head_metadesc_lenght_4 >= head_metadesc_lenght_6){
                 errors_head.push("Meta Description lenght Check -> Boxes should have unequal, ascending values");
              }
               else if(head_metadesc_lenght_5 >= head_metadesc_lenght_6){
                 errors_head.push("Meta Description lenght Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            head_metadesc_lenght_1 = false;
            head_metadesc_lenght_2 = false;
            head_metadesc_lenght_3 = false;
            head_metadesc_lenght_4 = false;
            head_metadesc_lenght_5 = false;
            head_metadesc_lenght_6 = false;

          }

          //end of metadesc lenght

          //kw in metadesc rel

          if(head_metadesc_relevance == true){

            head_metadesc_relevance_1 = parseFloat($('#head_metadesc_relevance-1-l').val());
            head_metadesc_relevance_2 = parseFloat($('#head_metadesc_relevance-2-b').val());
            head_metadesc_relevance_3 = parseFloat($('#head_metadesc_relevance-2-l').val());
            head_metadesc_relevance_4 = parseFloat($('#head_metadesc_relevance-3-b').val());

            if(isEmpty(head_metadesc_relevance_1) || isEmpty(head_metadesc_relevance_2 ) || isEmpty(head_metadesc_relevance_3) || isEmpty(head_metadesc_relevance_4)){
              errors_head.push("Meta Description Relevance Check -> None of the boxes can be empty");
            }
            else{

                 if(head_metadesc_relevance_1 >= head_metadesc_relevance_2 || head_metadesc_relevance_1 >= head_metadesc_relevance_3 ||head_metadesc_relevance_1 >= head_metadesc_relevance_4){
                   errors_head.push("Meta Description Relevance Check -> Boxes should have unequal, ascending values");
                }
                else if(head_metadesc_relevance_2 >= head_metadesc_relevance_3 || head_metadesc_relevance_2 >= head_metadesc_relevance_4 ){
                   errors_head.push("Meta Description Relevance Check -> Boxes should have unequal, ascending values");
                }
                else if(head_metadesc_relevance_3 >= head_metadesc_relevance_4 ){
                   errors_head.push("Meta Description Relevance Check -> Boxes should have unequal, ascending values");
                }
                 

            }
            
          }
          else{
            head_metadesc_relevance_1 = false;
            head_metadesc_relevance_2 = false;
            head_metadesc_relevance_3 = false;
            head_metadesc_relevance_4 = false;
          }

          //end of kw in metadesc rel

         if(head_metadesc_label == true){
            if(isEmpty(head_metadesc_label_content)){
              errors_head.push("If setted ON, Info and Tips box, can not be empty.");
            }
          }




        /*

        Content TAB

        */

        errors_content = new Array();

        content_language          = $('#content_language').is(':checked');
        content_charcount         = $('#content_charcount').is(':checked');
        content_wordcount         = $('#content_wordcount').is(':checked');
        content_kwin              = $('#content_kwin').is(':checked');
        content_content_relevance = $('#content_content_relevance').is(':checked');
        content_kwinitalic        = $('#content_kwinitalic').is(':checked');
        content_kwinbold          = $('#content_kwinbold').is(':checked');
        content_headings          = $('#content_headings').is(':checked');
        content_iframes           = $('#content_iframes').is(':checked');
        content_label             = $('#content_label').is(':checked');
        content_label_c           = $('#content_label_content').val();

        // Characters count

        if(content_charcount == true){
            

            content_charcount_1 = parseFloat($('#content_charcount-1-l').val());
            content_charcount_2 = parseFloat($('#content_charcount-2-b').val());
            content_charcount_3 = parseFloat($('#content_charcount-2-l').val());
            content_charcount_4 = parseFloat($('#content_charcount-3-b').val());
            content_charcount_5 = parseFloat($('#content_charcount-3-l').val());
            content_charcount_6 = parseFloat($('#content_charcount-4-b').val());

            if(isEmpty(content_charcount_1) || isEmpty(content_charcount_2 ) || isEmpty(content_charcount_3) || isEmpty(content_charcount_4) ||  isEmpty(content_charcount_5) || isEmpty(content_charcount_6)){
              errors_content.push("Characters count Check -> None of the boxes can be empty");
            }
            else{
              if(content_charcount_1 >= content_charcount_2 || content_charcount_1 >= content_charcount_3 || content_charcount_1 >= content_charcount_4 || content_charcount_1 >= content_charcount_5 || content_charcount_1 >= content_charcount_6){
                 errors_content.push("Characters count Check -> Boxes should have unequal, ascending values");
              }
              else if(content_charcount_2 >= content_charcount_3 || content_charcount_2 >= content_charcount_4 || content_charcount_2 >= content_charcount_5 || content_charcount_2 >= content_charcount_6){
                 errors_content.push("Characters count Check -> Boxes should have unequal, ascending values");
              }
              else if(content_charcount_3 >= content_charcount_4 || content_charcount_3 >= content_charcount_5 || content_charcount_3 >= content_charcount_6){
                 errors_content.push("Characters count Check -> Boxes should have unequal, ascending values");
              }
               else if(content_charcount_4 >= content_charcount_5 || content_charcount_4 >= content_charcount_6){
                 errors_content.push("Meta Description lenght Check -> Boxes should have unequal, ascending values");
              }
               else if(content_charcount_5 >= content_charcount_6){
                 errors_content.push("Characters count Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            content_charcount_1 = false;
            content_charcount_2 = false;
            content_charcount_3 = false;
            content_charcount_4 = false;
            content_charcount_5 = false;
            content_charcount_6 = false;

          }

          // Words count


          if(content_wordcount == true){
            

            content_wordcount_1 = parseFloat($('#content_wordcount-1-l').val());
            content_wordcount_2 = parseFloat($('#content_wordcount-2-b').val());
            content_wordcount_3 = parseFloat($('#content_wordcount-2-l').val());
            content_wordcount_4 = parseFloat($('#content_wordcount-3-b').val());
            content_wordcount_5 = parseFloat($('#content_wordcount-3-l').val());
            content_wordcount_6 = parseFloat($('#content_wordcount-4-b').val());

            if(isEmpty(content_wordcount_1) || isEmpty(content_wordcount_2 ) || isEmpty(content_wordcount_3) || isEmpty(content_wordcount_4) ||  isEmpty(content_wordcount_5) || isEmpty(content_wordcount_6)){
              errors_content.push("Words count Check -> None of the boxes can be empty");
            }
            else{
              if(content_wordcount_1 >= content_wordcount_2 || content_wordcount_1 >= content_wordcount_3 || content_wordcount_1 >= content_wordcount_4 || content_wordcount_1 >= content_wordcount_5 || content_wordcount_1 >= content_wordcount_6){
                 errors_content.push("Words count Check -> Boxes should have unequal, ascending values");
              }
              else if(content_wordcount_2 >= content_wordcount_3 || content_wordcount_2 >= content_wordcount_4 || content_wordcount_2 >= content_wordcount_5 || content_wordcount_2 >= content_wordcount_6){
                 errors_content.push("Words count Check -> Boxes should have unequal, ascending values");
              }
              else if(content_wordcount_3 >= content_wordcount_4 || content_wordcount_3 >= content_wordcount_5 || content_wordcount_3 >= content_wordcount_6){
                 errors_content.push("Words count Check -> Boxes should have unequal, ascending values");
              }
               else if(content_wordcount_4 >= content_wordcount_5 || content_wordcount_4 >= content_wordcount_6){
                 errors_content.push("Words count Check -> Boxes should have unequal, ascending values");
              }
               else if(content_wordcount_5 >= content_wordcount_6){
                 errors_content.push("Words count Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            content_wordcount_1 = false;
            content_wordcount_2 = false;
            content_wordcount_3 = false;
            content_wordcount_4 = false;
            content_wordcount_5 = false;
            content_wordcount_6 = false;

          }

          //Relevance with keywords

          if(content_content_relevance == true){

            content_content_relevance_1 = parseFloat($('#content_content_relevance-1-l').val());
            content_content_relevance_2 = parseFloat($('#content_content_relevance-2-b').val());
            content_content_relevance_3 = parseFloat($('#content_content_relevance-2-l').val());
            content_content_relevance_4 = parseFloat($('#content_content_relevance-3-b').val());

            if(isEmpty(content_content_relevance_1) || isEmpty(content_content_relevance_2 ) || isEmpty(content_content_relevance_3) || isEmpty(content_content_relevance_4)){
              errors_content.push("Relevance with keywords Check -> None of the boxes can be empty");
            }
            else{

                 if(content_content_relevance_1 >= content_content_relevance_2 || content_content_relevance_1 >= content_content_relevance_3 ||content_content_relevance_1 >= content_content_relevance_4){
                   errors_content.push("Relevance with keywords Check -> Boxes should have unequal, ascending values");
                }
                else if(content_content_relevance_2 >= content_content_relevance_3 || content_content_relevance_2 >= content_content_relevance_4 ){
                   errors_content.push("Relevance with keywords Check -> Boxes should have unequal, ascending values");
                }
                else if(content_content_relevance_3 >= content_content_relevance_4 ){
                   errors_content.push("Relevance with keywords Check -> Boxes should have unequal, ascending values");
                }
                 

            }
            
          }
          else{
            content_content_relevance_1 = false;
            content_content_relevance_2 = false;
            content_content_relevance_3 = false;
            content_content_relevance_4 = false;
          }


         if(content_label == true){
            if(isEmpty(content_label_c)){
              errors_content.push("If setted ON, Info and Tips box, can not be empty.");
            }
          }


        /*

        URL Structure TAB
  
        */

        errors_url = new Array();

        url_display    = $('#url_display').is(':checked');
        url_kwin       = $('#url_kwin').is(':checked');
        url_lenght     = $('#url_lenght').is(':checked');
        url_subdomains = $('#url_subdomains').is(':checked');
        url_label      = $('#url_label').is(':checked');
        url_label_c    = $('#url_label_content').val();

        //Domain lenght

          if(url_lenght == true){
            

            url_lenght_1 = parseFloat($('#url_lenght-1-l').val());
            url_lenght_2 = parseFloat($('#url_lenght-2-b').val());
            url_lenght_3 = parseFloat($('#url_lenght-2-l').val());
            //url_lenght_4 = parseFloat($('#url_lenght-3-b').val());
            //url_lenght_5 = parseFloat($('#url_lenght-3-l').val());
            url_lenght_6 = parseFloat($('#url_lenght-4-b').val());

            if(isEmpty(url_lenght_1) || isEmpty(url_lenght_2 ) || isEmpty(url_lenght_3) || /*isEmpty(url_lenght_4) ||  isEmpty(url_lenght_5) ||*/ isEmpty(url_lenght_6)){
              errors_url.push("Domain length Check -> None of the boxes can be empty");
            }
            else{
              if(url_lenght_1 >= url_lenght_2 || url_lenght_1 >= url_lenght_3 || /*url_lenght_1 >= url_lenght_4 || url_lenght_1 >= url_lenght_5 ||*/ url_lenght_1 >= url_lenght_6){
                 errors_url.push("Domain length Check -> Boxes should have unequal, ascending values");
              }
              else if(url_lenght_2 >= url_lenght_3 || /*url_lenght_2 >= url_lenght_4 || url_lenght_2 >= url_lenght_5 ||*/ url_lenght_2 >= url_lenght_6){
                 errors_url.push("Domain length Check -> Boxes should have unequal, ascending values");
              }
             /* else if(url_lenght_3 >= url_lenght_4 || url_lenght_3 >= url_lenght_5 || url_lenght_3 >= url_lenght_6){
                 errors_url.push("Domain length Check -> Boxes should have unequal, ascending values");
              }
               else if(url_lenght_4 >= url_lenght_5 || url_lenght_4 >= url_lenght_6){
                 errors_url.push("Domain length Check -> Boxes should have unequal, ascending values");
              }
               else if(url_lenght_5 >= url_lenght_6){
                 errors_url.push("Domain length Check -> Boxes should have unequal, ascending values");
              }*/

            }

          }
          else{

            url_lenght_1 = false;
            url_lenght_2 = false;
            url_lenght_3 = false;
            //url_lenght_4 = false;
            //url_lenght_5 = false;
            url_lenght_6 = false;

          }   


         if(url_label == true){
            if(isEmpty(url_label_c)){
              errors_url.push("If setted ON, Info and Tips box, can not be empty.");
            }
          }



        /*

        Links 

        */


        errors_links = new Array();

        links_ilinks    = $('#links_ilinks').is(':checked');
        links_elinks    = $('#links_elinks').is(':checked');
        links_label      = $('#links_label').is(':checked');
        links_label_c    = $('#links_label_content').val();

        //internal links count

          if(links_ilinks == true){
            

            links_ilinks_1 = parseFloat($('#links_ilinks-1-l').val());
            links_ilinks_2 = parseFloat($('#links_ilinks-2-b').val());
            links_ilinks_3 = parseFloat($('#links_ilinks-2-l').val());
            links_ilinks_4 = parseFloat($('#links_ilinks-3-b').val());
            links_ilinks_5 = parseFloat($('#links_ilinks-3-l').val());
            links_ilinks_6 = parseFloat($('#links_ilinks-4-b').val());

            if(isEmpty(links_ilinks_1) || isEmpty(links_ilinks_2 ) || isEmpty(links_ilinks_3) || isEmpty(links_ilinks_4) ||  isEmpty(links_ilinks_5) || isEmpty(links_ilinks_6)){
              errors_links.push("Internal links count Check -> None of the boxes can be empty");
            }
            else{
              if(links_ilinks_1 >= links_ilinks_2 || links_ilinks_1 >= links_ilinks_3 || links_ilinks_1 >= links_ilinks_4 || links_ilinks_1 >= links_ilinks_5 || links_ilinks_1 >= links_ilinks_6){
                 errors_links.push("Internal links count Check -> Boxes should have unequal, ascending values");
              }
              else if(links_ilinks_2 >= links_ilinks_3 || links_ilinks_2 >= links_ilinks_4 || links_ilinks_2 >= links_ilinks_5 || links_ilinks_2 >= links_ilinks_6){
                 errors_links.push("Internal links count Check -> Boxes should have unequal, ascending values");
              }
              else if(links_ilinks_3 >= links_ilinks_4 || links_ilinks_3 >= links_ilinks_5 || links_ilinks_3 >= links_ilinks_6){
                 errors_links.push("Internal links count Check -> Boxes should have unequal, ascending values");
              }
               else if(links_ilinks_4 >= links_ilinks_5 || links_ilinks_4 >= links_ilinks_6){
                 errors_links.push("Internal links count Check -> Boxes should have unequal, ascending values");
              }
               else if(links_ilinks_5 >= links_ilinks_6){
                 errors_links.push("Internal links count Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            links_ilinks_1 = false;
            links_ilinks_2 = false;
            links_ilinks_3 = false;
            links_ilinks_4 = false;
            links_ilinks_5 = false;
            links_ilinks_6 = false;

          }

          //external links count

         if(links_elinks == true){
            

            links_elinks_1 = parseFloat($('#links_elinks-1-l').val());
            links_elinks_2 = parseFloat($('#links_elinks-2-b').val());
            links_elinks_3 = parseFloat($('#links_elinks-2-l').val());
            links_elinks_4 = parseFloat($('#links_elinks-3-b').val());
            links_elinks_5 = parseFloat($('#links_elinks-3-l').val());
            links_elinks_6 = parseFloat($('#links_elinks-4-b').val());

            if(isEmpty(links_elinks_1) || isEmpty(links_elinks_2 ) || isEmpty(links_elinks_3) || isEmpty(links_elinks_4) ||  isEmpty(links_elinks_5) || isEmpty(links_elinks_6)){
              errors_links.push("External links count Check -> None of the boxes can be empty");
            }
            else{
              if(links_elinks_1 >= links_elinks_2 || links_elinks_1 >= links_elinks_3 || links_elinks_1 >= links_elinks_4 || links_elinks_1 >= links_elinks_5 || links_elinks_1 >= links_elinks_6){
                 errors_links.push("External links count Check -> Boxes should have unequal, ascending values");
              }
              else if(links_elinks_2 >= links_elinks_3 || links_elinks_2 >= links_elinks_4 || links_elinks_2 >= links_elinks_5 || links_elinks_2 >= links_elinks_6){
                 errors_links.push("External links count Check -> Boxes should have unequal, ascending values");
              }
              else if(links_elinks_3 >= links_elinks_4 || links_elinks_3 >= links_elinks_5 || links_elinks_3 >= links_elinks_6){
                 errors_links.push("External links count Check -> Boxes should have unequal, ascending values");
              }
               else if(links_elinks_4 >= links_elinks_5 || links_elinks_4 >= links_elinks_6){
                 errors_links.push("External links count Check -> Boxes should have unequal, ascending values");
              }
               else if(links_elinks_5 >= links_elinks_6){
                 errors_links.push("External links count Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            links_elinks_1 = false;
            links_elinks_2 = false;
            links_elinks_3 = false;
            links_elinks_4 = false;
            links_elinks_5 = false;
            links_elinks_6 = false;

          }


         if(links_label == true){
            if(isEmpty(links_label_c)){
              errors_links.push("If setted ON, Info and Tips box, can not be empty.");
            }
          }

        /*

        User Experience
  
        */


        errors_ux = new Array();

        ux_speed      = $('#ux_speed').is(':checked');
        ux_gram       = $('#ux_gram').is(':checked');
        ux_responsive = $('#ux_responsive').is(':checked');
        ux_feedback   = $('#ux_feedback').is(':checked');
        ux_label      = $('#ux_label').is(':checked');
        ux_label_c    = $('#ux_label_content').val();


        //speed 

         if(ux_speed == true){
            

            ux_speed_1 = parseFloat($('#ux_speed-1-l').val());
            ux_speed_2 = parseFloat($('#ux_speed-2-b').val());
            ux_speed_3 = parseFloat($('#ux_speed-2-l').val());
            ux_speed_4 = parseFloat($('#ux_speed-3-b').val());
            ux_speed_5 = parseFloat($('#ux_speed-3-l').val());
            //ux_speed_6 = parseFloat($('#ux_speed-4-b').val());

            if(isEmpty(ux_speed_1) || isEmpty(ux_speed_2 ) || isEmpty(ux_speed_3) || isEmpty(ux_speed_4) ||  isEmpty(ux_speed_5) ){
              errors_ux.push("Page Speed Check -> None of the boxes can be empty");
            }
            else{
              if(ux_speed_1 >= ux_speed_2 || ux_speed_1 >= ux_speed_3 || ux_speed_1 >= ux_speed_4 || ux_speed_1 >= ux_speed_5 ){
                 errors_ux.push("Page Speed Check -> Boxes should have unequal, ascending values");
              }
              else if(ux_speed_2 >= ux_speed_3 || ux_speed_2 >= ux_speed_4 || ux_speed_2 >= ux_speed_5){
                 errors_ux.push("Page Speed Check -> Boxes should have unequal, ascending values");
              }
              else if(ux_speed_3 >= ux_speed_4 || ux_speed_3 >= ux_speed_5){
                 errors_ux.push("Page Speed Check -> Boxes should have unequal, ascending values");
              }
               else if(ux_speed_4 >= ux_speed_5 ){
                 errors_ux.push("Page Speed Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            ux_speed_1 = false;
            ux_speed_2 = false;
            ux_speed_3 = false;
            ux_speed_4 = false;
            ux_speed_5 = false;
           

          }

          //grammar mistakes

         if(ux_gram == true){
            

            ux_gram_1 = parseFloat($('#ux_gram-1-l').val());
           // ux_gram_2 = parseFloat($('#ux_gram-2-b').val());
           // ux_gram_3 = parseFloat($('#ux_gram-2-l').val());
            ux_gram_4 = parseFloat($('#ux_gram-3-b').val());
            ux_gram_5 = parseFloat($('#ux_gram-3-l').val());
            ux_gram_6 = parseFloat($('#ux_gram-4-b').val());

            if(isEmpty(ux_gram_1) || isEmpty(ux_gram_4) ||  isEmpty(ux_gram_5) || isEmpty(ux_gram_6)){
              errors_ux.push("Grammar mistakes Check -> None of the boxes can be empty");
            }
            else{
              if(ux_gram_1 >= ux_gram_4 || ux_gram_1 >= ux_gram_5 || ux_gram_1 >= ux_gram_6){
                 errors_ux.push("Grammar mistakes Check -> Boxes should have unequal, ascending values");
              }
               else if(ux_gram_4 >= ux_gram_5 || ux_gram_4 >= ux_gram_6){
                 errors_ux.push("Grammar mistakes Check -> Boxes should have unequal, ascending values");
              }
               else if(ux_gram_5 >= ux_gram_6){
                 errors_ux.push("Grammar mistakes Check -> Boxes should have unequal, ascending values");
              }

            }

          }
          else{

            ux_gram_1 = false;
          
            ux_gram_4 = false;
            ux_gram_5 = false;
            ux_gram_6 = false;

          }

         if(ux_label == true){
            if(isEmpty(ux_label_c)){
              errors_ux.push("If setted ON, Info and Tips box, can not be empty.");
            }
          }

        //end of verifications

        //clearing all the previous errors

        $('#eb_general').html('');
        $('#eb_crawling').html('');
        $('#eb_head').html('');
        $('#eb_content').html('');
        $('#eb_url').html('');
        $('#eb_links').html('');
        $('#eb_ux').html('');
        $('#main_msgbox').html('');
 

        // Debbugging pourpouse
        //console.log('-----Errors----');

        if( errors_general.length > 0 || errors_crawling.length > 0 || errors_head.length > 0 || errors_content.length > 0 || errors_url.length > 0 || errors_links.length > 0 || errors_ux.length > 0){
            $('#main_msgbox').html('<div class="alert alert-dismissable alert-danger">\
                <strong>Error(s) occured in the following tab(s):</strong> <i><span id="errtabs"></span></i>\
                .Please correct the error(s) and then try again.</div>')
        }

        errtabs = new Array();

        if(errors_general.length > 0){   
            
           // Debbugging pourpouse 
           // console.log('General: ' + errors_general);
           errtabs.push('General');
           $('#btn_1').css( "color", "red" );

           for (err = 0; err < errors_general.length; ++err) {
              $('#eb_general').html($('#eb_general').html() + errgen('Error:',errors_general[err]));
          }

        }else{

          // Debbugging pourpouse
          // console.log('No errors occured in the General tab');
          $('#btn_1').css( "color", "green" );

        }

        if(errors_crawling.length > 0){   
           
           // Debbugging pourpouse 
           // console.log('Crawling: ' + errors_crawling);
           errtabs.push('Crawling');
           $('#btn_2').css( "color", "red" );

          for (err = 0; err < errors_crawling.length; ++err) {
              $('#eb_crawling').html($('#eb_crawling').html() + errgen('Error:',errors_crawling[err]));
          }

        }else{

          // Debbugging pourpouse
          // console.log('No errors occured in the Crawling tab');
          $('#btn_2').css( "color", "green" );


        }

        if(errors_head.length > 0){  

           // Debbugging pourpouse 
           // console.log('Head: ' + errors_head);
           errtabs.push('Head Elements');
           $('#btn_3').css( "color", "red" );


          for (err = 0; err < errors_head.length; ++err) {

            if(strpos(errors_head[err],'->')){
              error = errors_head[err].split('->');
              $('#eb_head').html($('#eb_head').html() + errgen(error[0] + ' -> ' ,error[1]));
            }
            else{
              $('#eb_head').html($('#eb_head').html() + errgen('Error:',errors_head[err]));
            }

          }

        }else{

          // Debbugging pourpouse
          // console.log('No errors occured in the Head tab');
          $('#btn_3').css( "color", "green" );


        }

        if(errors_content.length > 0){   
           
           // Debbugging pourpouse
           // console.log('Content: ' + errors_content);
           errtabs.push('Content');
           $('#btn_4').css( "color", "red" );

          for (err = 0; err < errors_content.length; ++err) {

            if(strpos(errors_content[err],'->')){
              error = errors_content[err].split('->');
              $('#eb_content').html($('#eb_content').html() + errgen(error[0] + ' -> ' ,error[1]));
            }
            else{
              $('#eb_content').html($('#eb_content').html() + errgen('Error:',errors_content[err]));
            }

          }

        }else{
          
          // Debbugging pourpouse
          // console.log('No errors occured in the Content tab');
          $('#btn_4').css( "color", "green" );

        }

        if(errors_url.length > 0){   
           
           // Debbugging pourpouse
           // console.log('URL: ' + errors_url);
           errtabs.push('URL Structure');
           $('#btn_5').css( "color", "red" );

          for (err = 0; err < errors_url.length; ++err) {

            if(strpos(errors_url[err],'->')){
              error = errors_url[err].split('->');
              $('#eb_url').html($('#eb_url').html() + errgen(error[0] + ' -> ' ,error[1]));
            }
            else{
              $('#eb_url').html($('#eb_url').html() + errgen('Error:',errors_url[err]));
            }

          }

        }else{

          // Debbugging pourpouse
          // console.log('No errors occured in the URL Strucutre tab');
          $('#btn_5').css( "color", "green" );

        } 

        if(errors_links.length > 0){   
           
           // Debbugging pourpouse
           // console.log('Links: ' + errors_links);
           errtabs.push('Links');
           $('#btn_6').css( "color", "red" );

          for (err = 0; err < errors_links.length; ++err) {

            if(strpos(errors_links[err],'->')){
              error = errors_links[err].split('->');
              $('#eb_links').html($('#eb_links').html() + errgen(error[0] + ' -> ' ,error[1]));
            }
            else{
              $('#eb_links').html($('#eb_links').html() + errgen('Error:',errors_links[err]));
            }

          }

        }else{

          // Debbugging pourpouse
          // console.log('No errors occured in the Links tab');
          $('#btn_6').css( "color", "green" );

        } 

        if(errors_ux.length > 0){   
           
           // Debbugging pourpouse
           // console.log('User Experience: ' + errors_ux);
           errtabs.push('User Experience');
           $('#btn_7').css( "color", "red" );

          for (err = 0; err < errors_ux.length; ++err) {

            if(strpos(errors_ux[err],'->')){
              error = errors_ux[err].split('->');
              $('#eb_ux').html($('#eb_links').html() + errgen(error[0] + ' -> ' ,error[1]));
            }
            else{
              $('#eb_ux').html($('#eb_ux').html() + errgen('Error:',errors_ux[err]));
            }

          }

        }else{

          // Debbugging pourpouse
          // console.log('No errors occured in the UX tab');
          $('#btn_7').css( "color", "green" );

        } 

        if(errtabs.length > 0){  
          $('#errtabs').html(errtabs.join());
          // Debbugging pourpouse
          // console.log('failure');
        }
        else{
           $('#main_msgbox').html('<div class="alert alert-dismissable alert-success">\
                <strong>Success:</strong> Your SEO Profile has been edited. Now you can run it trough the main page (if you made it public).\
                </div>')

           $('#zabtn').attr('disabled', 'disabled').html("Loading...");
           //console.log(fn);
           $.post("php/xmlreq.php", {
          // request data
           q: "a",
           sp: "true",
           fn: fn,
            //general data
           g_barvalue: bar_val,
           g_name: info_name,
           g_descr: info_descr,
           g_ispb: info_ispb,
           //crawling
           c_http: crawling_http,
           c_robots: crawling_robots,
           c_sitemap: crawling_sitemap,
           c_label: crawling_label,
           c_label_c: crawling_label_c,
           //head: title
           h_t_show: head_title_show,
           h_t_length: head_title_lenght,
           h_t_length_d: new Array(head_title_lenght_1, head_title_lenght_2,head_title_lenght_3,head_title_lenght_4,head_title_lenght_5,head_title_lenght_6),
           h_t_length_c: new Array(c_head_title_lenght_1,c_head_title_lenght_2,c_head_title_lenght_3,c_head_title_lenght_4),
           h_t_stopwords: head_title_stop_words,
           h_t_kwin: head_title_kw_in_title,
           h_t_rel: head_title_relevance,
           h_t_rel_d: new Array(head_title_relevance_1,head_title_relevance_2,head_title_relevance_3,head_title_relevance_4),
           h_t_rel_c: new Array(c_head_title_relevance_1,c_head_title_relevance_2,c_head_title_relevance_3),
           h_t_label: head_title_label,
           h_t_label_c: head_title_label_content,
           //head:meta kw
           h_k_show: head_metakw_show,
           h_k_count: head_metakw_count,
           h_k_count_d: new Array(head_metakw_count_1, head_metakw_count_2,head_metakw_count_3,head_metakw_count_4,head_metakw_count_5,head_metakw_count_6),
           h_k_count_c: new Array(c_head_metakw_count_1,c_head_metakw_count_2,c_head_metakw_count_3,c_head_metakw_count_4),
           h_k_rel: head_metakw_relevance,
           h__k_rel_d: new Array(head_metakw_relevance_1,head_metakw_relevance_2,head_metakw_relevance_3,head_metakw_relevance_4),
           h__k_rel_c: new Array(c_head_metakw_relevance_1,c_head_metakw_relevance_2,c_head_metakw_relevance_3),
           h_k_label: head_metakw_label,
           h_k_label_c: head_metakw_label_c,
           //head:meta desc
           h_d_show: head_metadesc_show,
           h_d_length: head_metadesc_lenght,
           h_d_length_d: new Array(head_metadesc_lenght_1, head_metadesc_lenght_2,head_metadesc_lenght_3,head_metadesc_lenght_4,head_metadesc_lenght_5,head_metadesc_lenght_6),
           h_d_length_c: new Array(c_head_metadesc_lenght_1, c_head_metadesc_lenght_2,c_head_metadesc_lenght_3,c_head_metadesc_lenght_4),
           h_d_kwin: head_title_kw_in_metadesc,
           h_d_rel: head_metadesc_relevance,
           h_d_rel_d: new Array(head_metadesc_relevance_1,head_metadesc_relevance_2,head_metadesc_relevance_3,head_metadesc_relevance_4),
           h_d_rel_c: new Array(c_head_metadesc_relevance_1,c_head_metadesc_relevance_2,c_head_metadesc_relevance_3),
           h_d_label: head_metadesc_label,
           h_d_label_c: head_metadesc_label_content,
           //content
           ct_lang: content_language,
           ct_chars: content_charcount,
           ct_chars_d: new Array(content_charcount_1, content_charcount_2,content_charcount_3,content_charcount_4,content_charcount_5,content_charcount_6),
           ct_chars_c: new Array(c_content_charcount_1,c_content_charcount_2,c_content_charcount_3,c_content_charcount_4),
           ct_words: content_wordcount,
           ct_words_d: new Array(content_wordcount_1, content_wordcount_2,content_wordcount_3,content_wordcount_4,content_wordcount_5,content_wordcount_6),
           ct_words_c: new Array(c_content_wordcount_1, c_content_wordcount_2,c_content_wordcount_3,c_content_wordcount_4),
           ct_kwin: content_kwin,
           ct_rel: content_content_relevance,
           ct_rel_d: new Array(content_content_relevance_1,content_content_relevance_2,content_content_relevance_3,content_content_relevance_4),
           ct_rel_c: new Array(c_content_content_relevance_1,c_content_content_relevance_2,c_content_content_relevance_3),
           ct_kwini: content_kwinitalic,
           ct_kwinb: content_kwinbold,
           ct_headings: content_headings,
           ct_iframes: content_iframes,
           ct_label: content_label,
           ct_label_c: content_label_c,
           //url structure
           ul_show: url_display,
           ul_kwin: url_kwin,
           ul_length: url_lenght,
           ul_length_d: new Array(url_lenght_1, url_lenght_2,url_lenght_3,/*url_lenght_4,url_lenght_5,*/url_lenght_6),
           ul_length_c: new Array(c_url_lenght_1, c_url_lenght_2,/*c_url_lenght_3*/c_url_lenght_4),
           ul_sub: url_subdomains,
           ul_label: url_label,
           ul_label_c: url_label_c,
           //links
           l_ilinks: links_ilinks,
           l_ilinks_d: new Array(links_ilinks_1, links_ilinks_2,links_ilinks_3,links_ilinks_4,links_ilinks_5,links_ilinks_6),
           l_ilinks_c: new Array(c_links_ilinks_1, c_links_ilinks_2,c_links_ilinks_3,c_links_ilinks_4),
           l_elinks: links_elinks,
           l_elinks_d: new Array(links_elinks_1, links_elinks_2,links_elinks_3,links_elinks_4,links_elinks_5,links_elinks_6),
           l_elinks_c: new Array(c_links_elinks_1, c_links_elinks_2,c_links_elinks_3,c_links_elinks_4),
           l_label: links_label,
           l_label_c: links_label_c,
           //user experience
           u_speed: ux_speed,
           u_speed_d: new Array(ux_speed_1, ux_speed_2,ux_speed_3,ux_speed_4,ux_speed_5),
           u_speed_c: new Array(c_ux_speed_1, c_ux_speed_2,c_ux_speed_3),
           u_gram: ux_gram,
           u_gram_d: new Array(ux_gram_1,ux_gram_4,ux_gram_5,ux_gram_6),
           u_gram_c: new Array(c_ux_gram_1,c_ux_gram_3,c_ux_gram_4),
           u_res: ux_responsive,
           u_fb: ux_feedback,
           u_label: ux_label,
           u_label_c: ux_label_c
           })
           .done(function(data) {
                 //alert(data);
                 $('#zabtn').removeAttr('disabled').html('Edit the profile')
           });

        }


        /*

         Debugging pourpouse 


        console.log('-----Data----');


        console.log('General: '  + info_name, info_descr, info_ispb);
        console.log('Crawling: ' + crawling_http,crawling_robots,crawling_sitemap,crawling_label,crawling_label_c);

        console.log("\r");
        console.log('Head:');
        console.log("\r");

        console.log('Title relevance  -> ' +head_title_relevance_1,head_title_relevance_2,head_title_relevance_3,head_title_relevance_4);
        console.log('Title lenght -> ' +head_title_lenght_1, head_title_lenght_2,head_title_lenght_3,head_title_lenght_4,head_title_lenght_5,head_title_lenght_6);
        console.log('Title other -> ' + head_title_show,head_title_lenght,head_title_stop_words,head_title_kw_in_title,head_title_relevance,head_title_label,head_title_label_content);
        console.log("\r");

        console.log('Metadesc relevance  -> ' +head_metadesc_relevance_1,head_metadesc_relevance_2,head_metadesc_relevance_3,head_metadesc_relevance_4);
        console.log('Metadesc lenght -> '    +head_metadesc_lenght_1, head_metadesc_lenght_2,head_metadesc_lenght_3,head_metadesc_lenght_4,head_metadesc_lenght_5,head_metadesc_lenght_6);
        console.log('Metadesc other -> '    + head_metadesc_show,head_title_kw_in_metadesc,head_metadesc_label,head_metadesc_label_content);
        console.log("\r");

        console.log('MetaKw relevance  -> ' +head_metakw_relevance_1,head_metakw_relevance_2,head_metakw_relevance_3,head_metakw_relevance_4);
        console.log('MetaKw lenght -> '    +head_metakw_count_1, head_metakw_count_2,head_metakw_count_3,head_metakw_count_4,head_metakw_count_5,head_metakw_count_6);
        console.log('MetaKw lenght -> '    + head_metakw_show,head_metakw_count,head_metakw_relevance,head_metakw_label,head_metakw_label_c);

        console.log("\r");
        console.log('Content:');
        console.log("\r");

        console.log('Characters  -> ' + content_charcount_1, content_charcount_2,content_charcount_3,content_charcount_4,content_charcount_5,content_charcount_6);
        console.log('Words       -> ' + content_wordcount_1, content_wordcount_2,content_wordcount_3,content_wordcount_4,content_wordcount_5,content_wordcount_6);
        console.log('Relevance -> '   + content_content_relevance_1,content_content_relevance_2,content_content_relevance_3,content_content_relevance_4);
        console.log('Others -> '      + content_language,content_kwin, content_kwinitalic,content_kwinbold,content_headings,content_iframes,content_label,content_label_c);

        console.log("\r");
        console.log('Url Structure:');
        console.log("\r");              

        console.log('Domain length  -> ' + url_lenght_1, url_lenght_2,url_lenght_3,url_lenght_4,url_lenght_5,url_lenght_6);
        console.log('Others -> '      + url_display,url_kwin,url_subdomains,url_label,url_label,url_label_c);

        console.log("\r");
        console.log('Links:');
        console.log("\r");  

        console.log('Internal links  -> ' + links_ilinks_1, links_ilinks_2,links_ilinks_3,links_ilinks_4,links_ilinks_5,links_ilinks_6);
        console.log('External links  -> ' + links_elinks_1, links_elinks_2,links_elinks_3,links_elinks_4,links_elinks_5,links_elinks_6);
        console.log('Others -> '      + links_label,links_label_c);

        console.log("\r");
        console.log('User Experience:');
        console.log("\r");  
      
        console.log('Ux Speed  -> ' + ux_speed_1, ux_speed_2,ux_speed_3,ux_speed_4,ux_speed_5,ux_speed_6);
        console.log('Ux GM  -> ' + ux_gram_1, ux_gram_2,ux_gram_3,ux_gram_4,ux_gram_5,ux_gram_6);
        console.log('Others -> '      + ux_label,ux_label_c,ux_responsive,ux_feedback);


        */

      }
