﻿function LoadPic(PageName) {
    var Temp = PageName.toString().split('/');
    var CurentPageName = Temp[Temp.length - 2] + "/" + Temp[Temp.length - 1];
    if (CurentPageName == 'masterpage/default.aspx')
        document.getElementById('BasicMenuTitle').style.background = 'url(http://www.payamelectronic.com/module/images/basicmenutitle-1.gif)';
    else
        document.getElementById('BasicMenuTitle').style.background = 'url()';
    if (CurentPageName == 'aboutcompany/default.aspx') {
        document.getElementById('AboutUs').style.background = 'url(http://www.payamelectronic.com/module/images/tracklist-1.gif)';
        document.getElementById('MasterTable').style.background = 'url(http://www.payamelectronic.com/module/images/aboutusdescription.jpg)';
        document.getElementById('MasterTable').style.backgroundRepeat = 'no-repeat';
        document.getElementById('MasterTable').style.backgroundPosition = 'left bottom';
    }
    else
        document.getElementById('AboutUs').style.background = 'url()';
    if (CurentPageName == 'productinstruction/default.aspx')
        document.getElementById('ProductOrder').style.background = 'url(http://www.payamelectronic.com/module/images/tracklist-1.gif)';
    else
        document.getElementById('ProductOrder').style.background = 'url()';
    if (CurentPageName == 'dablist/default.aspx')
        document.getElementById('TrackList').style.background = 'url(http://www.payamelectronic.com/module/images/tracklist-1.gif)';
    else
        document.getElementById('TrackList').style.background = 'url()';
    if (CurentPageName == 'attendance/default.aspx') {
        document.getElementById('Service').style.background = 'url(http://www.payamelectronic.com/module/images/tracklist-1.gif)';
        document.getElementById('MasterTable').style.background = 'url(http://www.payamelectronic.com/module/images/servicedescription.jpg)';
        document.getElementById('MasterTable').style.backgroundRepeat = 'no-repeat';
        document.getElementById('MasterTable').style.backgroundPosition = 'left bottom';
    }
    else
        document.getElementById('Service').style.background = 'url()';
    if (CurentPageName == 'chartsite/default.aspx')
        document.getElementById('SiteMap').style.background = 'url(http://www.payamelectronic.com/module/images/tracklist-1.gif)';
    else
        document.getElementById('SiteMap').style.background = 'url()';
    if (CurentPageName == 'communication/default.aspx') {
        document.getElementById('ContactUs').style.background = 'url(http://www.payamelectronic.com/module/images/contactus-1.gif)';
        document.getElementById('MasterTable').style.background = 'url(http://www.payamelectronic.com/module/images/contactusdescription.jpg)';
        document.getElementById('MasterTable').style.backgroundRepeat = 'no-repeat';
        document.getElementById('MasterTable').style.backgroundPosition = 'left bottom';
    }
    else
        document.getElementById('ContactUs').style.background = 'url()';

    if (CurentPageName == 'SpecificSale/default.aspx') {
        document.getElementById('MasterTable').style.background = 'url(http://www.payamelectronic.com/module/images/SpecificSale.jpg)';
        document.getElementById('MasterTable').style.backgroundRepeat = 'no-repeat';
        document.getElementById('MasterTable').style.backgroundPosition = 'left bottom';
    }
}
function DisplayNode(NodeName) {
    if (document.getElementById("Div" + NodeName.toString()).style.display == 'none') {
        document.getElementById("Div" + NodeName.toString()).style.display = 'block';
        MinusNode(NodeName);
    }
    else
        HideNode(NodeName);
}
function HideNode(NodeName) {
    document.getElementById("Div" + NodeName.toString()).style.display = 'none';
    PlusNode(NodeName);
}
function MinusNode(ImgName) {
    document.getElementById("Img" + ImgName).src = 'http://www.payamelectronic.com/Module/Images/TreeLineImages/lminusen.gif';
    document.getElementById("ImgF" + ImgName).src = 'http://www.payamelectronic.com/Module/Images/Open.gif';
}
function PlusNode(ImgName) {
    document.getElementById("Img" + ImgName).src = 'http://www.payamelectronic.com/Module/Images/TreeLineImages/lplusen.gif';
    document.getElementById("ImgF" + ImgName).src = 'http://www.payamelectronic.com/Module/Images/Close.gif';
}
function User_AccountSaveInfo() {
    if (document.getElementById('Name').value == null || document.getElementById('Name').value == '') {
        alert('Please Enter Your Name');
        document.getElementById('Name').focus();
        return
    }
    if (document.getElementById('Family').value == null || document.getElementById('Family').value == '') {
        alert('please Enter Your Family');
        document.getElementById('Family').focus();
        return
    }
    var Temp = document.getElementById('Email').value.split('@');
    if (Temp[1] == null || Temp[1] == '') {
        alert('Please Enter You Email Address On Example@WebSite.Domain Format ');
        document.getElementById('Email').focus();
        return;
    }
    var Temp1 = Temp[1].split('.');
    if (Temp1[1] == null || Temp1[1] == '') {
        alert(' Please Enter You Email Address On Example@WebSite.Domain Format ');
        document.getElementById('Email').focus();
        return;
    }
    if (document.getElementById('UserName').value == null || document.getElementById('UserName').value == '') {
        alert('Please Enter User Name');
        document.getElementById('UserName').focus();
        return
    }
    if (document.getElementById('Password').value == null || document.getElementById('Password').value == '') {
        alert('Please Enter Password');
        document.getElementById('Password').focus();
        return
    }
    if (document.getElementById('ConfirmedPass').value == null || document.getElementById('ConfirmedPass').value == '') {
        alert('Please Enter Confirmed Password');
        document.getElementById('ConfirmedPass').focus();
        return
    }
    if (document.getElementById('ConfirmedPass').value == document.getElementById('Password').value) {
        document.getElementById('f1').submit();
    }
    else {
        alert('Password And Confirmed Password Not Equal Together');
        document.getElementById('ConfirmedPass').focus();
    }
}
function key_press(e) {
    if (window.event) // IE
    {
        keynum = e.keyCode;
    }
    else if (e.which) // Netscape/Firefox/Opera
    {
        keynum = e.which;
    }
    if ((keynum < 48 ||
            keynum > 57) && (keynum != 8))
        return false;
}
function InterUserSendInfo() {
    if (document.getElementById('UserName').value == null || document.getElementById('UserName').value == '') {
        alert('لطفا نام کاربری را وارد کنید');
        document.getElementById('UserName').focus();
        return
    }
    if (document.getElementById('Password').value == null || document.getElementById('Password').value == '') {
        alert('لطفا رمز ورود را وارد کنید');
        document.getElementById('Password').focus();
        return
    }
    document.getElementById('f1').submit();
}

