//alert("hhhhhhhhhhhhhhhhhh");
  (function ($) {
        $.fn.https_adad = function () {
             return this.keypress(function (event) {
                //alert(event.which);
                //alert(event.keyCode);
                if ((event.which > 47 && event.which < 58) || (event.keyCode > 36 && event.keyCode < 41) || event.keyCode == 46 || event.keyCode == 8) {
                    return true;
                } else {
                    return false;
                }
            });
        };
    })(jQuery);
    var   farsiKey= [
        32, 33, 34, 35, 36, 37, 171, 1711,
        40, 41, 215, 43, 1608, 45, 46, 47,
        48, 49, 50, 51, 52, 53, 54, 55,
        56, 57, 58, 1705, 62, 61, 60, 1567,
        64, 1614, 1573, 1688, 1616, 1615, 1617, 1618,
        1570, 93, 1600, 1548, 1563, 1569, 1571, 91,
        92, 1611, 47474747, 1613, 1548, 8217, 1572, 1612,
        1610, 8216, 1577, 1580, 1662, 1670, 187, 95,
        247, 1588, 1584, 1586, 1740, 1579, 1576, 1604,
        1575, 1607, 1578, 1606, 1605, 1574, 1583, 1582,
        1581, 1590, 1602, 1587, 1601, 1593, 1585, 1589,
        1591, 1594, 1592, 125, 124, 123, 126
    ];
 
    (function ($) {
        $.fn.https_farsitype = function () {
            return this.keypress(function (event) {
                var str=String.fromCharCode(farsiKey[event.keyCode - 32]);
                 if (event.keyCode > 31 &&  event.keyCode < 127)  {
                    this.value=this.value.substring(0,this.selectionStart)+str+this.value.substring(this.selectionEnd);
                    return false;
                } else {
                    return true;
                }
            });

        };

    })(jQuery);
    async function jqajax(myurl,mydata,mymethod,idloader){
     // alert("ajax::"+myurl);
      $("#"+idloader).css("display","block");
      var result={};
      var res=await $.ajax({
       url: myurl,
       data        : mydata,
         // data        : formdata ? formdata : form.serialize(),
       cache       : false,
       contentType : false,
       processData : false,
       method:mymethod
     }).done(function(res,status,xhr) {
           if (xhr.status==200) {
             var result=JSON.parse(xhr.responseText);
             //alert(JSON.stringify(result));
              $("#"+idloader).css("display","none");
            //   alert(JSON.stringify(result));
             return result;
           } else {
             result.data="err";
             result.status=400;
            //  alert(JSON.stringify(result));
             return result;
           }
     }).fail(function(err)  { $("#"+idloader).css("display","none"); result.data=err.statusText;result.status=999; return result;});
     return res;
    }
    function historyOBJ(){let id=""+(window.history.length);let stateObj = { id: id };return stateObj;}
    function newhistoryOBJ(){let newid=""+(window.history.length+1);let newstateObj = { id: newid };return newstateObj;}
 /* notification */
  	function Hnoticlose(item){var w='70';$(item).parent().animate({opacity:'0'},"slow");if($(item).parent().width()>=350){w='350';}
  	$(item).parent().animate({height:'0px',width:w+'px',margin:'0px',padding:'0px'},"slow",()=>{$(item).parent().attr("display","none");$(item).parent().remove();});return true;}
    function Hnotification(args){
		var defaults={status:"info",Cstyle:[],Ctext:"",Cclass:"",Tstyle:[],Ttext:"",Tclass:""};
		var option=Object.assign(defaults, args);
		if(checkValid("Ctext")){
		    var x='<div class="Hnotipm Hbg-'+option.status+'" style="visibility:hidden;"><span class="Hnotipmbtn" onclick="Hnoticlose(this);">&times;</span><strong class="'+option.Tclass+'" style="'+stylefunction("T")+'">'+option.Ttext+'</strong><caption class="'+option.Cclass+'" style="'+stylefunction("C")+'">'+option.Ctext.replace('\n',"</br>")+'</caption></div>';
			var dd=$("#Hnotification").append(x);
			var cc=dd.children().last();
		    var h=($("#Hnotification").height()+20+cc.height())*-1;
			cc.animate({top:h+'px'},1,()=>{cc.css("visibility","visible")}).animate({top:'0px'},"slow");
		}else{return false;}
		function checkValid(key){var item=option[key];return (item===undefined || item=="")?false:true;}
		function stylefunction(key){var style="";if(checkValid(key+"style")){for(let x of option[key+"style"]){style +=Object.keys(x)+":"+Object.values(x)+";";}}return style;}
	}
 /*auto notification */
  //	function Hnoticlose(item){$(item).parent().animate({opacity:'0'},"slow");$(item).parent().animate({height:'0px',width:'350px',margin:'0px',padding:'0px'},"slow",()=>{$(item).parent().attr("display","none");$(item).parent().remove();});return true;}
    function HnotificationA(args){
		var defaults={status:"info",Cstyle:[],Ctext:"",Cclass:"",Tstyle:[],Ttext:"",Tclass:"",time:4};
		var option=Object.assign(defaults, args);
		//let t=option.Ctext;
		//option.Ctext=t.replace("\n","</br>");
		if(option.time<1 || option.time>10){option.time=4;}
		if(checkValid("Ctext")){
		    var x='<div class="Hnotipm Hbg-'+option.status+'"><span class="Hnotipmbtn" onclick="Hnoticlose(this);">&times;</span><strong class="'+option.Tclass+'" style="'+stylefunction("T")+'">'+option.Ttext+'</strong><caption class="'+option.Cclass+'" style="'+stylefunction("C")+'">'+option.Ctext+'</caption></div>';
			var dd=$("#Hnotification").append(x);
			var cc=dd.children().last();
		    var h=($("#Hnotification").height()+20+cc.height())*-1;
			cc.animate({top:h+'px'},1,()=>{cc.css("visibility","visible")}).animate({top:'0px'},"slow");
			var xx=cc.children().first();
			setTimeout(()=>{Hnoticlose(xx);},option.time*1000);
		}else{return false;}
		function checkValid(key){var item=option[key];return (item===undefined || item=="")?false:true;}
		function stylefunction(key){var style="";if(checkValid(key+"style")){for(let x of option[key+"style"]){style +=Object.keys(x)+":"+Object.values(x)+";";}}return style;}
	}
/* prompt */

    async function Hprompt(args){
		var defaults={status:"darksilver",icon:"systemic",Cstyle:[],Ctext:"",Cclass:"",Ivalue:"",Iplaceholder:"",Tstyle:[],Ttext:"پیام سیستمی از "+window.location.hostname,Tclass:"",oBstyle:[],oBtext:"پاسخ",oBclass:"",cBstyle:[],cBtext:"رد کردن",cBclass:""};
		var icon={systemic:"fas fa-globe",question:"fas fa-question-circle",note:"fas fa-bullhorn",alert:"fas fa-bell",warning:"fas fa-exclamation-triangle"};
		var option=Object.assign(defaults, args);
		if(checkValid("Ctext")){
		    var x='<div class="Hmodal" id="HconfirmModal" style="display:block;"><div class="Hmodal-sm Hcards Hconfirm" >';
			x+='<div class="Hcards-header Hconfirmbg '+option.Tclass+'" style="'+stylefunction("T")+'"><span class="'+icon[option.icon]+' H'+option.status+'"></span> '+option.Ttext+'</div>';
			x+='<div class="Hcards-content '+option.Cclass+'" style="'+stylefunction("C")+'">'+option.Ctext.replace('\n',"</br>")+'<br/><input type="text" id="Hintxt" value="'+option.Ivalue+'" placeholder="'+option.Iplaceholder+'"/></div>';
			x+='<div class="Hcards-footer"><button id="HconfirmOK" class="'+option.oBclass+'" style="'+stylefunction("oB")+'">'+option.oBtext+'</button><button id="HconfirmCANCLE" class="'+option.cBclass+'" style="'+stylefunction("cB")+'">'+option.cBtext+'</button></div></div></div>';
			$("body").append(x);
		    return new Promise(async(resolve,reject)=>{$("#HconfirmCANCLE").click(function(){$("#HconfirmModal").css("display","none");$("#HconfirmModal").remove();resolve(false);});$("#HconfirmOK").click(function(){var m=$("#Hintxt").val();$("#HconfirmModal").css("display","none");$("#HconfirmModal").remove();resolve(m);});}); 
		}else{return false;}
		function checkValid(key){var item=option[key];return (item===undefined || item=="")?false:true;}
		function stylefunction(key){var style="";if(checkValid(key+"style")){for(let x of option[key+"style"]){style +=Object.keys(x)+":"+Object.values(x)+";";}}return style;}
	}