function InterUserSendInfoEn() {
    if (document.getElementById('UserName').value == null || document.getElementById('UserName').value == '') {
        alert('Please enter User Name');
        document.getElementById('UserName').focus();
        return
    }
    if (document.getElementById('Password').value == null || document.getElementById('Password').value == '') {
        alert('Please enter password');
        document.getElementById('Password').focus();
        return
    }
    document.getElementById('f1').submit();
}
//**********************************************************************************************************************************

function SaveProductInfo() {
    if (document.getElementById('Title').value == null || document.getElementById('Title').value == '') {
        alert('لطفا عنوان محصول را وارد کنید');
        document.getElementById('Title').focus();
        return
    }
    if (document.getElementById('TitleEn').value == null || document.getElementById('TitleEn').value == '') {
        alert('لطفا عنوان محصول انگلیسی را وارد کنید');
        document.getElementById('TitleEn').focus();
        return
    }
    if (document.getElementById('Group').value == null || document.getElementById('Group').value == '') {
        alert('لطفا گروه محصول را انتخواب کنید');
        document.getElementById('Group').focus();
        return
    }
    if (tinyMCE.getContent(tinyMCE.getEditorId('DescriptionProduct')) == '' || tinyMCE.getContent(tinyMCE.getEditorId('DescriptionProduct')) == null) {
        alert('لطفا توضیحات محصول را وارد کنید');
        document.getElementById('DescriptionProduct').focus();
        return
    }

    if (tinyMCE.getContent(tinyMCE.getEditorId('DescriptionProductEn')) == '' || tinyMCE.getContent(tinyMCE.getEditorId('DescriptionProductEn')) == null) {
        alert('لطفا توضیحات محصول انگلیسی را وارد کنید');
        document.getElementById('DescriptionProductEn').focus();
        return
    }

    if (document.getElementById('Key1').value == null || document.getElementById('Key1').value == '') {
        alert('لطفا کلمات کلیدی محصول را وارد کنید');
        document.getElementById('Key1').focus();
        return
    }
    if (document.getElementById('Key1En').value == null || document.getElementById('Key1En').value == '') {
        alert('لطفا کلمات کلیدی محصول انگلیسی را وارد کنید');
        document.getElementById('Key1En').focus();
        return
    }
    if (document.getElementById('Description').value == null || document.getElementById('Description').value == '') {
        alert('لطفا توضیحات محصول را وارد کنید');
        document.getElementById('Description').focus();
        return
    }
    if (document.getElementById('DescriptionEn').value == null || document.getElementById('DescriptionEn').value == '') {
        alert('لطفا توضیحات محصول انگلیسی را وارد کنید');
        document.getElementById('DescriptionEn').focus();
        return
    }
    if (document.getElementById("Action").value != "Update")
        document.getElementById("Action").value = "Save";
    else
        document.getElementById("Action").value = "Update";
    document.getElementById("f1").submit();
}
var DeleteId = '';
function CheckClick(check, Id) {
    var ReplaceString = "^" + Id;
    if (check.checked)
        DeleteId += ReplaceString;
    else
        DeleteId = DeleteId.replace(ReplaceString, "");
}
function Delete() {
    if (DeleteId != null && DeleteId != '') {
        DeleteId = DeleteId.replace("^", "");
        document.getElementById("Action").value = "Delete";
        document.getElementById("DeleteId").value = DeleteId.toString();
        document.getElementById("f1").submit();
    }
}
function EmailCheacked() {
    if (DeleteId != null && DeleteId != '') {
        DeleteId = DeleteId.replace("^", "");
        document.getElementById("Action").value = "SendMail";
        document.getElementById("DeleteId").value = DeleteId.toString();
        document.getElementById("f1").submit();
    }
}
function Edit(Id, Title, Key, Description, ProductId, FileName, DescriptionProduct, IsNew, ShowProduct, Title1, FileShow, TitleEn, DescriptionEn, DescriptionProductEn, Key1En, Title1En) {
    document.getElementById('TitleEn').value = TitleEn;
    document.getElementById('DescriptionEn').value = DescriptionEn;
    document.getElementById('Key1En').value = Key1En;
    document.getElementById('Title1En').value = Title1En;

    var Temp = DescriptionProductEn.split('~');
    var Temp2 = '';
    var i = 0;
    for (i; i < Temp.length; i++) {
        if (i < Temp.length - 1)
            Temp2 += Temp[i] + "'";
        else if (Temp[i])
            Temp2 += Temp[i];
    }
    tinyMCE.execInstanceCommand("DescriptionProductEn", "mceFocus");
    tinyMCE.setContent(Temp2);

    document.getElementById('Title1').value = Title1;
    document.getElementById('ProductId').value = Id;
    document.getElementById('Title').value = Title;
    document.getElementById('Key1').value = Key;
    document.getElementById('Description').value = Description;
    document.getElementById('Group').value = ProductId;

    Temp = DescriptionProduct.split('~');
    Temp2 = '';
    i = 0;
    for (i; i < Temp.length; i++) {
        if (i < Temp.length - 1)
            Temp2 += Temp[i] + "'";
        else if (Temp[i])
            Temp2 += Temp[i];
    }
    tinyMCE.execInstanceCommand("DescriptionProduct", "mceFocus");
    tinyMCE.setContent(Temp2);

    if (FileShow == '1')
        document.getElementById('FileShow').checked = true;
    else
        document.getElementById('FileShow').checked = false;

    if (ShowProduct == '1')
        document.getElementById('ShowProduct').checked = true;
    else
        document.getElementById('ShowProduct').checked = false;

    if (IsNew == '1')
        document.getElementById('IsNew').checked = true;
    else
        document.getElementById('IsNew').checked = false;
    if (FileName != null && FileName != '') {
        document.getElementById('DivViewPicFile').className = 'DisplayElement';
        document.getElementById('ViewPicFile').src = 'http://www.payamelectronic.com/Module/images/' + FileName;
    }
    document.getElementById('Action').value = 'Update';
}
//***************************************************************************************************
//ProductOrder.Aspx
function ProductOrder(Src) {
    if (document.getElementById('NameFamily').value == null || document.getElementById('NameFamily').value == '') {
        alert('لطفا نام و نام خانوادگی را وارد کنید');
        document.getElementById('NameFamily').focus();
        return
    }
    if (document.getElementById('City').value == null || document.getElementById('City').value == '') {
        alert('لطفا شهر مورد نظر را وارد کنید');
        document.getElementById('City').focus();
        return
    }
    if (document.getElementById('ProductType').value == null || document.getElementById('ProductType').value == '') {
        alert('لطفا نوع محصول مورد نظر را وارد کنید');
        document.getElementById('ProductType').focus();
        return
    }
    /*if (document.getElementById('Count').value == null || document.getElementById('Count').value == '')
    {
    alert('لطفا تعداد محصول مورد نظر را وارد کنید');
    document.getElementById('Count').focus();
    return
    }
    if (ValidateDate(document.getElementById('Year').value,document.getElementById('Month').value,document.getElementById('Day').value) == false)
    {
    return;
    }*/
    if ((document.getElementById('Tel').value == null || document.getElementById('Tel').value == '') && (document.getElementById('Mobile').value == null || document.getElementById('Mobile').value == '')) {
        alert('لطفا شماره تلفن یا همراه خود را وارد کنید');
        document.getElementById('Tel').focus();
        return;
    }
    if (document.getElementById('Address').value == null || document.getElementById('Address').value == '') {
        alert('لطفا آدرس را وارد کنید');
        document.getElementById('Address').focus();
        return;
    }
    if (ValiDateEmail('Email') == false) {
        return;
    }
    if (Src != document.getElementById('SecurityCode').value) {
        alert('کد امنیتی مطابقت ندارد');
        document.getElementById('SecurityCode').focus();
        return;
    }
    document.getElementById('f1').submit();
}
//***************************************************************************************************
//ProductOrder.Aspx
function ProductOrderEn(Src) {
    if (document.getElementById('NameFamily').value == null || document.getElementById('NameFamily').value == '') {
        alert('Please Enter your name and family');
        document.getElementById('NameFamily').focus();
        return
    }
    if (document.getElementById('City').value == null || document.getElementById('City').value == '') {
        alert('Please Enter your city');
        document.getElementById('City').focus();
        return
    }
    if (document.getElementById('ProductType').value == null || document.getElementById('ProductType').value == '') {
        alert('Please ditinct type of product');
        document.getElementById('ProductType').focus();
        return
    }
    /*if (document.getElementById('Count').value == null || document.getElementById('Count').value == '')
    {
    alert('لطفا تعداد محصول مورد نظر را وارد کنید');
    document.getElementById('Count').focus();
    return
    }
    if (ValidateDate(document.getElementById('Year').value,document.getElementById('Month').value,document.getElementById('Day').value) == false)
    {
    return;
    }*/
    if ((document.getElementById('Tel').value == null || document.getElementById('Tel').value == '') && (document.getElementById('Mobile').value == null || document.getElementById('Mobile').value == '')) {
        alert('Please Enter you telephone number');
        document.getElementById('Tel').focus();
        return;
    }
    if (document.getElementById('Address').value == null || document.getElementById('Address').value == '') {
        alert('Please Enter your Address');
        document.getElementById('Address').focus();
        return;
    }
    if (ValiDateEmailEn('Email') == false) {
        return;
    }
    if (Src != document.getElementById('SecurityCode').value) {
        alert('Please Enter Security Code Correctly');
        document.getElementById('SecurityCode').focus();
        return;
    }
    document.getElementById('f1').submit();
}
//***************************************************************************************************
//ManageProductOrder.aspx
function EditProductOrder() {
    if (document.getElementById('Year').value != '' || document.getElementById('Month').value != '' || document.getElementById('Day').value != '')
        if (ValidateDate(document.getElementById('Year').value, document.getElementById('Month').value, document.getElementById('Day').value) == false) {
        return;
    }
    document.getElementById('Action').value = 'SaveInfo';
    document.getElementById('f1').submit();
}
function EditOrder(Id, Description, day, month, year, isPosted, Suffix, PicFile) {
    if (PicFile != null && PicFile.toString().replace(/^\s+|\s+$/g, "") != '' && Suffix != null && Suffix.toString().replace(/^\s+|\s+$/g, "") != '') {
        document.getElementById('ViewPicFileDiv').style.display = 'block';
        document.getElementById('ViewPicFile').src = 'http://www.payamelectronic.com/Module/Images/' + PicFile + '.' + Suffix;
    }
    else {
        document.getElementById('ViewPicFileDiv').style.display = 'none';
        document.getElementById('ViewPicFile').src = '';
    }
    document.getElementById('OrderId').value = Id;
    if (Description == null || Description == '')
        tinyMCE.setContent('در حال بررسی');
    else {
        var Temp = Description.split('~');
        var Temp2 = '';
        var i = 0;
        for (i; i < Temp.length; i++) {
            if (i < Temp.length - 1)
                Temp2 += Temp[i] + "'";
            else if (Temp[i])
                Temp2 += Temp[i];
        }
        tinyMCE.setContent(Temp2);
    }
    if (year != null && year != '') {
        document.getElementById('Year').value = year;
        document.getElementById('Day').value = day;
        document.getElementById('Month').value = month;
    }
    else {
        document.getElementById('Year').value = '';
        document.getElementById('Day').value = '';
        document.getElementById('Month').value = '';
    }
    if (isPosted == '1')
        document.getElementById('SendState').checked = true;
    else
        document.getElementById('SendState').checked = false;
}
//***************************************************************************************************
function ValidateDate(year, month, day) {
    if (year == '' || year == null) {
        alert('لطفا سال تاریخ را وارد کنید');
        document.getElementById('year').focus();
        return false;
    }
    if (year.toString().length != 4 || year <= 0) {
        alert('لطفا سال تاریخ را درست وارد کنید');
        document.getElementById('year').focus();
        return false;
    }
    if (day == '' || day == null) {
        alert('لطفا روز تاریخ مورد نظر را وارد کنید');
        document.getElementById('day').focus();
        return false;
    }
    if (day > 31 || day <= 0) {
        alert('لطفا روز تاریخ مورد نظر را درست وارد کنید');
        document.getElementById('day').focus();
        return false;
    }
    if (month == '' || month == null) {
        alert('لطفا ماه تاریخ را درست وارد کنید');
        document.getElementById('month').focus();
        return false;
    }
    if (month > 12 || month <= 0) {
        alert('لطفا ماه تاریخ مورد نظر را درست وارد کنید ');
        document.getElementById('month').focus();
        return false;
    }
    return true;
}

function ValiDateEmail(Email) {
    if (document.getElementById(Email).value != null && document.getElementById(Email).value != '') {
        var Temp = document.getElementById(Email).value.split('@');
        if (Temp[1] == null || Temp[1] == '') {
            alert('وارد کنید Example@WebSite.Domain لطفا آدرس ایمیل را با فرمت');
            document.getElementById(Email).focus();
            return false;
        }
        var Temp1 = Temp[1].split('.');
        if (Temp1[1] == null || Temp1[1] == '') {
            alert('وارد کنید Example@WebSite.Domain لطفا آدرس ایمیل را با فرمت');
            document.getElementById(Email).focus();
            return false;
        }
        return true;
    }
    return true;
}
function ValiDateEmailEn(Email) {
    if (document.getElementById(Email).value != null && document.getElementById(Email).value != '') {
        var Temp = document.getElementById(Email).value.split('@');
        if (Temp[1] == null || Temp[1] == '') {
            alert('Please Enter Eamil Address On Example@WebSite.Domain Fromat ');
            document.getElementById(Email).focus();
            return false;
        }
        var Temp1 = Temp[1].split('.');
        if (Temp1[1] == null || Temp1[1] == '') {
            alert('Please Enter Eamil Address On Example@WebSite.Domain Fromat');
            document.getElementById(Email).focus();
            return false;
        }
        return true;
    }
    return true;
}
var popUpWin = 0;
function popUpWindow(URLStr, Title, left, top, width, height) {
    if (popUpWin) {
        if (!popUpWin.closed)
            popUpWin.close();
    }
    //popUpWin = open(URLStr, Title, 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
    //popUpWin = open(URLStr, Title, 'toolbar=no,location=no,directories=no,status=no,menub ar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
    //popUpWin = open(URLStr, Title, 'toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
    popUpWin = open(URLStr, Title, 'scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=yes,width=' + width + ',height=' + height + ',left=' + left + ', top=' + top + ',screenX=' + left + ',screenY=' + top + '');
}