/* alert */
	async function Halert(args){
	    var defaults={status:"info",icon:"inform",Cstyle:[],Ctext:"",Cclass:"",Tstyle:[],Ttext:"پیام سیستمی از "+window.location.hostname,Tclass:"",oBstyle:[],oBtext:"مشاهد شد",oBclass:""};
		var icon={inform:"fas fa-info-circle",success:"fas fa-check-circle",note:"fas fa-bullhorn",alert:"fas fa-bell",warning:"fas fa-exclamation-triangle",forbidden:"fas fa-minus-circle"};
		var option=Object.assign(defaults, args);
		if(checkValid("Ctext")){
			var x='<div class="Hmodal" id="HconfirmModal" style="display:block;"><div class="Hmodal-sm Hcards Hconfirm" >';
			x+='<div class="Hcards-header Hconfirmbg '+option.Tclass+'" style="'+stylefunction("T")+'"><span class="'+icon[option.icon]+' H'+option.status+'"></span> '+option.Ttext+'</div>';
			x+='<div class="Hcards-content '+option.Cclass+'" style="'+stylefunction("C")+'">'+option.Ctext.replace('\n',"</br>")+'</div><div class="Hcards-footer"><button id="HalertOK" class="'+option.oBclass+'" style="'+stylefunction("oB")+'">'+option.oBtext+'</button></div></div></div>';
			$("body").append(x);
		    return new Promise(async(resolve,reject)=>{$("#HalertOK").click(function(){$("#HconfirmModal").css("display","none");$("#HconfirmModal").remove();resolve(true);});});
	    }else{return false;}
		function checkValid(key){var item=option[key];return (item===undefined || item=="")?false:true;}
    	function stylefunction(key){var style="";if(checkValid(key+"style")){for(let x of option[key+"style"]){style +=Object.keys(x)+":"+Object.values(x)+";";}}return style;}
	}
/* confirm */
		async function Hconfirm(args){
		var defaults={status:"info",icon:"inform",Cstyle:[],Ctext:"",Cclass:"",Tstyle:[],Ttext:"پیام سیستمی از "+window.location.hostname,Tclass:"",oBstyle:[],oBtext:"آری",oBclass:"",cBstyle:[],cBtext:"نه",cBclass:""};
		var icon={inform:"fas fa-info-circle",alert:"fas fa-bell",warning:"fas fa-exclamation-triangle"};
		var option=Object.assign(defaults, args);
		if(checkValid("Ctext")){
		    var x='<div class="Hmodal" id="HconfirmModal" style="display:block;"><div class="Hmodal-sm Hcards Hconfirm" ><div class="Hcards-header Hconfirmbg '+option.Tclass+'" style="'+stylefunction("T")+'"><span class="'+icon[option.icon]+' H'+option.status+'"></span> '+option.Ttext+'</div><div class="Hcards-content '+option.Cclass+'" style="'+stylefunction("C")+'">'+option.Ctext.replace('\n',"</br>");
			x+='<div class="Hcards-footer"><button id="HconfirmOK" class="'+option.oBclass+'" style="'+stylefunction("oB")+'">'+option.oBtext+'</button><button id="HconfirmCANCLE" class="'+option.cBclass+'" style="'+stylefunction("cB")+'">'+option.cBtext+'</button></div></div></div>';				
			$("body").append(x);
			return new Promise(async(resolve,reject)=>{$("#HconfirmCANCLE").click(function(){$(this).css("display","none");$("#HconfirmModal").remove();resolve(false);});$("#HconfirmOK").click(function(){$("#HconfirmModal").css("display","none");$("#HconfirmModal").remove();resolve(true);});});
	    }else{return false;}
		function checkValid(key){var item=option[key];return (item===undefined || item=="")?false:true;}
    	function stylefunction(key){var style="";if(checkValid(key+"style")){for(let x of option[key+"style"]){style +=Object.keys(x)+":"+Object.values(x)+";";}}return style;}
		}