//********************************************************************************************************************
//ManageNews.aspx
function SaveNewsInfo() {
    if (document.getElementById("Title").value == null || document.getElementById("Title").value == "") {
        alert("لطفا عنوان خبر را وارد کنید", "red", false);
        document.getElementById("Title").focus();
        return;
    }
    if (document.getElementById("LidNew").value == null || document.getElementById("LidNew").value == "") {
        alert("لطفا لید خبر را وارد کنید", "red", false);
        document.getElementById("LidNew").focus();
        return;
    }
    if (tinyMCE.getContent(tinyMCE.getEditorId('NewDescription')) == '' || tinyMCE.getContent(tinyMCE.getEditorId('NewDescription')) == null) {
        alert("لطفا متن خبر را وارد کنید", "red", false);
        return;
    }
    if (document.getElementById("Action").value != 'Update')
        document.getElementById("Action").value = 'Save';
    else
        document.getElementById("Action").value = 'Update';
    document.getElementById("f1").submit();
}
function EditNews(NewsId, Title, TitleEn, LidNew, LidNewEn, NewDescription, NewDescriptionEn, Title1, Title1En, Description1, Description1En, Key1, Key1En, ShowNews) {
    if (ShowNews == '1')
        document.getElementById('ShowNews').checked = true;
    else
        document.getElementById('ShowNews').checked = false;

    document.getElementById('Title1En').value = Title1En;
    document.getElementById('Title1').value = Title1;
    document.getElementById('Description1En').value = Description1En;
    document.getElementById('Description1').value = Description1;
    document.getElementById('Key1En').value = Key1En;
    document.getElementById('Key1').value = Key1;
    document.getElementById("TitleEn").value = TitleEn;
    document.getElementById("Title").value = Title;
    document.getElementById("LidNewEn").value = LidNewEn;
    document.getElementById("LidNew").value = LidNew
    document.getElementById("ID").value = NewsId;

    var Temp = NewDescription.split('~');
    var Temp2 = '';
    var i = 0;
    for (i; i < Temp.length; i++) {
        if (i < Temp.length - 1)
            Temp2 += Temp[i] + "'";
        else if (Temp[i])
            Temp2 += Temp[i];
    }
    tinyMCE.execInstanceCommand("NewDescription", "mceFocus");
    tinyMCE.setContent(Temp2);

    Temp = NewDescriptionEn.split('~');
    Temp2 = '';
    i = 0;
    for (i; i < Temp.length; i++) {
        if (i < Temp.length - 1)
            Temp2 += Temp[i] + "'";
        else if (Temp[i])
            Temp2 += Temp[i];
    }
    tinyMCE.execInstanceCommand("NewDescriptionEn", "mceFocus");
    tinyMCE.setContent(Temp2);


    document.getElementById("Action").value = 'Update';
}
//********************************************************************************************************************
//Default.aspx
function GetSearchForProduct(Lan) {
    var KeyFind, GroupFind, Brand;

    if (document.getElementById('KeyFind').value != '' || document.getElementById('Brand').value != '')
    {
        if (document.getElementById('KeyFind').value == null || document.getElementById('KeyFind').value == '')
            KeyFind = '-1';
        else
            KeyFind = document.getElementById('KeyFind').value;

        if (document.getElementById('GroupFind').value == null || document.getElementById('GroupFind').value == '')
            GroupFind = '-1';
        else
            GroupFind = document.getElementById('GroupFind').value;

        if (document.getElementById('Brand').value == null || document.getElementById('Brand').value == '')
            Brand = '-1';
        else
            Brand = document.getElementById('Brand').value;
        if (Lan != null && Lan != "")
            window.location = 'http://www.payamelectronic.com/Module/FindProductSnipSearchen/محصولات/' + KeyFind + '/' + GroupFind + '/' + Brand + '/default.aspx';
        else
            window.location = 'http://www.payamelectronic.com/search/?keyword=' + KeyFind + '&group=' + GroupFind + '&brand=' + Brand;
        document.getElementById('KeyFind').value = '';
        document.getElementById('GroupFind').value = '';
        document.getElementById('Brand').value = '';
    }
}
function GetSearchForListProduct(GroupFind) {
    popUpWindow('http://www.payamelectronic.com/Module/FindProductSnip/' + GroupFind + '/default.aspx', 'محصولات', 150, 150, 800, 500);
}
function TrackingOrderProduct() {
    var Tracking_Code = '';
    var Email_Track = '';

    if (document.getElementById('Tracking_Code').value == null || document.getElementById('Tracking_Code').value == '')
        Tracking_Code = '0';
    else
        Tracking_Code = document.getElementById('Tracking_Code').value;

    if (document.getElementById('Email_Track').value == null || document.getElementById('Email_Track').value == '')
        Email_Track = '0';
    else
        Email_Track = document.getElementById('Email_Track').value;

    window.location = 'http://www.payamelectronic.com/Module/پیگیری/' + Tracking_Code + '/' + Email_Track + '/TrackingPage/default.aspx';
}
function TrackingOrderProducten() {
    var Tracking_Code = '';
    var Email_Track = '';

    if (document.getElementById('Tracking_Code').value == null || document.getElementById('Tracking_Code').value == '')
        Tracking_Code = '0';
    else
        Tracking_Code = document.getElementById('Tracking_Code').value;

    if (document.getElementById('Email_Track').value == null || document.getElementById('Email_Track').value == '')
        Email_Track = '0';
    else
        Email_Track = document.getElementById('Email_Track').value;

    window.location = 'http://www.payamelectronic.com/Module/پیگیری/' + Tracking_Code + '/' + Email_Track + '/TrackingPageEn/default.aspx';
}
//********************************************************************************************************************
//ManageBrands.aspx
function SaveBrandInfo() {
    if (document.getElementById("BrandProduct").value == null || document.getElementById("BrandProduct").value == "") {
        alert("لطفا عنوان برند را وارد کنید", "red", false);
        document.getElementById("BrandProduct").focus();
        return;
    }
    if (document.getElementById("Action").value != 'Update')
        document.getElementById("Action").value = 'Save';
    else
        document.getElementById("Action").value = 'Update';
    document.getElementById("f1").submit();
}
function EditBrands(Id, Brand, PicFile) {
    document.getElementById('BrandId').value = Id;
    document.getElementById('BrandProduct').value = Brand;
    if (PicFile != null && PicFile != '') {
        document.getElementById('DivViewPicFile').className = 'DisplayElement';
        document.getElementById('ViewPicFile').src = 'http://www.payamelectronic.com/Module/images/' + PicFile;
    }
    document.getElementById('Action').value = 'Update';
}
//********************************************************************************************************************
function SaveInfoMemberNews() {
    if (document.getElementById('Email_Member').value == null || document.getElementById('Email_Member').value == '') {
        alert('Please Enter Your Email Address');
        document.getElementById('Email_Member').focus();
        return;
    }
    if (ValiDateEmail('Email_Member')) {
        window.location = "http://www.payamelectronic.com/Defaulten.aspx?Email_Member=" + document.getElementById('Email_Member').value;
        //document.getElementById('ActionMember').value = 'SaveInfoEmailMember';
        //document.getElementById('f1').submit();
    }
}
//********************************************************************************************************************
//ManageGroup.aspx
function SaveGroupInfo() {
    if (document.getElementById('Title').value == null || document.getElementById('Title').value == '') {
        alert('لطفا عنوان گروه را وارد کنید');
        document.getElementById('Title').focus();
        return;
    }
    if (document.getElementById('TitleEn').value == null || document.getElementById('TitleEn').value == '') {
        alert('لطفا عنوان گروه انگلیسی را وارد کنید');
        document.getElementById('Title').focus();
        return;
    }
    if (document.getElementById('Parent').value == null || document.getElementById('Parent').value == '') {
        alert('لطفا گروه را انتخواب کنید');
        document.getElementById('Parent').focus();
        return;
    }
    if (document.getElementById("Action").value != "Update")
        document.getElementById("Action").value = "Save";
    else
        document.getElementById("Action").value = "Update";
    document.getElementById("f1").submit();
}
function EditGroup(Id, Title, GroupId, Img, InShow, Key1, Description1, Description, TitleEn, DescriptionProductViewEn, Description1En, Key1En) {
    var Temp = DescriptionProductViewEn.split('~');
    var Temp2 = '';
    var i = 0;
    for (i; i < Temp.length; i++) {
        if (i < Temp.length - 1)
            Temp2 += Temp[i] + "'";
        else if (Temp[i])
            Temp2 += Temp[i];
    }
    tinyMCE.execInstanceCommand("DescriptionEn", "mceFocus");
    tinyMCE.setContent(Temp2);

    document.getElementById('TitleEn').value = TitleEn;
    document.getElementById('Description1En').value = Description1En;
    document.getElementById('Key1En').value = Key1En;


    document.getElementById('GroupId').value = Id;
    document.getElementById('Title').value = Title;
    document.getElementById('Parent').value = GroupId;
    document.getElementById('DivViewPicFile').className = 'DisplayElement';
    document.getElementById('ViewPicFile').src = 'http://www.payamelectronic.com/module/images/' + Img;
    document.getElementById('Action').value = 'Update';
    document.getElementById('Key1').value = Key1;
    document.getElementById('Description1').value = Description1;

    Temp = Description.split('~');
    Temp2 = '';
    var i = 0;
    for (i; i < Temp.length; i++) {
        if (i < Temp.length - 1)
            Temp2 += Temp[i] + "'";
        else if (Temp[i])
            Temp2 += Temp[i];
    }
    tinyMCE.execInstanceCommand("Description", "mceFocus");
    tinyMCE.setContent(Temp2);

    if (InShow == 1)
        document.getElementById('InShow').checked = true;
    else
        document.getElementById('InShow').checked = false;
}
//********************************************************************************************************************
function ArchiveNews() {
    window.location = "http://www.payamelectronic.com/module/ArchiveNewsen.aspx?Year=" + document.getElementById('Year').value + "&SelectMonth=" + document.getElementById('SelectMonth').value;
}
function EditQuestion(Id, Title, Key, Description, Question, Answer, TitleEn, KeyEn, DescriptionEn, QuestionEn, AnswerEn) {
    document.getElementById('QuestionId').value = Id;

    document.getElementById('Title').value = Title;
    document.getElementById('Key1').value = Key;
    document.getElementById('Description').value = Description;
    document.getElementById('Question').value = Question;
    document.getElementById('Answer').value = Answer;

    document.getElementById('Action').value = 'Update';

    document.getElementById('TitleEn').value = TitleEn;
    document.getElementById('Key1En').value = KeyEn;
    document.getElementById('DescriptionEn').value = DescriptionEn;
    document.getElementById('QuestionEn').value = QuestionEn;
    document.getElementById('AnswerEn').value = AnswerEn;
}
function SaveQuestion() {
    if (document.getElementById('Title').value == null || document.getElementById('Title').value == '') {
        alert('لطفا عنوان سوال را وارد کنید');
        document.getElementById('Title').focus();
        return
    }
    if (document.getElementById('Question').value == null || document.getElementById('Question').value == '') {
        alert('لطفا پرسش مورد نظر را وارد کنید');
        document.getElementById('Question').focus();
        return
    }
    if (document.getElementById('Answer').value == null || document.getElementById('Answer').value == '') {
        alert('لطفا پاسخ مورد نظر را وارد کنید');
        document.getElementById('Answer').focus();
        return
    }
    if (document.getElementById('Key1').value == null || document.getElementById('Key1').value == '') {
        alert('لطفا کلمات کلیدی پرسش را وارد کنید');
        document.getElementById('Key1').focus();
        return
    }
    if (document.getElementById('Description').value == null || document.getElementById('Description').value == '') {
        alert('لطفا توضیحات پرسش را وارد کنید');
        document.getElementById('Description').focus();
        return
    }
    if (document.getElementById("Action").value != "Update")
        document.getElementById("Action").value = "Save";
    else
        document.getElementById("Action").value = "Update";
    document.getElementById("f1").submit();
}
//********************************************************************************************************************
function SaveLinks() {
    if (document.getElementById('Title').value == null || document.getElementById('Title').value == '') {
        alert('لطفا عنوان لینک مورد نظر را وارد کنید');
        document.getElementById('Title').focus();
        return
    }
    if (document.getElementById('Link').value == null || document.getElementById('Link').value == '') {
        alert('لطفا لینک مورد نظر را وارد کنید');
        document.getElementById('Link').focus();
        return
    }
    if (document.getElementById('Desc').value == null || document.getElementById('Desc').value == '') {
        alert('لطفا شرح لینک را وارد کنید');
        document.getElementById('Desc').focus();
        return
    }
    if (document.getElementById('Key1').value == null || document.getElementById('Key1').value == '') {
        alert('لطفا کلمات کلیدی لینک را وارد کنید');
        document.getElementById('Key1').focus();
        return
    }
    if (document.getElementById('Description').value == null || document.getElementById('Description').value == '') {
        alert('لطفا توضیحات لینک را وارد کنید');
        document.getElementById('Description').focus();
        return
    }
    if (document.getElementById("Action").value != "Update")
        document.getElementById("Action").value = "Save";
    else
        document.getElementById("Action").value = "Update";
    document.getElementById("f1").submit();
}