$(document).ready(function () {
    $(".adad").https_adad();
    $("[lang=fa]").https_farsitype();

//     var wH = $(window).height(),
// wW = $(window).width();
// alert("xxxxxxxxxxxxxxxx");
//     /*
//         startup page
//        ================================================
//        */
//     //------------ set all -------------
//     // $(".HimportHTML").after('<a href="#">ppppp</a>').next().html(function () { $(this).load($(this).prev().attr("data-loading-text")); }).prev().remove();
//     // pagedividing(wW);
//     // $(".htmlcode").each(function (i) {
//     //     var str = $(this).html();
//     //     var result1 = str;
//     //     var s, e = 0, start = "", end = "";
//     //     val1 = '/>';
//     //     val2 = "<val>/></val>";
//     //     result1 = result1.replace(val1, val2);
//     //     val1 = '">';
//     //     val2 = '"<val>></val>';
//     //     result1 = result1.replace(val1, val2);
//     //     val1 = ' >';
//     //     val2 = ' <val>></val>';
//     //     result1 = result1.replace(val1, val2);
//     //     s = str.indexOf("<");
//     //     while (s > -1) {
//     //         if (str[s + 1] == "/") {
//     //             e = str.indexOf(">", s + 1);
//     //             start = "/";
//     //             end = ">";
//     //             s++;
//     //         } else {
//     //             e = str.indexOf(" ", s);
//     //             start = "";
//     //             end = " ";
//     //             e1 = str.indexOf(">", s)
//     //             if (e >= e1) {
//     //                 e = e1;
//     //                 end = ">";
//     //             }
//     //         }
//     //         s++;
//     //         res = str.slice(s, e);
//     //         val1 = "<" + start + res + end;
//     //         val2 = "<val>&lt;" + start + "</val><tag>" + res + "</tag><val>" + end + "</val>";
//     //         result1 = result1.replace(val1, val2);
//     //         s = e;
//     //         s = str.indexOf("<", s);
//     //     }
//     //     s = str.indexOf("=");
//     //     while (s > -1) {
//     //         e = str.lastIndexOf(" ", s);
//     //         res = str.slice(e + 1, s);
//     //         val1 = res;
//     //         val2 = "<span>" + res + "</span>";
//     //         e = str.indexOf('"', s + 2);
//     //         res = str.slice(s, e + 1);
//     //         val1 += res;
//     //         val2 += "<val>" + res + "</val>";
//     //         result1 = result1.replace(val1, val2);
//     //         s = e;
//     //         s = str.indexOf("=", s);
//     //     }
//     //     s = str.indexOf("//-");
//     //     while (s > -1) {
//     //         e = str.indexOf(" ", s);
//     //         res = str.slice(s+3, e-1);
//     //         val1 = "//-"+res;
//     //         val2 = "<syn>//" + res + "</syn>";
//     //         //e = str.indexOf('"', s + 2);
//     //         //res = str.slice(s, e + 1);
//     //         //val1 += res;
//     //         //val2 += "<val>" + res + "</val>";
//     //         result1 = result1.replace(val1, val2);
//     //         s = e;
//     //         s = str.indexOf("//-", s);
//     //     }

//     //     $(this).html(result1);
//     // });
//     // $(".csscode").each(function (i) {
//     //     var str = $(this).html();
//     //     var result = str.split("}");
//     //     var s, e = 0, start = "", end = "";
//     //     var ressub,ressub2,res,res2,ressub2full;
//     //     for (i = 0; i < result.length - 1; i++)
//     //     {
//     //         ressub = result[i].split("{")
//     //         res = ressub[0]
//     //         s = ressub[0].indexOf("/*");
//     //         if (s > -1) {
//     //             e = ressub[0].indexOf("*/");
//     //             e += 2;
//     //             res = ressub[0].replace(ressub[0].slice(s, e),"<syn>"+ressub[0].slice(s, e)+"</syn>");
//     //             s = e + 1;
//     //         } else {
//     //             s = 0;
//     //         }
//     //         res = res.replace(ressub[0].slice(s, ressub[0].length),"<tag>" + ressub[0].slice(s, ressub[0].length) + "</tag>");
//     //         ressub[0] = res;
//     //         ressub2 = ressub[1].split(";");
//     //         for (j = 0; j < ressub2.length-1; j++)
//     //         {
//     //             s = ressub2[j].indexOf("*/");
//     //             if (s > -1)
//     //             {
//     //                 res = ressub2[j].split("*/");
//     //                 res2 = res[1].split(":");
//     //                 ressub2[j] = ressub2[j].replace(res[0] + "*/", "<syn>" + res[0] + "*/</syn>");
//     //                 ressub2[j] = ressub2[j].replace(res[1], "<span>" + res2[0] + "</span>:<val>" + res2[1] + "</val>");
//     //             } else {
//     //                 res2 = ressub2[j].split(":");
//     //                 ressub2[j] = ressub2[j].replace(res2[0]+":"+res2[1], "<span>" + res2[0] + "</span>:<val>" + res2[1] + "</val>");
//     //             }
//     //         }
//     //         ressub[1] = ressub2.join(";");
//     //         result[i] = ressub.join("{");
//     //     }
//     //     result1 = result.join("}");
//     //     $(this).html(result1);
//     // });





//     /*
//       windows Events
//      ================================================
//      */
//     //----- resize windows --------
//     $(window).resize(function () {
//         var wH = $(window).height(), wW = $(window).width();
//         pagedividing(wW);
//         menushow();
//         $(".Hani-lozenges").each(function (i) {
//             $(this).height($(this).width());
//         });
//         //resizefix();
//         //$(".fixwindows").css({ "height": wH + "px" });
//         //alert("wh:" + wH + " -- ww:" + wW);
//         //hT1 = $('#menu').offset().top,
//         //hH1 = $('#menu').outerHeight();
//     });
//     //----- load windows --------
//     $(window).load(function () {
//         var wH = $(window).height(),wW = $(window).width();
//         //pagedividing(wW);
//         menushow();
//         //$(".Hbrdless input[type=text],.Hbrdless textarea,.Hbrdless select").each(function (i) {
//         //    $(this).css("border-bottom-color", "rgba(" + hexok($(this).parent().parent().attr("data-brd")) + ",0.4)");
//         //    if ($(this).val() == "") {
//         //        $(this).prev().removeClass("on");
//         //        //$(".Hbrdless input:empty").prev().removeClass("on");
//         //        $(this).prev().css("color", "rgba(" + hexok($(this).parent().parent().attr("data-lesscolor")) + ",0.4)");
//         //    }
//         //});

//         starttab();
//        // resizefix();
//     });
    //----- scroll windows --------
    $(window).scroll(function () {
        //if ($(window).scrollTop() >= $("#startpoint").offset().top) {
        //    document.getElementById("menubar").style.display = "block";
        //} else {
        //    document.getElementById("menubar").style.display = "none";
        //}
    });


    /*
       data attribute
      ================================================
      */
    //--- set all ----------------
    //-- dimention
    $("[data-width]").each(function (i) {
        $(this).css({ "width": $(this).attr("data-width") });
    });
    $("[data-height]").each(function (i) {
        s=$(this).attr("data-height");
        subs=s.substr(s.length-1,1);
        if (subs == "%" || subs == "x")
        {
            $(this).css({ "height": s });
        } else {
            z = s * $(this).width() / 100;
            $(this).css({ "height": z + "px" });
        }
    });
    $("[data-top]").each(function (i) {
        $(this).css({ "top": $(this).attr("data-top") });
    });
    $("[data-right]").each(function (i) {
        $(this).css({ "right": $(this).attr("data-right") });
    });
    $("[data-bottom]").each(function (i) {
        $(this).css({ "bottom": $(this).attr("data-bottom") });
    });
    $("[data-left]").each(function (i) {
        $(this).css({ "left": $(this).attr("data-left") });
    });

    //--    colors set all
    $("[data-bgcolor]").each(function (i) {
        $(this).css({ "background-color": $(this).attr("data-bgcolor") });
    });
    $("[data-color]").each(function (i) {
        $(this).css({ "color": $(this).attr("data-color") });
    });

    //--    transform
    $("[data-duration]").each(function (i) {
        sec = $(this).attr("data-duration") / 1000;
        $(this).addClass("transition");
        $(this).css({ "-moz-transition-duration": sec + "s", "-ms-transition-duration": + sec + "s", "-o-transition-duration": + sec + "s", "-webkit-transition-duration": + sec + "s", "transition-duration": + sec + "s", });
    });
    $("[data-rotate]").each(function (i) {
        deg = $(this).attr("data-rotate");
        $(this).css({ "-moz-transform": "rotate(" + deg + "deg)", "-ms-transform": "rotate(" + deg + "deg)", "-o-transform": "rotate(" + deg + "deg)", "-webkit-transform": "rotate(" + deg + "deg)", "transform": "rotate(" + deg + "deg)" });
    });
    $("[data-translate]").each(function (i) {
        dim = $(this).attr("data-translate");
        $(this).css({ "-moz-transform": "translate(" + dim +")", "-ms-transform": "translate(" + dim + ")", "-o-transform": "translate(" + dim + ")", "-webkit-transform": "translate(" + dim + ")", "transform": "translate(" + dim + ")" });
    });
    $("[data-scale]").each(function (i) {
        dim = $(this).attr("data-scale");
        $(this).css({ "-moz-transform": "scale(" + dim + ")", "-ms-transform": "scale(" + dim + ")", "-o-transform": "scale(" + dim + ")", "-webkit-transform": "scale(" + dim + ")", "transform": "scale(" + dim + ")" });
    });
    $("[data-skew]").each(function (i) {
        deg = $(this).attr("data-skew").split(",");
        dim = deg[0] + "deg," + deg[1] + "deg";
        $(this).css({ "-moz-transform": "skew(" + dim + ")", "-ms-transform": "skew(" + dim + ")", "-o-transform": "skew(" + dim + ")", "-webkit-transform": "skew(" + dim + ")", "transform": "skew(" + dim + ")" });
    });
    $("[data-transform]").each(function (i) {
        deg = $(this).attr("data-transform").split(",");
        dim = "scale(" + deg[0] + "," + deg[1] + ") skew(" + deg[2] + "deg," + deg[3] + "deg)  translate(" + deg[4] + "," + deg[5] + ") rotate(" + deg[6] + "deg)";
        $(this).css({ "-moz-transform": dim , "-ms-transform":  dim, "-o-transform":  dim , "-webkit-transform": dim , "transform": dim  });
    });




    //-ms-transform: translate(50px, 100px); /* IE 9 */
    //-webkit-transform: translate(50px, 100px); /* Safari */
    //transform: translate(50px, 100px);

    //--- hover ---------------
    $("[data-bgcolorhover]").hover(function () {
        color = $(this).attr("data-bgcolorhover");
        $(this).css({ "background-color": color });
    }, function () {
        if ($(this).attr("data-bgcolor"))
        { color = $(this).attr("data-bgcolor"); } else { color = "unset"; }
        $(this).css({ "background-color": color });
    });
    $("[data-colorhover]").hover(function () {
        color = $(this).attr("data-colorhover");
        $(this).css({ "color": color });
    }, function () {
        if ($(this).attr("data-color"))
        { color = $(this).attr("data-color"); } else { color = "unset"; }
        $(this).css({ "color": color });
    });

    $("[data-rotatehover]").hover(function () {
        deg = $(this).attr("data-rotatehover");
        $(this).css({ "-moz-transform": "rotate(" + deg + "deg)", "-ms-transform": "rotate(" + deg + "deg)", "-o-transform": "rotate(" + deg + "deg)", "-webkit-transform": "rotate(" + deg + "deg)", "transform": "rotate(" + deg + "deg)" });
    }, function () {
        if ($(this).attr("data-rotate"))
        { deg = $(this).attr("data-rotate"); } else { deg = 0; }
        $(this).css({ "-moz-transform": "rotate(" + deg + "deg)", "-ms-transform": "rotate(" + deg + "deg)", "-o-transform": "rotate(" + deg + "deg)", "-webkit-transform": "rotate(" + deg + "deg)", "transform": "rotate(" + deg + "deg)" });
    });
    $("[data-translatehover]").hover(function () {
        dim = $(this).attr("data-translatehover");
        $(this).css({ "-moz-transform": "translate(" + dim + ")", "-ms-transform": "translate(" + dim + ")", "-o-transform": "translate(" + dim + ")", "-webkit-transform": "translate(" + dim + ")", "transform": "translate(" + dim + ")" });
    }, function () {
        if ($(this).attr("data-translate"))
        { dim = $(this).attr("data-translate"); } else { dim = "0px,0px"; }
        $(this).css({ "-moz-transform": "translate(" + dim + ")", "-ms-transform": "translate(" + dim + ")", "-o-transform": "translate(" + dim + ")", "-webkit-transform": "translate(" + dim + ")", "transform": "translate(" + dim + ")" });
    });
    $("[data-scalehover]").hover(function () {
        dim = $(this).attr("data-scalehover");
        $(this).css({ "-moz-transform": "scale(" + dim + ")", "-ms-transform": "scale(" + dim + ")", "-o-transform": "scale(" + dim + ")", "-webkit-transform": "scale(" + dim + ")", "transform": "scale(" + dim + ")" });
    }, function () {
        if ($(this).attr("data-scale"))
        { dim = $(this).attr("data-scale"); } else { dim = "1,1"; }
        $(this).css({ "-moz-transform": "scale(" + dim + ")", "-ms-transform": "scale(" + dim + ")", "-o-transform": "scale(" + dim + ")", "-webkit-transform": "scale(" + dim + ")", "transform": "scale(" + dim + ")" });
    });
    $("[data-skewhover]").hover(function () {
        deg = $(this).attr("data-skewhover").split(",");
        dim = deg[0] + "deg," + deg[1] + "deg";
        $(this).css({ "-moz-transform": "skew(" + dim + ")", "-ms-transform": "skew(" + dim + ")", "-o-transform": "skew(" + dim + ")", "-webkit-transform": "skew(" + dim + ")", "transform": "skew(" + dim + ")" });
    }, function () {
        if ($(this).attr("data-skew"))
        { deg = $(this).attr("data-skew").split(","); dim = deg[0] + "deg," + deg[1] + "deg"; } else { dim = "0deg,0deg"; }
        $(this).css({ "-moz-transform": "skew(" + dim + ")", "-ms-transform": "skew(" + dim + ")", "-o-transform": "skew(" + dim + ")", "-webkit-transform": "skew(" + dim + ")", "transform": "skew(" + dim + ")" });
    });
    $("[data-transformhover]").hover(function () {
        deg = $(this).attr("data-transformhover").split(",");
        dim = "scale(" + deg[0] + "," + deg[1] + ") skew(" + deg[2] + "deg," + deg[3] + "deg)  translate(" + deg[4] + "," + deg[5] + ") rotate(" + deg[6] + "deg)";
        $(this).css({ "-moz-transform": dim, "-ms-transform": dim, "-o-transform": dim, "-webkit-transform": dim, "transform": dim });
    }, function () {
        if ($(this).attr("data-transform"))
        { deg = $(this).attr("data-transform").split(","); } else { deg = ["1", "1", "0", "0", "0px", "0px", "0"]; }
        dim = "scale(" + deg[0] + "," + deg[1] + ") skew(" + deg[2] + "deg," + deg[3] + "deg)  translate(" + deg[4] + "," + deg[5] + ") rotate(" + deg[6] + "deg)";
        $(this).css({ "-moz-transform": dim, "-ms-transform": dim, "-o-transform": dim, "-webkit-transform": dim, "transform": dim });
    });



    //--- click ---------------
    $("[data-position]").click(function () {
        var pos = $(this);
        //$(pos.attr("data-target")).animate({ "scrollTop": $(pos.attr("data-position")).offset().top }, { duration: 800, easing: "linear", complete: function () { } });
        $('html, body').animate({ "scrollTop": $(pos.attr("data-position")).offset().top }, { duration: 800, easing: "linear", complete: function () { } });

    });







    /*
  tem structuer and animations
  ================================================
  */
    //-lozenges
    //,.Hani-lozenges.lozenges-over.over-trans-trans.lozenges-slide>div:nth-child(3)>div
    $(".Hani-lozenges.lozenges-over.lozenges-slid>div:nth-child(3)>div,.Hani-lozenges.lozenges-slid>div:nth-child(1)>div,.Hani-lozenges.lozenges-back.lozenges-fade>div:nth-child(1)>div").each(function (i) {
        $(this).css({ "background-color": "rgb(" + hexok($(this).parent().parent().attr("data-boxcolor")) + ")" });
    });
    $(".Hani-lozenges>div:nth-child(1),.Hani-lozenges>div:nth-child(3)").each(function (i) {
        $(this).css({ "border-color": "rgb(" + hexok($(this).parent().attr("data-boxcolor")) + ")" });
    });
    $(".Hani-lozenges.lozenges-over.lozenges-fade>div:nth-child(3)>div").each(function (i) {
        $(this).css({ "background-color": "rgba(" + hexok($(this).parent().parent().attr("data-boxcolor")) + ",0.4)" });
    });
    $(".Hani-lozenges.lozenges-overtrans.lozenges-slid>div:nth-child(3)>div").each(function (i) {
        $(this).css({ "background-color": "rgba(" + hexok($(this).parent().parent().attr("data-boxcolor")) + ",0.4)" });
        //alert($(this).css("background-color"));
    });
    $(".Hani-lozenges.lozenges-back.lozenges-slid>div:nth-child(3)").hover(function () {
        $(this).parent().toggleClass("slidon");
    });
    $(".Hani-lozenges.lozenges-back.lozenges-fade>div:nth-child(3)").hover(function () {
        $(this).parent().toggleClass("fadeon");
    });



// /*
//   mwnu tem structuer and animations
//   ================================================
//     nav.slideup.Hnavbody > ul > li div, nav.slideup.Hnavaccess > ul > li div
//     menubrdc
//     wipebox
//     brdout
// */
//     $("[data-menubrdc]").each(function (i) {/// border color
//         $itm = $(this);
//         if ($itm.hasClass("slideup")) {
//             $itm.find("ul > li div").css({ "border-bottom-color": $itm.attr("data-menubrdc") });
//         }
//         if ($itm.hasClass("wipebox")) {
//             var style = "";
//             $itm.addClass("wipeboxmenubrdc" + i);
//             style += ".wipeboxmenubrdc" + i + " ul > li div::before{border-color:" + $itm.attr("data-menubrdc") + "!important;}"
//             style += ".wipeboxmenubrdc" + i + " ul > li:hover div::before{border-color:" + $itm.attr("data-menubrdc") + "!important;}"
//             $itm.parent().after("<style>" + style + "</style>");
//         }
//         if ($itm.hasClass("brdout")) {
//             var style = "";
//             $itm.addClass("brdoutmenubrdc" + i);
//             style += ".brdoutmenubrdc" + i + " ul > li div::after{border-color:" + $itm.attr("data-menubrdc") + "!important;}"
//             style += ".brdoutmenubrdc" + i + " ul > li:hover div::after{border-color:" + $itm.attr("data-menubrdc") + "!important;}"
//             $itm.parent().after("<style>" + style + "</style>");
//         }
//    });
//     $("[data-menubg]").each(function (i) { /// background color
//         $itm = $(this);
//         //if ($itm.hasClass("slideup")) {
//             $(".Hnavbar", this).css({ "background-color": $itm.attr("data-menubg") });
//             $(".Hmenubar", this).css({ "background-color": $itm.attr("data-menubg") });
//         //}
//     });
//     $("[data-menuc1]").each(function (i) {///  menu color
//         $itm = $(this);
//         if ($itm.hasClass("slideup")) {
//             //$itm.find("ul > li div").css({ "color": $itm.attr("data-menuc1") });
//             $(".Hnavbody > ul > li div", this).css({ "color": $itm.attr("data-menuc1") });
//             $(".Hmenubar div", this).css({ "background-color": $itm.attr("data-menuc1") });
//         }
//         if ($itm.hasClass("wipebox")) {
//             //$itm.find("ul > li div").css({ "color": $itm.attr("data-menuc1") });
//             $(".Hnavbody > ul > li div a", this).css({ "color": $itm.attr("data-menuc1") });
//             $(".Hmenubar div", this).css({ "background-color": $itm.attr("data-menuc1") });
//         }
//         if ($itm.hasClass("brdout")) {
//             //$itm.find("ul > li div").css({ "color": $itm.attr("data-menuc1") });
//             $(".Hnavbody > ul > li div a", this).css({ "color": $itm.attr("data-menuc1") });
//             $(".Hnavaccess > ul > li div a", this).css({ "color": $itm.attr("data-menuc1") });
//             $(".Hmenubar div", this).css({ "background-color": $itm.attr("data-menuc1") });
//         }
//     });

//     $("[data-menuch1]").each(function (i) { /// menu color hover
//         var style = "";
//         $itm = $(this);
//         if ($itm.hasClass("slideup")) {
//             $itm.attr("id", "slideupmenu" + i);
//             style += "#slideupmenu" + i + " ul > li:hover div{color:" + $itm.attr("data-menuch1") + "!important;}"
//             $itm.find("ul > li div").css({ "color": $itm.attr("data-menuc1") });
//         }
//         if ($itm.hasClass("wipebox")) {
//             $itm.addClass("wipeboxmenuch1" + i);
//             style += ".wipeboxmenuch1" + i + " ul > li:hover div a{color:" + $itm.attr("data-menuch1") + "!important;}"
//             $itm.find("ul > li div a").css({ "color": $itm.attr("data-menuc1") });
//         }
//         if ($itm.hasClass("brdout")) {
//             $itm.addClass("brdoutmenuch1" + i);
//             style += ".brdoutmenuch1" + i + " ul > li:hover div a{color:" + $itm.attr("data-menuch1") + "!important;}"
//             $itm.find("ul > li div a").css({ "color": $itm.attr("data-menuc1") });
//         }




//         $itm.parent().after("<style>" + style + "</style>");
//     });
//     // brdout
//     //data - menuc1="#fff" data- menuch1="#000"













// /*
//       functions
//       ================================================
//       */
//     //----------- menushow ---------------
//     function menushow() {
//         if ($("nav.classic .Hnavbar").parent().width() <= 879 & lastmenu == 0)
//             $(".Hnavbar").css("display", "none");
//         else
//             $(".Hnavbar").css("display", "block");
//         if ($("nav.classic .Hnavbar").parent().width() <= 879) {
//             $(".Hmenubar").css("display", "block");
//             $("nav").addClass("min");
//         }
//         else {
//             $(".Hmenubar").css("display", "none");
//             $("nav").removeClass("min");
//         }

//     }
//     //-------- page dividing ----------
//     function pagedividing(w) {
//         Hside = $(".Hpagedata").attr("data-html");
//         Wside = $(".Hpagedata").attr("data-container");
//         $(".Hheaderside").css("height", Hside + "px");
//         if (w < 991) {
//             $(".Hmenuside").css({ "width": Wside + "px", "top": Hside + "px", "height": "calc(100% - " + Hside + "px", "right": "-" + Wside + "px" });
//             $(".Hmenuside .Hbody").css({ "height": "100%"});
//             //$(".Hmenuside .Hmenu").css({ "margin-top": ($(".Hmenuside .Hbody").height() / 2 - 30) + "px", "display": "block" });
//             $(".Hmenuside .Hmenu").css({ "margin-top":"-"+ ($(".Hmenuside .Hbody").height() / 2 + 60) + "px", "display": "block" });
//             $(".Hbodyside").css({ "width": "100%" });
//         } else {
//             $(".Hmenuside").css({ "width": Wside + "px", "top": Hside + "px", "height": "calc(100% - " + Hside + "px", "right": "0px" })
//             $(".Hbodyside").css({ "width": "calc(100% - " + Wside + "px", "margin-top": Hside + "px" });
//             $(".Hmenuside .Hbody").css({ "height": "100%" });
//             $(".Hmenuside .Hmenu").css({ "display": "none" });
//         }
//     }






    /*
      nnnnnnnnnnnnnnnnn
     ================================================
     */

    $(".slider").children().eq(1).animate({ "margin-right": "60%" }, {
        duration: 1000, easing: "linear",
        complete: function () {
            $(".slider").children().eq(2).animate({ "margin-right": "10%" }, {
                duration: 1000, easing: "linear",
                complete: function () {
                    $(".slider").children().eq(3).animate({ "margin-top": "17%", "opacity": "1" }, {
                        duration: 1000, easing: "linear",
                        complete: function () {
                            $(".slider").children().eq(3).animate({ "opacity": "1" }, {
                                duration: 5000, complete: function () {
                                    $(".slider").children().eq(1).animate({ "opacity": "0" }, { duration: 1000, easing: "linear" });
                                    $(".slider").children().eq(2).animate({ "opacity": "0" }, { duration: 1000, easing: "linear" });
                                    $(".slider").children().eq(3).animate({ "opacity": "0" }, {
                                        duration: 1000, easing: "linear",
                                        complete: function () {
                                            $(".slider").children().eq(1).css({ "margin-right": "120%", "opacity": "1" });
                                            $(".slider").children().eq(2).css({ "margin-right": "-40%", "opacity": "1" });
                                            $(".slider").children().eq(3).css({ "margin-top": "20%" });
                                            $(".slider").children().eq(4).animate({ "margin-bottom": "15%" }, {
                                                duration: 500, easing: "linear",
                                                complete: function () {
                                                    $(".slider").children().eq(4).animate({ "Width": "25%", "margin-bottom": "18%" }, {
                                                        duration: 200, easing: "swing",
                                                        complete: function () {
                                                            $(".slider").children().eq(4).animate({ "Width": "30%", "margin-bottom": "15%" }, {
                                                                duration: 200, easing: "linear",
                                                                complete: function () {
                                                                    $(".slider").children().eq(5).css("opacity", "1");
                                                                    $(".slider").children().eq(4).animate({ "margin-bottom": "-2%" }, {
                                                                        duration: 500, easing: "linear",
                                                                        complete: function () {
                                                                            $(".slider").children().eq(6).animate({ "margin-right": "0%" }, {
                                                                                duration: 300, easing: "linear",
                                                                                complete: function () {



                                                                                }
                                                                            });



                                                                        }
                                                                    });



                                                                }
                                                            });



                                                        }
                                                    });

                                                }
                                            });
                                        }
                                    });
                                }
                            });




                            //$(".slider").children().eq(2).animate({ "margin-top": "17%", "opacity": "1" }, {
                            //    duration: 1000, easing: "linear",
                            //    complete: function () {



                            //    }
                            //});



                            //$(slidercontainer + " .dot").children().eq(sliderold).removeClass("active");
                            //$(slidercontainer + " .dot").children().eq(slidercurrent).addClass("active");
                            //$(slidercontainer + ' .carouselHTTPS').children().eq(1).html($(slidercontainer + ' .slides').children().eq(slidercurrent).html());
                            //$(slidercontainer + ' .carouselHTTPS').children().eq(1).css('marginLeft', '0%');
                            //sliderold = slidercurrent;
                            //slidercurrent++;
                            //if (slidercurrent >= sliderloop) { slidercurrent = 0; }
                            //$(slidercontainer + ' .carouselHTTPS').children().eq(0).html($(slidercontainer + ' .slides').children().eq(slidercurrent).html());
                        }
                    });
                }
            });

        }
    });

    function resizefix() {
        if (arguments.length == 0) {var wH = $(window).height(), wW = $(window).width(), wS = $(this).scrollTop();
            $(".fixwindows").css({ "padding-top": (((wH - 120) * 100) / wW) + "%" });
            //$(".hamburgermenu").css({ "height": wH + "px" });
        } else {

            $(".fixwindows").css({ "height": $(window).height() + "px" });
            //$(".hamburgermenu").css({ "height": wH + "px" });
        }
    }

    $('html, body').find(".hamburgermenu").html('<nav>' + $("nav").html() + '</nav>');

    $(".menubar1").click(function () {
        //$(".hamburgermenu").addClass("showmenu");
        if ($(this).css("top") == "130px") {
            $(this).animate({ top: "5px", "margin-right": "80%" }, {
                duration: 400, easing: "swing",
            });
            $(".mainbody").animate({ "margin-left": "-80%" }, {
                duration: 400, easing: "swing",
            });
            $(".hamburgermenu").animate({ "margin-right": "0%" }, {
                duration: 400, easing: "swing",
            });
            document.body.style.overflow = 'hidden';

        } else {
            $(this).animate({ top: "130px", "margin-right": "0%" }, {
                duration: 400, easing: "swing",
            });
            $(".hamburgermenu").animate({ "margin-right": "-80%" }, {
                duration: 400, easing: "swing",
            });
            $(".mainbody").animate({ "margin-left": "0%" }, {
                duration: 400, easing: "swing",
            });
            document.body.style.overflow = 'visible';
        }


    });



    //document.body.style.overflow = 'visible';

//     $(".hamburgermenu nav ul li span.glyphicon-plus").click(function () {
//         if ($(this).parent().children().eq(2).css("display") == "none") {
//             $(this).parent().children().eq(2).css("display", "block");
//             // $(this).removeClass("glyphicon-plus");
//             $(this).addClass("glyphicon-minus");
//         } else {
//             $(this).parent().children().eq(2).css("display", "none");
//             $(this).removeClass("glyphicon-minus");
//         }
//     });
//     $(".hamburgermenu nav ul li span.glyphicon-minus").click(function () {
//         $(this).parent().children().eq(2).css("display", "none");
//         $(this).removeClass("glyphicon-minus");
//         $(this).addClass("glyphicon-plus");
//     });




    $(".goclick").click(function () {
        x = $(this).attr("data-container");
        x = (x * 1) + $('#' + $(this).attr("data-id")).parent().parent().offset().top;
        $('html, body').animate({ "scrollTop": x }, {
            duration: 800, easing: "linear",
            complete: function () {
            }
        });
    });






    //$(".fixgoup").click(function () {
    //       var  wW = $(window).width(),
    //        wS = $(window).scrollTop();
    //       $('html, body').animate({ "scrollTop": $("#mainnav").offset().top }, {
    //           duration: 800, easing: "linear",
    //           complete: function () {
    //           }
    //       });

    //});

    /*
    set all
    ================================================
    */
    $(".Hani-lozenges").each(function (i) {
        $(this).height($(this).width());
        //alert($(this).width())
        //alert($(this).height())
        //alert($(this).children().eq(0).width())
        //alert($(this).children().eq(0).height())
    });
    /*
     On menu clasic responsive
     ================================================
     */
    $(".Hdropdown>a").click(function () {
        // $(this).next().next().css("display", "block");
        $(this).next().next().toggle();
    });
    $(".Hdropdown_sub>a").click(function () {
        $(this).next().toggle();
    });
    // $("nav.classic .Hmenubar").click(function () {
    //     //$(this).toggleClass("off");
    //     if (lastmenu > 0)
    //         lastmenu = 0;
    //     else
    //         lastmenu = 1
    //     $(this).toggleClass("onclassic");
    //     $(this).next().toggle();

    // });

    $(".Hmenuside .Hmenu").click(function () {
        if ($(this).parent().css("right") == "0px") {
            $(this).parent().css("right", "-" + $(".Hpagedata").attr("data-container") + "px");
            $(this).html("&#x226B;")
        }else {
            $(this).parent().css("right", "0px");
            $(this).html("&#x226A;")
        }
        });


    /*
     On scroll animations
     ================================================
     */


    var winheight = $(window).height();
    var fullheight = $(document).height();
    animate_elems('Hani-startup');
    animate_elems('Hani-startin');
    animate_elems('Hani-startIn');
    animate_elems('Hani-spinwipe');
    animate_elems('Hani-spin-rev');
    animate_elems('Hani-spin-rev-startIn');
    animate_elems('Hani-spinwipeREV');

    $(window).scroll(function () {
        animate_elems("Hani-startup");
        animate_elems("Hani-startin");
        animate_elems('Hani-startIn');
        animate_elems('Hani-spinwipe');
        animate_elems('Hani-spin-rev');
        animate_elems('Hani-spin-rev-startIn');
        animate_elems('Hani-spinwipeREV');
    });

    function animate_elems(itm) {
        $item = $('.' + itm);
        wintop = $(window).scrollTop(); // calculate distance from top of window

        // loop through each item to check when it animates
        $item.each(function () {

            $elm = $(this);
            if ($elm.hasClass(itm + 'fix')) { return true; } // if already animated skip to the next item

            topcoords = $elm.offset().top; // element's distance from top of page in pixels

            if (wintop > (topcoords - (winheight * .95))) {
                // animate when top of the window is 3/4 above the element
                $elm.addClass(itm + 'fix');
            }

        });

    } // end animate_elems()


    /*
      code color tracer
      ================================================
      */

    //$(".Hheaderside").click(function () {
    //    var H = $(".Hheaderside").attr("data-html");
    //    var W = $(".Hheaderside").attr("data-container");
    //    $(".Hheaderside").css("height",H+"px");
    //    $(".Hmenuside").css("height","calc(100% - "+W+"px)").css("top",h+"px");
    //    $(".Hbodyside").css("width","calc(100% - "+W+"px").css("margin-top",H+"px")

    //});





    /*
  code color tracer
  ================================================
  */

    //$(".slider").children().eq(6).animate({ "margin-right": "0%" }, {
    //    duration: 300, easing: "linear",
    //    complete: function () {



    //    }
    //});



    /*
  modal
  ================================================
  */
    //data-selector="#mymod" data-target="Hmodal"
    $("[data-target='Hmodal']").click(function () {
        $("body").css("overflow", "hidden");
        $($(this).attr("data-selector")).css("display", "block");
        $($(this).attr("data-selector")).children().eq(0).addClass("start");
        $($(this).attr("data-selector")).children().eq(0).animate({ "margin-top": "40" }, {
            duration: 350, easing: "linear",
            complete: function () {
            }
        });
    });

    $(".Hmodal").click(function (event) {
        event.stopPropagation();
        var c=event.target.className;
        if(c=="Hmodal" || c=="close"){
            var x = $(this);
            x.children().eq(0).animate({ "margin-top": "-300" }, {
                duration: 350, easing: "linear",
                complete: function () {
                    x.css("display", "none");
                    $("body").css("overflow", "auto");
                }
            });
            $(this).children().eq(0).removeClass("start");
        }

    });

    // $(".Hmodal .close").click(function () {
    //     var x = $(this);
    //     x.children().eq(0).animate({ "margin-top": "-300" }, {
    //         duration: 350, easing: "linear",
    //         complete: function () {
    //             x.css("display", "none");
    //             $("body").css("overflow", "auto");
    //         }
    //     });
    //     $(this).children().eq(0).removeClass("start");
    // });






   /*
  botton color hover maker
  ================================================
  */

    //$(".Hbtn").each(function (i) {
    //    $(this).css({  "color": $(this).attr("data-color") });
    //});
    //$(".Hbtn").each(function (i) {
    //    $(this).css({ "background-color": $(this).attr("data-background"), "color": $(this).attr("data-color") });
    //});



    $(".HbtnNorm").hover(function () {
        $(this).css({ "background-color": $(this).attr("data-backhover"), "color": $(this).attr("data-colorhover") });
    }, function () {
        $(this).css({ "background-color": $(this).attr("data-bgcolor"), "color": $(this).attr("data-color") });
    });
    $(".HbtnRev").hover(function () {
        $(this).css({ "background-color": $(this).attr("data-backhover"), "color": $(this).attr("data-colorhover"), "border": "2px solid " + $(this).attr("data-bgcolor"), "padding": "8px 28px" });
    }, function () {
        $(this).css({ "background-color": $(this).attr("data-bgcolor"), "color": $(this).attr("data-color"), "border": "none", "padding": "10px 30px" });
    });
    /*
    hexa color to rgb
    ===============================================
    */
    function hexok(itm) {
        if(itm.substr(0, 1)=="#")
        return hex2rgb(itm);
    else
            return itm;
    }

    function hex2rgb(itm) {
        hex = Array("0", "1", "2", "3", "4", "5", "6", "6", "8", "9", "A", "B", "C", "D", "E", "F");
        str = "";
        for (i = 1; i < 6; i += 2) {
            s = itm.substr(i, 2);
            x = hex.indexOf(s.substr(0, 1).toUpperCase());
            y = hex.indexOf(s.substr(1, 1).toUpperCase());
            if (i > 1)
                str += ",";
            str += (x * 16 + y * 1);
        }
        return str;
    }


    /*   form activity
        ================================================
        */
    $(".Hform input[type=range]").change(function () {
        $itm = $(this);
        $itm.next().text($itm.val());
        $("#rang1::before").css("width", "500px");

        $("#rang1").addClass("sx");
        //$(".Hform input[type=range]::before").css("width", $itm.width() * ($itm.val() - $itm.attr("min")) / ($itm.attr("max") - $itm.attr("min")) + "px");


       // alert($itm.width() * ($itm.val() - $itm.attr("min")) / ($itm.attr("max") - $itm.attr("min")));
        //alert($(this).attr("min"));
        //alert($(this).attr("max"));
        ////$(this).css("border-bottom-color", "rgba(" + hexok($(this).parent().parent().attr("data-brd")) + ",0.4)");
        ////$(this).prev().css("color", "rgba(" + hexok($(this).parent().parent().attr("data-lesscolor")) + ",0.4)");
    });

    /*
    form border less
    ================================================
    */
    $(".Hbrdless input[type=text],.Hbrdless textarea,.Hbrdless select").each(function (i) {
        //alert(hexok($(this).parent().attr("data-brd")));
        ////$(this).css("border-bottom-color", "rgba(" + hexok($(this).parent().parent().attr("data-brd")) + ",0.4)");
        ////$(this).prev().css("color", "rgba(" + hexok($(this).parent().parent().attr("data-lesscolor")) + ",0.4)");
    });
    $(".Hbrdless input[type=checkbox] + label").each(function (i) {
        //alert(hexok($(this).parent().attr("data-brd")));
        //alert($(this).parent().html());
        ////$(this).css("border-bottom-color", "rgba(" + hexok($(this).parent().parent().attr("data-brd")) + ",0.4)");
        //$(this).prev().css("color", "rgba(" + hexok($(this).parent().parent().attr("data-lesscolor")) + ",0.4)");
    });
    $(".Hbrdless input[type=text],.Hbrdless textarea,.Hbrdless select").focus(function () {
        ////$(this).css("border-bottom-color", "rgba(" + hexok($(this).parent().parent().attr("data-brd")) + ",1)");
        ////$(this).prev().css("color", "rgba(" + hexok($(this).parent().parent().attr("data-lesscolor")) + ",1)");
        $(this).prev().addClass("on");
    });
    $(".Hbrdless input[type=text].focused,.Hbrdless textarea.focused,.Hbrdless select.focused").each(function (i) {
        $(this).prev().addClass("on");
    });
    $(".Hbrdless input[type=text],.Hbrdless textarea,.Hbrdless select").blur(function () {
        //$(this).css("border-bottom-color", "rgba(" + hexok($(this).parent().parent().attr("data-brd")) + ",0.4)");
        if ($(this).val() == "") {
            $(this).prev().removeClass("on");
            //$(".Hbrdless input:empty").prev().removeClass("on");
            //$(this).prev().css("color", "rgba(" + hexok($(this).parent().parent().attr("data-lesscolor")) + ",0.4)");
        }
    });
    //$(".Hbrdless input").hover(function () {
    //    $(this).prev().addClass("on");
    //});
   // $(".Hbrdless input:empty").prev().removeClass("on");


    /*
        cadr color
    ================================================
    */
    $(".Hbrd").each(function (i) {
        $(this).css("border-color", $(this).attr("data-brd"));
    });





    /*
     tab navigation
     ================================================
     */
    //   $(".Htab-nav-up div div:first-child").css('color', 'red');
    function starttab() {
        sel = $(".Htab-nav-up div:nth-child(1) div.active").index();
        if (sel > -1)
            tabactive(sel);
        else
            tabactive(0);
    }
    function tabactive(sel) {
        $(".Htab-nav-up div:nth-child(1) div").eq(sel).addClass("active");
        $(".Htab-nav-up div:nth-child(2) div").eq(sel).css('display', 'block');
    }
    function tabdeactive(sel) {
        $(".Htab-nav-up div:nth-child(1) div").eq(sel).removeClass("active");
        $(".Htab-nav-up div:nth-child(2) div").eq(sel).css('display', 'none');
    }

    // alert($(".Htab-nav-up div:nth-child(1) div.active").index());
    $(".Htab-nav-up div div").click(function () {
        sel = $(".Htab-nav-up div:nth-child(1) div.active").index();
        tabdeactive(sel);
        sel = $(this).index();
        tabactive(sel);
        //$(".Htab-nav-up div:nth-child(1) div").eq(sel).css('color', '#fff');
        //$(".Htab-nav-up div:nth-child(1) div").eq(sel).css('background', '#fff');
        //$(".Htab-nav-up div:nth-child(2) div").eq(sel).css('color', '#fff');
        //$(".Htab-nav-up div:nth-child(2) div").eq(sel).css('display', 'block');
    });
    $(".Htab-nav-up div div p").eq(0).css('color', 'red');
    $(".Htab-nav-up div div").eq(0).css('color', 'red');
    $(".Htab-nav-up div div").eq(0).css('color', 'red');
    $(".Htab-nav-up div div").eq(0).css('color', 'red');
    $("#menucontent div.sub").click(function () {
       idsub = $(this).children().eq(0).attr("data-content");
       $('#' + idsub + 'sub').css('display', 'block');
       $('#menusub').css('display', 'block');
       setTimeout(showsub, 300);
       //$('#menusub').css('-moz-transform', 'rotate(5deg)');
       //$('#menusub').css('-webkit-transform', 'rotate(5deg)');
       //$('#menusub').css('-o-transform', 'rotate(5deg)');
    });


   //$("[data-width]").width($(this).attr("data-width"));
    //$(".Hbtn").css({ "background-color": $(this).attr("data-background"), "color": $(this).attr("data-color") });


    $(".Hbtn").click(function () {
      // alert($(this).attr("data-background"));
      // alert($(this).attr("data-color"));
    });

    /*
    startup js
    */

   //alert("cccccccccc");



   $(".HtabNavfixUp >div:nth-child(1) div").click(function(){
    const ind=$(this).parent().find("div.active").index();
    if(ind>-1){
        $(this).parent().children().eq(ind).removeClass("active");
        $(this).parent().next().children().eq(ind).css({"display":"none"});
    }
    $(this).addClass("active");
        $(this).parent().next().children().eq($(this).index()).css({"display":"block"});
});
$(".HtabNavfixUp >div:nth-child(1) .active").each(function(){$(this).parent().next().children().eq($(this).index()).css({"display":"block"});});



$(".HcolorPollet input").each(function(){
    $(this).prev().css({"background":$(this).attr("value")});

});
$(".HcolorPollet>div:last-child").click(function(){
    $(this).prev().children("input").trigger("click");

});
$(".HcolorPollet input").change(function(){
    $(this).parent().next().children(".showcolor").css({"background-color":$(this).val()});

});





//-------------------------------------Hcheck-group
        // to run this fucntion the fucn that be diclerd must be out of document.ready
        function HcallFunc(func){
            var fname=func.substring(0,func.indexOf('('));
            var fargs=func.substring(func.indexOf('(')+1,func.lastIndexOf(')'));
            fargs=fargs.split(',');
            window.target=fname;
            window[fname].apply(this, fargs);
        }
        
        
     
            
        function HcheckState(chs){
            var all=$("."+chs).length;
            var checked=$("."+chs+" input[type=checkbox]:checked").length;
            var res=(0<checked && checked<all)?"−":(checked==all)?"✔":"";
            return res;
        }
        
        function HsetChanges(obj,val){
            obj.find(".checkmark").eq(0).attr('data-txt',val);
            (val!="")?obj.find("input[type=checkbox]").eq(0).prop("checked",true):obj.find("input[type=checkbox]").eq(0).prop("checked",false);
            
        }
        
        $(".Hcheck-group").each(function(){
            var chb_class=$(this).attr("group-class");
            var parent=$(this);
            var callback=$(this).attr("data-function");
            $(document).on("change","."+chb_class,function(){
                HsetChanges(parent,HcheckState(chb_class));
                (callback)?HcallFunc(callback):"";
            });
            
        });
        
        $(document).on("change",".Hcheck-group",function(){
            var chb_class=$(this).attr("group-class");
            var callback=$(this).attr("data-function");
      
            
            if($(this).find("input[type=checkbox]").is(":checked")){
                $(this).find(".checkmark").eq(0).attr('data-txt',"✔");
                $("."+chb_class).each(function(){
                    $(this).find("input[type=checkbox]").eq(0).prop("checked",true);
                });
            }else{
                $("."+chb_class).each(function(){
                    $(this).find("input[type=checkbox]").eq(0).prop("checked",false);
                });
            }
            
            (callback)?HcallFunc(callback):"";
        });



//----------------------------------HEcmbox

$('.HEcmbox').each(function(){


	if($(this).attr("HEcmb-back")!==undefined){
		$(this).css({"background-image":"url('"+$(this).attr("HEcmb-back")+"')"});
	}
	if ($(this).attr("HEcmb-padd")!==undefined){//alert(typeof $(this).attr("HEcmb-padd"));alert($(this).attr("HEcmb-padd"));
		$(this).children().eq(0).css({"padding":$(this).attr("HEcmb-padd")});
	}
});
$('.HEcmbox .HEcmb_ops span').each(async function(){
	if($(this).attr("selected")!==undefined){
		await HEcmboxspanclicker($(this),"ali");
	}
});


$('html').click(async function(evt){       // this func is for change the display of menu-btn to none if user click anywhere else of menu-btn  
//////////////////

    if($(evt.target).closest('.HEcmbox .HEcmb_head').length){
        var state=$(evt.target).attr("class");
		await HEcmboxClear();
        if(state=="HEcmb_head headup"){
                $(evt.target).removeClass("headup").addClass("headdown").next().css({"display":"none"}).parent().css({"z-index":"5"});
        }else{
                $(evt.target).removeClass("headdown").addClass("headup").next().css({"display":"block"}).parent().css({"z-index":"200"});
        }
		return false;
	}
    if($(evt.target).closest('.HEcmbox .HEcmb_ops span').length){
//	var xx=event.target.nodeName;
		var target=$(evt.target);
		if(event.target.nodeName!=="SPAN"){
			target=$(evt.target).closest(".cmbspan");
		}
        target.parent().prev().removeClass("headup").addClass("headdown");
        target.parent().css({"display":"none"}).parent().css({"z-index":"5"});
		HEcmboxspanclicker(target,"disabled");
		return false;
	}
//     if($(evt.target).closest('#Hnotification .Hnotipmbtn').length){
//         // $(this).parent().animate({opacity: '0'}, "slow");
//         // //$(this).parent().attr("visibility","hidden");
//         // $(this).parent().animate({height: '0px',margin:'0px',padding: '0px'});
//         // $(this).parent().attr("display","none");

// 		return false;
// 	}
	
	HEcmboxClear();
});




function HEcmboxspanclicker(item,dis){
    if(item.attr('disabled')!=dis){
        if(item.attr("value")===undefined){
            item.parent().prev().html(item.html()).attr("value",item.html());
        }else{
            item.parent().prev().html(item.html()).attr("value",item.attr("value"));
        }
        var c=item.parent().prev();
        var call=c.attr("callback");
        
        window[call](c);
    }
    
    
    
}
function HEcmboxClear(){
     $(".HEcmbox .HEcmb_ops").each(function(){
     $(this).css({display:"none"});
     $(this).prev().attr("class","HEcmb_head headdown");
     $(this).parent().css({"z-index":"5"});
     });
}






























$('html').click(async function(evt){       // this func is for change the display of menu-btn to none if user click anywhere else of menu-btn  
//////////////////

    if($(evt.target).closest('.smallpaging .sp_head').length){
        var state=$(evt.target).attr("class");
		await spClear();
        if(state=="sp_head headup"){
                $(evt.target).removeClass("headup").addClass("headdown").next().css({"display":"none"}).parent().css({"z-index":"5"});
        }else{
                $(evt.target).removeClass("headdown").addClass("headup").next().css({"display":"block"}).parent().css({"z-index":"200"});
        }
		return false;
	}
    if($(evt.target).closest('.smallpaging .sp_ops span').length){

		var target=$(evt.target);
		if(event.target.nodeName!=="SPAN"){
			target=$(evt.target).closest(".cmbspan2");
		}
        target.parent().prev().removeClass("headup").addClass("headdown");
        target.parent().css({"display":"none"}).parent().css({"z-index":"5"});
		return false;
	}
	spClear();
});

function spClear(){
     $(".smallpaging .sp_ops").each(function(){
     $(this).css({display:"none"});
     $(this).prev().attr("class","sp_head headdown");
     $(this).parent().css({"z-index":"5"});
     });
}



});







// function Hnoticlose(item){
//     alert(";;;;");
//     //alert($(item).parent().html());
// }


/*
  menu
  ================================================
  */
var lastmenu = 0;

// function HEcmboxbackcall(item,callback){alert(item);callback(item);alert(",,,,,,,,");}



//alert("e4r5r455t");