//******************************************************************************************************************************************

function EditLink(Id, Key, Description, Link, Desc, Title) {
    document.getElementById('Title').value = Title;
    document.getElementById('Desc').value = Desc;
    document.getElementById('Key1').value = Key;
    document.getElementById('Description').value = Description;
    document.getElementById('Link').value = Link;
    document.getElementById('LinkId').value = Id;
    document.getElementById('Action').value = 'Update';
}
//******************************************************************************************************************************************
function SaveSpecificText() {
    if (document.getElementById("Specific").value == null || document.getElementById("Specific").value == "") {
        alert(" لطفا عنوان فروش ویژه را وارد کنید ");
        document.getElementById("Specific").focus();
        return;
    }
    if (document.getElementById("SpecificEn").value == null || document.getElementById("SpecificEn").value == "") {
        alert(" لطفا عنوان فروش ویژه (انگلیسی) را وارد کنید ");
        document.getElementById("SpecificEn").focus();
        return;
    }
    if (tinyMCE.getContent(tinyMCE.getEditorId('SpeDescription')) == '' || tinyMCE.getContent(tinyMCE.getEditorId('SpeDescription')) == null) {
        alert("لطفا متن فروش ویژه را وارد کنید");
        return;
    }
    if (tinyMCE.getContent(tinyMCE.getEditorId('SpeDescriptionEn')) == '' || tinyMCE.getContent(tinyMCE.getEditorId('SpeDescriptionEn')) == null) {
        alert("لطفا متن فروش ویژه (انگلیسی) را وارد کنید");
        return;
    }
    document.getElementById("Action").value = 'Update';
    document.getElementById("f1").submit();
}

//---------------------------------------------- Creat Cookies
function setCookie(c_name, value, expireHours) {
    var exdate = new Date();
    exdate.setDate(exdate.getHours() + expireHours);
    document.cookie = c_name + "=" + escape(value) +
    ((expireHours == null) ? "" : ";expires=" + exdate.toUTCString());
}

function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) c_end = document.cookie.length;
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}
//----------------------------------------------
function OnClickPeress(e) {
    if (window.event) // IE
    {
        keynum = e.keyCode;
    }
    else if (e.which) // Netscape/Firefox/Opera
    {
        keynum = e.which;
    }
    if ((keynum == 13))
        GetSearchForProduct();
        //document.getElementById('Searcbottom').click();
}
//-----------------------------------------------
function noEnterKey(e) {
    if (window.event) // IE
    {
        keynum = e.keyCode;
    }
    else if (e.which) // Netscape/Firefox/Opera
    {
        keynum = e.which;
    }
    if ((keynum == 13 || keynum == 13))
        return false;
}
