let HeaderZoomStatus = "none", FooterZoomStatus = "none"; let header = null, zoomHeader = null, footer = null, zoomFooter = null; let pHeaderNews; let divMenu, tiraLayout; let menuStatus = "close"; let divLogin1; let pRegLogin, pRegLoginZoom; let pimgOptionsMouseOver = false, divGoldMouseOver = false, divProductsDrawerMouseOver = false, divProductsDrawerOpenedZoom = false; let headerGetData = null; let divDrawer2Header = []; function createHeader() { header = document.createElement("header"); header.style.position = "fixed"; header.style.flexDirection = "column"; header.style.backgroundColor = colorless; header.style.width = "100%"; header.style.height = "3cm"; header.style.display = "flex"; header.style.alignItems = "center"; header.style.justifyContent = "center"; header.style.top = "0px"; header.style.zIndex = "5"; const divHeader = createDiv(); divHeader.style.flexDirection = "row"; divHeader.style.marginRight = "auto"; divHeader.style.marginLeft = "auto"; divHeader.style.width = "100%"; divHeader.style.height = "100%"; divHeader.style.zIndex = "10"; divHeader.style.backgroundColor = colorHeaderBackground1; header.appendChild(divHeader); header.divHeader = divHeader; const aLogoTitle = createA(linkHome, str(strMainPage)); aLogoTitle.style.display = "inline-block"; aLogoTitle.target = "_self"; aLogoTitle.style.width = "6cm"; aLogoTitle.style.height = "2cm"; aLogoTitle.style.marginTop = aLogoTitle.style.marginBottom = "auto"; aLogoTitle.style.marginInlineEnd = "0.5cm"; setHoverPointer(aLogoTitle); divHeader.appendChild(aLogoTitle); const logoTitle = document.createElement("img"); logoTitle.style.backgroundColor = colorless; logoTitle.src = imgLogoTitle; logoTitle.style.width = "6cm"; logoTitle.style.height = "2cm"; logoTitle.alt = "سفیران آهن"; aLogoTitle.appendChild(logoTitle); const divNewsOptions = createDiv(); divNewsOptions.style.height = "100%"; divNewsOptions.style.alignItems = "flex-start"; divNewsOptions.style.flexDirection = "column"; divHeader.appendChild(divNewsOptions); const divNewsPhone = createDiv(); divNewsPhone.style.width = "100%"; divNewsPhone.style.flexDirection = "row"; divNewsPhone.style.flexDirection = "start"; divNewsOptions.appendChild(divNewsPhone); const divHeaderNews = createDiv(); divHeaderNews.style.height = "310%"; divHeaderNews.style.width = "70%"; divHeaderNews.style.backgroundColor = colorNewsBackground; divHeaderNews.style.borderRadius = "1000px"; divHeaderNews.style.marginTop = "-17%"; divNewsPhone.appendChild(divHeaderNews); pHeaderNews = createP("در حال دریافت اخبار ..."); pHeaderNews.style.marginTop = "auto"; pHeaderNews.style.marginBottom = "1%"; pHeaderNews.style.fontSize = sizeHeaderText; pHeaderNews.style.color = colorNewsText; pHeaderNews.style.whiteSpace = "normal"; divHeaderNews.appendChild(pHeaderNews); const pimgPhone1 = new PImgLink(str(strPhone1), imgPhoneYellow, "ltr"); pimgPhone1.setTextColor(color21); pimgPhone1.setTextSize(sizeText2); pimgPhone1.setLink(linkTel1, "", false); pimgPhone1.style.marginTop = "1%"; pimgPhone1.style.marginInlineStart = "1%"; pimgPhone1.setAlt("Call"); pimgPhone1.setFontWeight("bold"); pimgPhone1.style.paddingTop = pimgPhone1.style.paddingBottom = "0px"; setHoverAnimation(pimgPhone1, "pimgHeader"); divNewsPhone.appendChild(pimgPhone1); pimgPhone1.img.style.animation = "pimgPhone1 1s infinite"; style.textContent += "@keyframes pimgPhone1 { 0%{ transform: rotate(0deg); } 15%{ transform: rotate(40deg); } 30%{ transform: rotate(0deg); } 45%{ transform: rotate(40deg); } 100%{ transform: rotate(0deg); } }"; pRegLogin = new PLink(str(strPleaseWait)); pRegLogin.setTextColor(colorHeaderText); pRegLogin.setTextSize(sizeHeaderText); pRegLogin.setLink("", "", false); pRegLogin.style.marginTop = "1%"; pRegLogin.style.marginRight = "auto"; setHoverAnimation(pRegLogin, "pimgHeader"); divNewsPhone.appendChild(pRegLogin); if (headerGetData !== null && headerGetData["cookie"]) { pRegLogin.p.innerHTML = str(strMyProfile); pRegLogin.setLink("", str(strMyProfile), false); pRegLogin.addEventListener("click", function () { localStorage.setItem('cookie', ''); }); } else { pRegLogin.p.innerHTML = str(strRegLogin); pRegLogin.setLink(linkRegLogin + encodeUrlSearch({"origin": "https://" + window.location.host}), str(strRegLogin), false); } const divOptions = createDiv(); divOptions.style.marginTop = "auto"; divOptions.style.marginLeft = "auto"; divOptions.style.marginInlineEnd = divOptions.style.marginInlineStart = "2cm"; divNewsOptions.appendChild(divOptions); texts = [strMainPage, strPriceList, strSpecialPrice, strBlog, strAboutUs, strContactUs]; images = [imgMainPage, imgPriceList, imgSpecialPrice, imgArticles, imgAboutUs, imgContactUs]; links = [linkHome, linkPriceList, linkSpecialSell, linkBlog, linkAboutUs, linkContactUs]; alts = ["Home", "Price-List", "Special-Sale", "Articles", "About-Us", "Contact-Us"]; for (let i = 0; i < texts.length; i++) { let pimgOptions; if (i === 1) { pimgOptions = new PImg(str(texts[i]), images[i], ""); setHoverPointer(pimgOptions); } else { pimgOptions = new PImgLink(str(texts[i]), images[i], ""); pimgOptions.setLink(links[i], "", false); } pimgOptions.setTextColor(colorHeaderText); pimgOptions.setTextSize(sizeHeaderText); pimgOptions.setAlt(alts[i]); setDirMargin(pimgOptions); setHoverAnimation(pimgOptions, "pimgHeader"); if (i === 1) { pimgOptions.addEventListener("mouseover", function () { pimgOptionsMouseOver = true; divProductsDrawer.style.display = "flex"; divProductsDrawer.style.opacity = 1; divProductsDrawer.style.top = header.clientHeight + "px"; }); pimgOptions.addEventListener("mouseout", function () { pimgOptionsMouseOver = false; closeFirstDrawer(); }); } divOptions.appendChild(pimgOptions); } const divLangSearch = createDiv(); divLangSearch.style.height = "100%"; divLangSearch.style.flexDirection = "column"; divLangSearch.style.marginInlineStart = "1%"; divLangSearch.id = "divLangSearch"; divHeader.appendChild(divLangSearch); const divLang = createDiv(); divLang.style.flexDirection = "row"; divLang.style.marginTop = "2%"; divLang.id = "divLang"; divLangSearch.appendChild(divLang); texts = ["العربية", "English", "فارسی"]; images = [imgArabFlag, imgEnglishFlag, imgIranFlag]; langs = [AR, EN, FA]; alts = ["Arabic", "English", "Persian"]; for (let i = 0; i < texts.length; i++) { const pimgLangs = new PImgLink(texts[i], images[i], "ltr"); pimgLangs.setTextColor(colorHeaderText); pimgLangs.setTextSize(sizeHeaderText); pimgLangs.setLink(document.URL, "", false); pimgLangs.setAlt(alts[i]); pimgLangs.setImageRatio(1.5); pimgLangs.style.cursor = "pointer"; pimgLangs.id = "lang" + i.toString(); pimgLangs.img.style.borderRadius = "1000px"; pimgLangs.addEventListener("click", function (event) { setLanguage(langs[this.id.substring(4)]); }); setDirMargin(pimgLangs); setHoverAnimation(pimgLangs, "pimgHeader"); divLang.appendChild(pimgLangs); } const divSearch = createDiv(); divSearch.style.width = "100%"; divSearch.style.flexDirection = "row"; divSearch.style.borderRadius = "1000px"; divSearch.style.borderColor = colorless; divSearch.style.backgroundColor = colorSearchBackground; divSearch.style.margin = "auto"; divLangSearch.appendChild(divSearch); const inputSearch = document.createElement("input"); inputSearch.style.outline = "none"; inputSearch.style.backgroundColor = colorless; inputSearch.style.borderColor = colorless; inputSearch.style.width = "100%"; inputSearch.style.paddingRight = "4%"; inputSearch.style.paddingLeft = "2%"; inputSearch.type = "text"; inputSearch.placeholder = str(strSearchProduct); inputSearch.style.fontSize = sizeHeaderText; inputSearch.style.fontFamily = "fontface1"; divSearch.appendChild(inputSearch); // const iconSearchA = createA(linkHome, ""); const iconSearchA = createDiv(); iconSearchA.style.marginLeft = iconSearchA.style.marginRight = "3px"; iconSearchA.style.borderRadius = "100%"; iconSearchA.style.backgroundColor = colorHeaderBackground1; iconSearchA.style.width = "1cm"; iconSearchA.style.height = "0.8cm"; iconSearchA.style.marginTop = "auto"; iconSearchA.style.marginBottom = "auto"; iconSearchA.onclick = function () { // window.alert("HEY"); } iconSearchA.addEventListener("mouseover", function () { iconSearchA.style.opacity = "0.6"; }, false); iconSearchA.addEventListener("mouseout", function () { iconSearchA.style.opacity = "1"; }, false); iconSearchA.addEventListener("mousedown", function () { iconSearchA.style.opacity = "0.4"; }, false); divSearch.appendChild(iconSearchA); const iconSearch = document.createElement("img"); iconSearch.style.padding = "0.1cm"; iconSearch.style.backgroundColor = colorless; iconSearch.style.width = "0.6cm"; iconSearch.style.height = "0.6cm"; iconSearch.src = imgSearch; iconSearch.alt = "Search"; iconSearchA.appendChild(iconSearch); divGoldWidth = "15cm"; divGold = createDiv(); divGold.style.flexFlow = "row wrap"; divGold.style.width = divGoldWidth + "cm"; divGold.style.background = "linear-gradient(" + colorHeaderBackground1 + ", " + colorHeaderBackground1 + "aa)"; divGold.style.boxShadow = "3px 3px 7px #00000055"; divGold.style.borderBottomLeftRadius = "1000px"; divGold.style.borderBottomRightRadius = "1000px"; divGold.style.overflow = "hidden"; divGold.style.zIndex = "-2"; divGold.addEventListener("mouseover", function () { divGoldMouseOver = true; }); divGold.addEventListener("mouseout", function () { divGoldMouseOver = false; closeFirstDrawer(); }); header.appendChild(divGold); header.divGold = divGold; style.textContent += "@keyframes pGold {\n" + " 0% {margin-inline-start:60cm;}\n" + " 100% {margin-inline-start:-60cm;}\n" + "}" divGoldMover = createDiv(); divGoldMover.style.flexDirection = "row"; divGoldMover.style.marginInlineStart = "60cm"; divGoldMover.style.animation = "pGold 40s linear infinite"; divGoldMover.style.paddingBottom = "0.1cm"; divGold.appendChild(divGoldMover); pGold = []; for (let i = 0; i < 9; i++) { pGold[i] = createP(str(strPleaseWait)); pGold[i].style.width = "5cm"; pGold[i].style.color = "#FFE082"; pGold[i].style.fontSize = sizeHeaderText; pGold[i].style.fontFamily = "fontface2"; pGold[i].style.textAlign = "center"; pGold[i].style.whiteSpace = "nowrap"; pGold[i].style.justifyContent = "center"; divGoldMover.appendChild(pGold[i]); } divProductsDrawer = createDiv(); divProductsDrawer.style.position = "fixed"; divProductsDrawer.style.flexDirection = "column"; divProductsDrawer.style.backgroundColor = colorHeaderBackground1 + "dd"; divProductsDrawer.style.padding = "0.3cm"; divProductsDrawer.style.borderBottomLeftRadius = "0.5cm"; divProductsDrawer.style.borderBottomRightRadius = "0.5cm"; divProductsDrawer.style.zIndex = "4"; divProductsDrawer.style.top = "0cm"; divProductsDrawer.style.transition = "0.2s"; divProductsDrawer.style.opacity = 0; divProductsDrawer.style.boxShadow = "5px 5px 10px #00000099"; divProductsDrawer.addEventListener("mouseover", function () { divProductsDrawerMouseOver = true; }); divProductsDrawer.addEventListener("mouseout", function () { divProductsDrawerMouseOver = false; closeFirstDrawer() }); document.body.appendChild(divProductsDrawer); let activeProductIndex = -1; const pimgDrawer = []; const productList = [strSheet, strRebar, strGirder, strProfile, strPipe, strCorner, strStud, strWire]; const productList2 = [[strSheet, strBlackSheet, strColorSheet, strOilSheet, strGalvanizedSheet, strChequerSheet, strSteelSheet, strAcidWashSheet, strAluminiumSheet, strAlloySheet], [strRebar, strChequerRebar, strSimpleRebar, strSimpleCoilRebar, strChequerCoilRebar], [strGirder, strIPEGirder, strBeeGirder, strHeavyGirder, strLightHashGirder, strHeavyHashGirder], [strProfile, strStructuralProfile, strIndustrialProfile, strZProfile, strColumnProfile, strFurnitureProfile], [strPipe, strIndustrialPipe, strGasDeliveryPipe, strScaffoldPipe, strManismanPipe, strFurniturePipe], [strCorner], [strStud], [strWire, strBarbedWire, strFenceWire, strMeshWire, strLaceWire, strFencePostWire, strWiredWire]]; const productIconWhite = [imgSheetYellow, imgRebarYellow, imgGirderYellow, imgProfileYellow, imgPipeYellow, imgCornerYellow, imgStudYellow, imgWireYellow]; const pathNames = [[ "قیمت-ورق", "قیمت-ورق-سیاه", "قیمت-ورق-رنگی", "قیمت-ورق-روغنی", "قیمت-ورق-گالوانیزه", "قیمت-ورق-آجدار", "قیمت-ورق-استیل", "قیمت-ورق-اسیدشویی", "قیمت-ورق-آلومینیوم", "قیمت-ورق-آلیاژی"], ["قیمت-میلگرد", "قیمت-میلگرد-آجدار", "قیمت-میلگرد-ساده", "قیمت-میلگرد-کلاف-ساده", "قیمت-میلگرد-کلاف-آجدار"], ["قیمت-تیرآهن", "قیمت-تیرآهن-IPE", "قیمت-تیرآهن-زنبوری", "قیمت-تیرآهن-سنگین", "قیمت-تیرآهن-هاش-سبک", "قیمت-تیرآهن-هاش-سنگین"], ["قیمت-پروفیل", "قیمت-پروفیل-ساختمانی", "قیمت-پروفیل-صنعتی", "قیمت-پروفیل-Z", "قیمت-پروفیل-ستونی", "قیمت-پروفیل-مبلی"], ["قیمت-لوله", "قیمت-لوله-صنعتی", "قیمت-لوله-گازرسانی", "قیمت-لوله-داربست", "قیمت-لوله-مانیسمان", "قیمت-لوله-مبلی"], ["قیمت-نبشی"], ["قیمت-ناودانی"], ["قیمت-مفتولی", "قیمت-مفتولی-خاردار", "قیمت-مفتولی-فنس", "قیمت-مفتولی-مش", "قیمت-مفتولی-توری", "قیمت-مفتولی-تیرحصار", "قیمت-سیم-مفتولی"]]; for (let i = 0; i < productList.length; i++) { pimgDrawer[i] = new PImg(str(strPriceList) + " " + str(productList[i]), productIconWhite[i], ""); pimgDrawer[i].setTextSize(sizeHeaderText); pimgDrawer[i].setAlt(str(productList[i])); pimgDrawer[i].setImageRatio(1.6); pimgDrawer[i].setTextColor("#ffffff"); pimgDrawer[i].setWhiteSpace("nowrap"); pimgDrawer[i].p.style.marginRight = pimgDrawer[i].p.style.marginLeft = "0.3cm"; pimgDrawer[i].style.alignItems = "right"; pimgDrawer[i].style.justifyContent = "right"; pimgDrawer[i].style.paddingInlineEnd = "auto"; pimgDrawer[i].style.width = "5cm"; pimgDrawer[i].style.transition = "0.2s"; pimgDrawer[i].style.borderRadius = "1000px"; pimgDrawer[i].setId('pimgDrawer' + i); setHoverPointer(pimgDrawer[i]); pimgDrawer[i].addEventListener("mouseout", function (event) { const id = parseInt(event.target.id.substring(10)); if (activeProductIndex !== id) { pimgDrawer[i].style.backgroundColor = ""; } }, false); pimgDrawer[i].addEventListener("mouseover", function (event) { pimgDrawer[i].style.backgroundColor = "#ffffff33"; }, false); pimgDrawer[i].addEventListener("click", function(event) { const id = parseInt(event.target.id.substring(10)); if (activeProductIndex !== -1) { pimgDrawer[activeProductIndex].style.backgroundColor = ""; closeDrawerHeader(activeProductIndex); } if (activeProductIndex !== id) { activeProductIndex = id; pimgDrawer[activeProductIndex].style.backgroundColor = "#ffffff55"; openDrawerHeader(activeProductIndex); } else { activeProductIndex = -1; } }); divProductsDrawer.appendChild(pimgDrawer[i]); divDrawer2Header[i] = createDiv(); divDrawer2Header[i].style.position = "fixed"; divDrawer2Header[i].style.flexDirection = "column"; divDrawer2Header[i].style.backgroundColor = colorHeaderBackground1 + "dd"; divDrawer2Header[i].style.padding = "0.3cm"; divDrawer2Header[i].style.borderBottomLeftRadius = "0.5cm"; divDrawer2Header[i].style.borderBottomRightRadius = "0.5cm"; divDrawer2Header[i].style.zIndex = "3"; divDrawer2Header[i].style.transition = "0.2s"; divDrawer2Header[i].style.boxShadow = "5px 5px 10px #00000099"; divDrawer2Header[i].style.opacity = 0; divDrawer2Header[i].style.display = "none"; divDrawer2Header[i].id = 'divDrawer2' + i; divDrawer2Header[i].addEventListener("mouseover", function () { divProductsDrawerMouseOver = true; }); divDrawer2Header[i].addEventListener("mouseout", function () { divProductsDrawerMouseOver = false; closeFirstDrawer(); }); document.body.appendChild(divDrawer2Header[i]); productIconYellow = [imgSheetYellow, imgRebarYellow, imgGirderYellow, imgProfileYellow, imgPipeYellow, imgCornerYellow, imgStudYellow, imgWireYellow]; for (let j = 0; j < productList2[i].length; j++) { let pimgDrawer2; if (j === 0) { pimgDrawer2 = new PImgLink("قیمت همه " + str(productList2[i][j]) + " ها", productIconYellow[i], ""); } else { pimgDrawer2 = new PImgLink('قیمت ' + str(productList2[i][j]), productIconYellow[i], ""); } pimgDrawer2.setTextSize(sizeHeaderText); pimgDrawer2.setAlt(str(productList2[i][j])); pimgDrawer2.setImageRatio(1.6); pimgDrawer2.setTextColor("#ffffff"); pimgDrawer2.setBackground(colorless, "#ffffff33", "#ffffff55", "1000px"); pimgDrawer2.setWhiteSpace("nowrap"); pimgDrawer2.setLink(linksPath + pathNames[i][j], "قیمت " + str(productList2[i][j]), false); pimgDrawer2.p.style.marginRight = pimgDrawer2.p.style.marginLeft = "0.3cm"; pimgDrawer2.style.alignItems = "right"; pimgDrawer2.style.justifyContent = "right"; pimgDrawer2.style.paddingInlineEnd = "auto"; pimgDrawer2.style.width = "5cm"; pimgDrawer2.style.transition = "0.2s"; pimgDrawer2.setId('pimgDrawer2' + i); setHoverPointer(pimgDrawer2); divDrawer2Header[i].appendChild(pimgDrawer2); } divDrawer2Header[i].style.height = divDrawer2Header[i].childElementCount * 0.9 + "cm"; } productTiraLayoutHeader = createDiv(); productTiraLayoutHeader.style.width = "100%"; productTiraLayoutHeader.style.height = "100%"; productTiraLayoutHeader.style.position = "fixed"; productTiraLayoutHeader.style.backgroundColor = "#000000"; productTiraLayoutHeader.style.zIndex = "2"; productTiraLayoutHeader.style.display = "none"; productTiraLayoutHeader.style.opacity = 0; productTiraLayoutHeader.style.top = "0px"; productTiraLayoutHeader.style.transition = '0.3s'; productTiraLayoutHeader.addEventListener("click", function (event) { closeDrawerHeader(activeProductIndex); activeProductIndex = -1; closeFirstDrawer(); }); document.body.appendChild(productTiraLayoutHeader); function closeFirstDrawer() { if (activeProductIndex === -1) { setTimeout(function () { if (!pimgOptionsMouseOver && !divGoldMouseOver && !divProductsDrawerMouseOver) { divProductsDrawer.style.opacity = 0; divProductsDrawer.style.top = header.clientHeight - divProductsDrawer.clientHeight + "px"; setTimeout(function () { divProductsDrawer.style.display = "none"; }, 200); } }, 100); for (let i = 0; i < pimgDrawer.length; i++) { pimgDrawer[i].style.backgroundColor = ""; } } } return header; } function closeDrawerHeader(id) { divDrawer2Header[id].style.opacity = 0; divDrawer2Header[id].style.right = windowWidthCm / 2 - 5.5 + "cm"; productTiraLayoutHeader.style.opacity = 0; divDrawer2Header[id].style.display = "none"; productTiraLayoutHeader.style.display = "none"; } function openDrawerHeader(id) { divDrawer2Header[id].style.display = "flex"; divDrawer2Header[id].style.right = windowWidthCm / 2 + 0.6 + "cm"; productTiraLayoutHeader.style.display = "flex"; divDrawer2Header[id].style.opacity = 1; productTiraLayoutHeader.style.opacity = 0; } function createZoomHeader() { zoomHeader = document.createElement("header"); zoomHeader.style.position = "fixed"; zoomHeader.style.width = "100%"; zoomHeader.style.height = "3cm"; zoomHeader.style.display = "flex"; zoomHeader.style.alignItems = "center"; zoomHeader.style.justifyContent = "top"; zoomHeader.style.flexDirection = "column"; zoomHeader.style.top = "0px"; zoomHeader.style.zIndex = "5"; const divZoomHeader = createDiv(); divZoomHeader.style.width = "100%"; divZoomHeader.style.flexDirection = "row"; divZoomHeader.style.backgroundColor = colorHeaderBackground1; divZoomHeader.style.zIndex = "100"; zoomHeader.appendChild(divZoomHeader); zoomHeader.divZoomHeader = divZoomHeader; const imageMenu = document.createElement("img"); imageMenu.style.display = "inline-block"; imageMenu.src = imgMenu; imageMenu.style.width = "0.8cm"; imageMenu.style.height = "0.8cm"; imageMenu.style.marginTop = "auto"; imageMenu.style.marginBottom = "auto"; imageMenu.style.padding = "0.2cm"; imageMenu.alt = "Menu"; setHoverAnimation(imageMenu, "pimgHeader"); setHoverPointer(imageMenu); imageMenu.style.borderRadius = "0.3cm"; imageMenu.addEventListener("click", function (event) { if (menuStatus === "close") { menuStatus = "open"; divMenu.style.right = "0cm"; tiraLayout.style.display = "flex"; // divProductsDrawerOpenedZoom = true; } else if (menuStatus === "open") { menuStatus = "close"; divMenu.style.right = "-5cm"; tiraLayout.style.display = "none"; if (divProductsDrawerOpenedZoom) { divProductsDrawerOpenedZoom = false; // divProductsDrawerZoom.style.opacity = 0; // divProductsDrawerZoom.style.left = windowWidthCm / 2 + "cm"; setTimeout(function () { // divProductsDrawerZoom.style.display = "none"; }, 300); } } }); divZoomHeader.appendChild(imageMenu); aLogoTitle = createA(linkHome, "سفیران آهن زاینده رود"); aLogoTitle.style.position = "absolute"; aLogoTitle.style.display = "inline-block"; aLogoTitle.target = "_self"; aLogoTitle.style.width = "4.5cm"; aLogoTitle.style.height = "1.5cm"; aLogoTitle.style.marginTop = aLogoTitle.style.marginBottom = "0.25cm"; aLogoTitle.style.marginRight = "auto"; aLogoTitle.style.marginLeft = "auto"; setHoverPointer(aLogoTitle); divZoomHeader.appendChild(aLogoTitle); const logoTitle = document.createElement("img"); logoTitle.style.backgroundColor = colorless; logoTitle.src = imgLogoTitle; logoTitle.style.width = "4.5cm"; logoTitle.style.height = "1.5cm"; logoTitle.alt = "سفیران آهن"; aLogoTitle.appendChild(logoTitle); const divPhoneRegLogin = createDiv(); divPhoneRegLogin.style.flexDirection = "column"; divPhoneRegLogin.style.marginInlineStart = "auto"; divPhoneRegLogin.style.height = "100%"; divZoomHeader.appendChild(divPhoneRegLogin); const pimgPhone1 = new PImgLink(str(strPhone1), imgPhoneYellow, "ltr"); pimgPhone1.setTextColor(color21); pimgPhone1.setTextSize(sizeText2); pimgPhone1.setBackground(colorless, colorHeaderHover, colorHeaderPress, "1000px"); pimgPhone1.setLink(linkTel1, "", false); pimgPhone1.setAlt("تماس"); pimgPhone1.setFontWeight("bold"); pimgPhone1.style.paddingTop = pimgPhone1.style.paddingBottom = "0px"; pimgPhone1.style.marginTop = "0px"; setHoverAnimation(pimgPhone1, "pimgHeader"); divPhoneRegLogin.appendChild(pimgPhone1); pimgPhone1.img.style.animation = "pimgPhone1 1s infinite"; style.textContent += "@keyframes pimgPhone1 { 0%{ transform: rotate(0deg); } 15%{ transform: rotate(40deg); } 30%{ transform: rotate(0deg); } 45%{ transform: rotate(40deg); } 100%{ transform: rotate(0deg); } }"; const divLine = createDiv(); divLine.style.backgroundColor = colorHeaderText; divLine.style.height = "1px"; divLine.style.width = "100px"; divPhoneRegLogin.appendChild(divLine); pRegLoginZoom = new PLink(str(strPleaseWait)); pRegLoginZoom.setTextColor(colorHeaderText); pRegLoginZoom.setTextSize(sizeHeaderText); pRegLoginZoom.setLink("", "", false); pRegLoginZoom.style.marginTop = "1%"; pRegLoginZoom.style.marginRight = pRegLoginZoom.style.marginLeft = "auto"; setHoverAnimation(pRegLoginZoom, "pimgHeader"); divPhoneRegLogin.appendChild(pRegLoginZoom); if (headerGetData !== null && headerGetData["cookie"]) { pRegLoginZoom.p.innerHTML = str(strMyProfile); pRegLoginZoom.setLink("", str(strMyProfile), false); pRegLoginZoom.addEventListener("click", function () { localStorage["cookie"] = ""; }); } else { pRegLoginZoom.p.innerHTML = str(strRegLogin); pRegLoginZoom.setLink(linkRegLogin + encodeUrlSearch({"origin": "https://" + window.location.host}), str(strRegLogin), false); } tiraLayout = createDiv(); tiraLayout.style.width = "100%"; tiraLayout.style.height = "100%"; tiraLayout.style.position = "fixed"; tiraLayout.style.backgroundColor = "#000000"; tiraLayout.style.zIndex = "10"; tiraLayout.style.display = "none"; tiraLayout.style.opacity = 0.3; tiraLayout.style.top = "0px"; tiraLayout.addEventListener("click", function (event) { imageMenu.dispatchEvent(new Event("click")); }); document.body.appendChild(tiraLayout); style.textContent += ".divMenu {" + "-ms-overflow-style: none;" + "scrollbar-width: none;" + "}" + ".divMenu::-webkit-scrollbar {" + "display: none;" + "}"; divMenu = createDiv(); divMenu.style.position = "fixed"; divMenu.style.backgroundColor = colorHeaderBackground1; divMenu.style.flexDirection = "column"; divMenu.style.transition = "0.3s"; divMenu.style.zIndex = "15"; divMenu.style.right = "-5cm"; divMenu.style.opacity = 0.8; divMenu.style.overflowY = "scroll"; divMenu.style.top = "2.5cm"; divMenu.className = "divMenu"; document.body.appendChild(divMenu); const divLang = createDiv(); divLang.style.width = "80%"; divLang.style.marginBottom = divLang.style.marginTop = percent(2); divLang.style.flexDirection = "row"; divLang.id = "divLang"; divMenu.appendChild(divLang); images = [imgArabFlag, imgEnglishFlag, imgIranFlag]; langs = [AR, EN, FA]; alts = ["Arabic", "English", "Persian"]; for (let i = 0; i < images.length; i++) { const imgLangs = document.createElement("img"); imgLangs.style.width = "1cm"; imgLangs.style.height = "1cm"; imgLangs.style.marginLeft = imgLangs.style.marginRight = "auto"; imgLangs.alt = alts[i]; imgLangs.src = images[i]; imgLangs.style.cursor = "pointer"; imgLangs.id = "langZoom" + i.toString(); imgLangs.style.transition = "0.3s"; imgLangs.style.borderRadius = "1000px"; setHoverAnimationOpacity(imgLangs, 1, 0.8); imgLangs.addEventListener("click", function (event) { setLanguage(langs[this.id.substring(4)]); location.reload(); }); divLang.appendChild(imgLangs); } const divSearch = createDiv(); divSearch.style.width = "90%"; divSearch.style.flexDirection = "row"; divSearch.style.borderRadius = "1000px"; divSearch.style.borderColor = colorless; divSearch.style.backgroundColor = colorSearchBackground; divSearch.style.marginLeft = divSearch.style.marginRight = "auto"; divSearch.style.marginBottom = "0.3cm"; divMenu.appendChild(divSearch); const inputSearch = document.createElement("input"); inputSearch.style.outline = "none"; inputSearch.style.backgroundColor = colorless; inputSearch.style.borderColor = colorless; inputSearch.style.width = "100%"; inputSearch.style.paddingRight = "4%"; inputSearch.style.paddingLeft = "2%"; inputSearch.type = "text"; inputSearch.placeholder = str(strSearch); inputSearch.style.fontSize = sizeHeaderText; inputSearch.style.fontFamily = "fontface1"; divSearch.appendChild(inputSearch); const iconSearchA = createA(linkHome, ""); iconSearchA.style.marginLeft = iconSearchA.style.marginRight = "3px"; iconSearchA.style.borderRadius = "100%"; iconSearchA.style.backgroundColor = colorHeaderBackground1; iconSearchA.style.width = "1cm"; iconSearchA.style.height = "0.8cm"; iconSearchA.style.marginTop = "auto"; iconSearchA.style.marginBottom = "auto"; iconSearchA.onclick = function () { // window.alert("HEY"); } iconSearchA.addEventListener("mouseover", function () { iconSearchA.style.opacity = "0.6"; }, false); iconSearchA.addEventListener("mouseout", function () { iconSearchA.style.opacity = "1"; }, false); iconSearchA.addEventListener("mousedown", function () { iconSearchA.style.opacity = "0.4"; }, false); divSearch.appendChild(iconSearchA); const iconSearch = document.createElement("img"); iconSearch.style.padding = "0.1cm"; iconSearch.style.backgroundColor = colorless; iconSearch.style.width = "0.6cm"; iconSearch.style.height = "0.6cm"; iconSearch.src = imgSearch; iconSearch.alt = "Search"; iconSearchA.appendChild(iconSearch); divOptionsZoom = createDiv(); divOptionsZoom.style.flexDirection = "column"; divOptionsZoom.style.width = "100%"; divOptionsZoom.style.marginBottom = "auto"; divMenu.appendChild(divOptionsZoom); let zoomPriceOpen1 = -1, zoomPriceOpen2 = -1; texts = [strMainPage, strPriceList, strSpecialPrice, strBlog, strAboutUs, strContactUs]; images = [imgMainPage, imgPriceList, imgSpecialPrice, imgArticles, imgAboutUs, imgContactUs]; links = [linkHome, linkPriceList, linkSpecialSell, linkBlog, linkAboutUs, linkContactUs]; alts = ["Home", "Price-List", "Special-Sale", "Articles", "About-Us", "Contact-Us"]; for (let i = 0; i < texts.length; i++) { let pimgOptions; if (i !== 1) { pimgOptions = new PImgLink(str(texts[i]), images[i], ""); } else { pimgOptions = new PImg(str(texts[i]), images[i], ""); } pimgOptions.style.width = "4cm"; pimgOptions.style.marginRight = pimgOptions.style.marginLeft = "auto"; pimgOptions.style.justifyContent = "start"; pimgOptions.setTextColor(colorHeaderText); pimgOptions.setTextSize(sizeHeaderText); pimgOptions.setAlt(alts[i]); setDirMargin(pimgOptions); setHoverAnimation(pimgOptions, "pimgHeader"); divOptionsZoom.appendChild(pimgOptions); if (i === 1) { setHoverPointer(pimgOptions); pimgOptions.addEventListener("click", function (event) { if (zoomPriceOpen1 === -1) { zoomPriceOpen1 = 0; divProductsDrawer.style.height = ''; } else { zoomPriceOpen1 = -1; divProductsDrawer.style.height = '0cm'; if (zoomPriceOpen2 !== -1) { divDrawer22[zoomPriceOpen2].height = '0cm'; } } }); const divProductsDrawer = createDiv(); divProductsDrawer.style.flexDirection = "column"; divProductsDrawer.style.backgroundColor = colorHeaderBackground1 + "dd"; divProductsDrawer.style.padding = "0.2cm"; divProductsDrawer.style.borderBottomLeftRadius = "0.5cm"; divProductsDrawer.style.borderBottomRightRadius = "0.5cm"; divProductsDrawer.style.transition = "0.2s"; divProductsDrawer.style.height = '0cm'; divProductsDrawer.style.overflow = 'hidden'; divOptionsZoom.appendChild(divProductsDrawer); const pimgDrawer = [], divDrawer22 = []; const productList = [strSheet, strRebar, strGirder, strProfile, strPipe, strCorner, strStud, strWire]; const productList2 = [[strSheet, strBlackSheet, strColorSheet, strOilSheet, strGalvanizedSheet, strChequerSheet, strSteelSheet, strAcidWashSheet, strAluminiumSheet, strAlloySheet], [strRebar, strChequerRebar, strSimpleRebar, strSimpleCoilRebar, strChequerCoilRebar], [strGirder, strIPEGirder, strBeeGirder, strHeavyGirder, strLightHashGirder, strHeavyHashGirder], [strProfile, strStructuralProfile, strIndustrialProfile, strZProfile, strColumnProfile, strFurnitureProfile], [strPipe, strIndustrialPipe, strGasDeliveryPipe, strScaffoldPipe, strManismanPipe, strFurniturePipe], [strCorner], [strStud], [strWire, strBarbedWire, strFenceWire, strMeshWire, strLaceWire, strFencePostWire, strWiredWire]]; const productIconWhite = [imgSheetYellow, imgRebarYellow, imgGirderYellow, imgProfileYellow, imgPipeYellow, imgCornerYellow, imgStudYellow, imgWireYellow]; const pathNames = [[ "قیمت-ورق", "قیمت-ورق-سیاه", "قیمت-ورق-رنگی", "قیمت-ورق-روغنی", "قیمت-ورق-گالوانیزه", "قیمت-ورق-آجدار", "قیمت-ورق-استیل", "قیمت-ورق-اسیدشوئی", "قیمت-ورق-آلومینیوم", "قیمت-ورق-آلیاژی"], ["قیمت-میلگرد", "قیمت-میلگرد-آجدار", "قیمت-میلگرد-ساده", "قیمت-میلگرد-کلاف-ساده", "قیمت-میلگرد-کلاف-آجدار"], ["قیمت-تیرآهن", "قیمت-تیرآهن-IPE", "قیمت-تیرآهن-زنبوری", "قیمت-تیرآهن-سنگین", "قیمت-تیرآهن-هاش-سبک", "قیمت-تیرآهن-هاش-سنگین"], ["قیمت-پروفیل", "قیمت-پروفیل-ساختمانی", "قیمت-پروفیل-صنعتی", "قیمت-پروفیل-Z", "قیمت-پروفیل-ستونی", "قیمت-پروفیل-مبلی"], ["قیمت-لوله", "قیمت-لوله-صنعتی", "قیمت-لوله-گازرسانی", "قیمت-لوله-داربست", "قیمت-لوله-مانیسمان", "قیمت-لوله-مبلی"], ["قیمت-نبشی"], ["قیمت-ناودانی"], ["قیمت-مفتولی", "قیمت-مفتولی-خاردار", "قیمت-مفتولی-فنس", "قیمت-مفتولی-مش", "قیمت-مفتولی-توری", "قیمت-مفتولی-تیرحصار", "قیمت-سیم-مفتولی"]]; for (let k = 0; k < productList.length; k++) { pimgDrawer[k] = new PImg(str(strPriceList) + " " + str(productList[k]), productIconWhite[k], ""); pimgDrawer[k].setTextSize(sizeHeaderText); pimgDrawer[k].setAlt(str(productList[k])); pimgDrawer[k].setImageRatio(1.6); pimgDrawer[k].setTextColor(color21); pimgDrawer[k].setWhiteSpace("nowrap"); pimgDrawer[k].p.style.marginRight = pimgDrawer[k].p.style.marginLeft = "0.3cm"; pimgDrawer[k].style.alignItems = "right"; pimgDrawer[k].style.justifyContent = "right"; pimgDrawer[k].style.paddingInlineEnd = "auto"; pimgDrawer[k].style.width = "5cm"; pimgDrawer[k].style.transition = "0.2s"; pimgDrawer[k].style.borderRadius = "1000px"; pimgDrawer[k].setId('pimgDrawer' + k); setHoverPointer(pimgDrawer[k]); pimgDrawer[k].addEventListener("click", function(event) { const id = parseInt(event.target.id.substring(10)); if (zoomPriceOpen2 !== -1) { divDrawer22[zoomPriceOpen2].style.height = '0cm'; } if (zoomPriceOpen2 !== id) { zoomPriceOpen2 = id; divDrawer22[zoomPriceOpen2].style.height = divDrawer22[zoomPriceOpen2].childElementCount * 0.9 + 'cm'; // divDrawer22[zoomPriceOpen2].style.height = '8cm'; console.log(zoomPriceOpen2); } else { zoomPriceOpen2 = -1; } }); divProductsDrawer.appendChild(pimgDrawer[k]); divDrawer22[k] = createDiv(); divDrawer22[k].style.flexDirection = "column"; divDrawer22[k].style.backgroundColor = colorHeaderBackground1 + "dd"; // divDrawer22[k].style.padding = "0.1cm"; divDrawer22[k].style.borderBottomLeftRadius = "0.5cm"; divDrawer22[k].style.borderBottomRightRadius = "0.5cm"; divDrawer22[k].style.transition = "0.2s"; divDrawer22[k].style.boxShadow = "5px 5px 10px #00000099"; divDrawer22[k].style.width = '5cm'; divDrawer22[k].style.height = '0cm'; divDrawer22[k].style.overflow = 'hidden'; divDrawer22[k].id = 'divDrawer2' + k; divProductsDrawer.appendChild(divDrawer22[k]); productIconYellow = [imgSheetYellow, imgRebarYellow, imgGirderYellow, imgProfileYellow, imgPipeYellow, imgCornerYellow, imgStudYellow, imgWireYellow]; for (let j = 0; j < productList2[k].length; j++) { let pimgDrawer2; if (j === 0) { pimgDrawer2 = new PImgLink("قیمت همه " + str(productList2[k][j]) + " ها", productIconYellow[k], ""); } else { pimgDrawer2 = new PImgLink('قیمت ' + str(productList2[k][j]), productIconYellow[k], ""); } pimgDrawer2.setTextSize('0.35cm'); pimgDrawer2.setAlt(str(productList2[k][j])); pimgDrawer2.setImageRatio(1.6); pimgDrawer2.setTextColor("#ffffff"); pimgDrawer2.setBackground(colorless, "#ffffff33", "#ffffff55", "1000px"); pimgDrawer2.setWhiteSpace("nowrap"); pimgDrawer2.setLink(linksPath + pathNames[k][j], 'قیمت ' + str(productList2[k][j]), false); pimgDrawer2.p.style.marginRight = pimgDrawer2.p.style.marginLeft = "0.1cm"; pimgDrawer2.style.alignItems = "right"; pimgDrawer2.style.justifyContent = "right"; pimgDrawer2.style.paddingInlineEnd = "auto"; pimgDrawer2.style.width = "5cm"; pimgDrawer2.style.transition = "0.2s"; pimgDrawer2.setId('pimgDrawer2' + k); setHoverPointer(pimgDrawer2); divDrawer22[k].appendChild(pimgDrawer2); } } } else { pimgOptions.setLink(links[i], "", false); } } const divGoldWidthZoom = windowWidthCm * 9 / 10; const marginZoom = 45 + divGoldWidthZoom + "cm"; divGoldZoom = createDiv(); divGoldZoom.style.flexFlow = "row wrap"; divGoldZoom.style.width = divGoldWidthZoom + "%"; divGoldZoom.style.background = "linear-gradient(" + colorHeaderBackground1 + ", " + colorHeaderBackground1 + "aa)"; divGoldZoom.style.boxShadow = "3px 3px 7px #00000055"; divGoldZoom.style.borderBottomLeftRadius = "1000px"; divGoldZoom.style.borderBottomRightRadius = "1000px"; divGoldZoom.style.overflow = "hidden"; zoomHeader.appendChild(divGoldZoom); zoomHeader.divGoldZoom = divGoldZoom; style.textContent += "@keyframes pGoldZoom {\n" + " 0% {margin-inline-start:" + marginZoom + ";}\n" + " 100% {margin-inline-start:-" + marginZoom + ";}\n" + "}" divGoldMoverZoom = createDiv(); divGoldMoverZoom.style.flexDirection = "row"; divGoldMoverZoom.style.marginInlineStart = marginZoom; divGoldMoverZoom.style.animation = "pGoldZoom 40s linear infinite"; divGoldZoom.appendChild(divGoldMoverZoom); pGoldZoom = []; for (let i = 0; i < 9; i++) { pGoldZoom[i] = createP(str(strPleaseWait)); pGoldZoom[i].style.width = "5cm"; pGoldZoom[i].style.color = "#FFE082"; pGoldZoom[i].style.fontSize = sizeHeaderText; pGoldZoom[i].style.fontFamily = "fontface2"; pGoldZoom[i].style.textAlign = "center"; pGoldZoom[i].style.whiteSpace = "nowrap"; pGoldZoom[i].style.justifyContent = "center"; divGoldMoverZoom.appendChild(pGoldZoom[i]); } // divProductsDrawerZoom = createDiv(); // divProductsDrawerZoom.style.position = "fixed"; // divProductsDrawerZoom.style.flexDirection = "column"; // divProductsDrawerZoom.style.backgroundColor = colorHeaderBackground1 + "bb"; // divProductsDrawerZoom.style.padding = "0.3cm"; // divProductsDrawerZoom.style.borderBottomLeftRadius = "0.5cm"; // divProductsDrawerZoom.style.borderTopLeftRadius = "0.5cm"; // divProductsDrawerZoom.style.zIndex = "12"; // divProductsDrawerZoom.style.top = "0cm"; // divProductsDrawerZoom.style.transition = "0.3s"; // divProductsDrawerZoom.style.opacity = 0; // divProductsDrawerZoom.style.display = "none"; // divProductsDrawerZoom.style.boxShadow = "0px 0px 10px #00000077"; // divProductsDrawerZoom.style.width = windowWidthCm / 2 + "cm"; // document.body.appendChild(divProductsDrawerZoom); // // productList = [strSheet, strRebar, strGirder, strProfile, strPipe, strCorner, strStud, strWire]; // productIconWhite = [imgSheetYellow, imgRebarYellow, imgGirderYellow, imgProfileYellow, imgPipeYellow, imgCornerYellow, imgStudYellow, imgWireYellow]; // const pathNames = ["قیمت-ورق", "قیمت-میلگرد", "قیمت-تیرآهن", "قیمت-پروفیل", "قیمت-لوله", "قیمت-نبشی", "قیمت-ناودانی", "قیمت-مفتولی"]; // for (let i = 0; i < productList.length; i++) { // const pimgDrawer = new PImgLink(str(strPriceList) + " " + str(productList[i]), productIconWhite[i], ""); // pimgDrawer.setTextSize(sizeHeaderText); // pimgDrawer.setAlt(str(productList[i])); // pimgDrawer.setImageRatio(1.6); // pimgDrawer.setTextColor("#ffffff"); // pimgDrawer.setBackground(colorless, "#ffffff33", "#ffffff55", "1000px"); // pimgDrawer.setWhiteSpace("nowrap"); // pimgDrawer.setLink(linksPath + pathNames[i], str(productList[i]), "_blank"); // pimgDrawer.p.style.marginRight = pimgDrawer.p.style.marginLeft = "0.3cm"; // pimgDrawer.style.alignItems = "center"; // pimgDrawer.style.justifyContent = "center"; // pimgDrawer.style.paddingInlineEnd = "auto"; // pimgDrawer.style.width = windowWidthCm / 2 + "cm"; // pimgDrawer.style.transition = "0.3s"; // setHoverPointer(pimgDrawer); // divProductsDrawerZoom.appendChild(pimgDrawer); // } return zoomHeader; } function createFooter() { footer = document.createElement("footer"); footer.style.paddingTop = "1%"; footer.style.paddingBottom = "1%"; footer.style.backgroundColor = colorHeaderBackground4; footer.style.position = "static"; footer.style.width = "100%"; footer.style.display = "flex"; footer.style.alignItems = "start"; footer.style.justifyContent = "center"; footer.style.flexDirection = "row"; footer.style.marginTop = "1cm"; footer.style.zIndex = "30"; const divContactUs = createDiv(); divContactUs.style.flexDirection = "column"; divContactUs.style.width = "16cm"; divContactUs.style.margin = "0.5cm"; footer.appendChild(divContactUs); const pContactUs = createP(str(strContactUs)); pContactUs.style.fontSize = sizeFooterText; pContactUs.style.fontWeight = "bold"; pContactUs.style.marginInlineStart = "3%"; pContactUs.style.marginBottom = "1%"; setDirMargin(pContactUs); divContactUs.appendChild(pContactUs); const pimgLocation = new PImgLink(str(strAddressFooter), imgLocation, ""); pimgLocation.setTextColor(colorText); pimgLocation.setTextSize(sizeHeaderText); pimgLocation.setWhiteSpace("normal"); pimgLocation.setAlt("Location"); pimgLocation.setLink(linkLocation, "", true); setDirMargin(pimgLocation); setHoverAnimation(pimgLocation, "pimgFooter"); divContactUs.appendChild(pimgLocation); const pimgPhone = new PImgLink(str(strPhoneFooter), imgPhoneGray, ""); pimgPhone.setTextColor(colorText); pimgPhone.setTextSize(sizeHeaderText); pimgPhone.setWhiteSpace("normal"); pimgPhone.setAlt("Call"); pimgPhone.setLink(linkTel1, "", false); setDirMargin(pimgPhone); setHoverAnimation(pimgPhone, "pimgFooter"); divContactUs.appendChild(pimgPhone); const pimgWorkTime = new PImg(str(strWorkTimeFooter), imgWatch, ""); pimgWorkTime.setTextColor(colorText); pimgWorkTime.setTextSize(sizeHeaderText); pimgWorkTime.setWhiteSpace("normal"); pimgWorkTime.setAlt("Work-Time"); setDirMargin(pimgWorkTime); divContactUs.appendChild(pimgWorkTime); const divSupports = createDiv(); divSupports.style.flexDirection = "row"; divSupports.style.width = "100%"; divContactUs.appendChild(divSupports); const supportLinks = [linkWhatsappSupport, linkTelegramSupport, linkEitaaSupport]; const supportTexts = [strWhatsappSupport, strTelegramSupport, strEitaaSupport]; const supportImages = [imgWhatsapp, imgTelegram, imgEitaa]; const supportColors = [colorWhatsapp, colorTelegram, colorEitaa]; const supportClasses = ["pimgWhatsapp", "pimgTelegram", "pimgEitaa"]; const supportAlts = ["Whatsapp-Support", "Telegram-Support", "Eitaa-Support"]; for (let i = 0; i < supportLinks.length; i++) { var pimgSupport = new PImgLink(str(supportTexts[i]), supportImages[i], ""); pimgSupport.style.margin = "1%"; pimgSupport.style.padding = "1%"; pimgSupport.style.width = "31%"; pimgSupport.style.borderRadius = "1000px"; pimgSupport.style.borderColor = supportColors[i]; pimgSupport.style.borderWidth = "2px"; pimgSupport.style.borderStyle = "solid"; pimgSupport.style.backgroundColor = ""; pimgSupport.setTextColor(""); pimgSupport.setTextSize(sizeHeaderText); pimgSupport.setImageRatio(1.4); // pimgSupport.setTextColor("#ffffff"); pimgSupport.setAlt(supportAlts[i]); // pimgSupport.style.backgroundColor = supportColors[i]; pimgSupport.className = supportClasses[i]; pimgSupport.style.transition = "0.3s"; pimgSupport.setLink(supportLinks[i], "", true); divSupports.appendChild(pimgSupport); } const pRightsReserved = createP(str(strRightsReserved) + "
" + str(strITTeam)); pRightsReserved.style.margin = "0.2cm"; pRightsReserved.style.marginInlineEnd = "auto"; pRightsReserved.style.fontSize = sizeHeaderText; pRightsReserved.style.fontWeight = "bold"; pRightsReserved.style.whiteSpace = "normal"; divContactUs.appendChild(pRightsReserved); const divFastAccess = createDiv(); divFastAccess.style.flexDirection = "column"; divFastAccess.style.width = "9cm"; divFastAccess.style.margin = "0.5cm"; divFastAccess.style.marginInlineStart = "3%"; footer.appendChild(divFastAccess); const pFastAccess = createP(str(strFastAccess)); pFastAccess.style.fontSize = sizeFooterText; pFastAccess.style.fontWeight = "bold"; pFastAccess.style.marginInlineStart = "12%"; pFastAccess.style.marginBottom = "2%"; setDirMargin(pFastAccess); divFastAccess.appendChild(pFastAccess); const divFastAccesses = createDiv(); divFastAccesses.style.width = "100%"; divFastAccesses.style.flexDirection = "row"; divFastAccess.appendChild(divFastAccesses); const divFastAccesses1 = createDiv(); divFastAccesses1.style.flexDirection = "column"; divFastAccesses1.style.width = "50%"; divFastAccesses.appendChild(divFastAccesses1); const divFastAccesses2 = createDiv(); divFastAccesses2.style.flexDirection = "column"; divFastAccesses2.style.width = "50%"; divFastAccesses.appendChild(divFastAccesses2); texts = [strIronMarket, strCarMarket, strCurrencyMarket, strPriceList, strSpecialPrice, strContactSaleTeam]; links = [linkSteelMarket, linkCarMarket, linkCryptoMarket, linkPriceList, linkSpecialSell, linkTel1]; for (let i = 0; i < 3; i++) { // const pFastAccesses1 = new PLink(str(texts[i])); // pFastAccesses1.setTextColor(colorText); // pFastAccesses1.setTextSize(sizeHeaderText); // pFastAccesses1.setLink(links[i], "", true); // setDirMargin(pFastAccesses1); // setHoverAnimation(pFastAccesses1, "pimgFooter"); // divFastAccesses1.appendChild(pFastAccesses1); const pFastAccesses1 = createP(str(texts[i])); pFastAccesses1.style.color = colorText; pFastAccesses1.style.fontSize = sizeHeaderText; pFastAccesses1.style.padding = '0.1cm 0.2cm'; setDirMargin(pFastAccesses1); setHoverAnimation(pFastAccesses1, "pimgFooter"); divFastAccesses1.appendChild(pFastAccesses1); } for (let i = 3; i < texts.length; i++) { const pFastAccesses2 = new PLink(str(texts[i])); pFastAccesses2.setTextColor(colorText); pFastAccesses2.setTextSize(sizeHeaderText); pFastAccesses2.setLink(links[i], "", true); setDirMargin(pFastAccesses2); setHoverAnimation(pFastAccesses2, "pimgFooter"); divFastAccesses2.appendChild(pFastAccesses2); } const divFollowUs = createDiv(); divFollowUs.style.flexDirection = "column"; divFollowUs.style.marginTop = "0.5cm"; divFastAccess.appendChild(divFollowUs); const pFollowUs = createP(str(strFollowUs)); pFollowUs.style.fontSize = sizeText2; pFollowUs.style.fontWeight = "bold"; pFollowUs.style.marginRight = "auto"; pFollowUs.style.marginLeft = "auto"; divFollowUs.appendChild(pFollowUs); const divSocials = createDiv(); divSocials.style.flexDirection = "row"; divFollowUs.appendChild(divSocials); const socialImages = [imgInstagram, imgTelegram, imgTwitter, imgLinkedin, imgReddit, imgPinterest, imgWhatsapp, imgEitaa]; const socialImagesGray = [imgInstagramGray, imgTelegramGray, imgTwitterGray, imgLinkedinGray, imgRedditGray, imgPinterestGray, imgWhatsappGray, imgEitaaGray]; const socialAlts = ["Instagram", "Telegram", "Twitter", "Linkedin", "Reddit", "Pinterest", "Whatsapp", "Eitaa"]; const socialLinks = [linkInstagramSocial, linkTelegramSocial, linkTwitterSocial, linkLinkedinSocial, linkRedditSocial, linkPinterestSocial, linkWhatsappSupport, linkEitaaSocial]; for (let i = 0; i < socialImages.length; i++) { const aSocial = createA(socialLinks[i], socialAlts[i]); aSocial.style.width = "1cm"; aSocial.style.height = "1cm"; aSocial.style.margin = "0.1cm"; aSocial.style.backgroundImage = "url(" + socialImagesGray[i] + ")"; aSocial.style.backgroundSize = "contain"; aSocial.style.backgroundRepeat = "no-repeat"; aSocial.style.backgroundPosition = "center center"; divSocials.appendChild(aSocial); const imgSocial = document.createElement("img"); imgSocial.style.width = "1cm"; imgSocial.style.height = "1cm"; imgSocial.src = socialImages[i]; imgSocial.alt = socialAlts[i]; setHoverAnimation(imgSocial, "imgSocial"); imgSocial.style.borderRadius = "0px"; aSocial.appendChild(imgSocial); } const divConfidence = createDiv(); divConfidence.style.flexDirection = "column"; divConfidence.style.width = "7cm"; divConfidence.style.margin = "0.5cm"; // divConfidence.style.marginInlineStart = "4%"; footer.appendChild(divConfidence); const pConfidence = createP(str(strConfidence)); pConfidence.style.fontSize = sizeFooterText; pConfidence.style.fontWeight = "bold"; pConfidence.style.marginBottom = "3%"; pConfidence.style.marginRight = pConfidence.style.marginLeft = "auto"; setDirMargin(pConfidence); divConfidence.appendChild(pConfidence); const srcs = [imgEnamad]; links = [linkEnamad]; for (let i = 0; i < srcs.length; i++) { const a = createA(links[i], ""); a.target = "_blank"; a.style.backgroundColor = "#ffffff"; a.style.borderRadius = sizeHeaderText; a.style.display = "flex"; a.style.alignItems = "center"; divConfidence.appendChild(a); const img = document.createElement("img"); img.style.width = "2cm"; img.style.height = "2cm"; img.style.margin = "0.4cm"; img.alt = "Enamad"; img.src = srcs[i]; a.appendChild(img); } return footer; } function createZoomFooter() { zoomFooter = document.createElement("footer"); zoomFooter.style.backgroundColor = colorHeaderBackground4; zoomFooter.style.position = "static"; zoomFooter.style.width = windowWidthCm; zoomFooter.style.display = "flex"; zoomFooter.style.alignItems = "center"; zoomFooter.style.justifyContent = "center"; zoomFooter.style.flexDirection = "column"; zoomFooter.style.marginTop = percent(3); zoomFooter.style.zIndex = "1"; const divContactUs = createDiv(); divContactUs.style.flexDirection = "column"; divContactUs.style.alignItems = "start"; divContactUs.style.marginTop = "1%"; zoomFooter.appendChild(divContactUs); const pContactUs = createP(str(strContactUs)); pContactUs.style.fontSize = sizeFooterText; pContactUs.style.fontWeight = "bold"; pContactUs.style.marginInlineStart = "3%"; setDirMargin(pContactUs); divContactUs.appendChild(pContactUs); const pimgLocation = new PImgLink(str(strAddressFooter), imgLocation, ""); pimgLocation.setTextColor(colorText); pimgLocation.setTextSize(sizeHeaderText); pimgLocation.setWhiteSpace("normal"); pimgLocation.setAlt("Location"); setHoverAnimation(pimgLocation, "pimgFooter"); pimgLocation.setLink(linkLocation, "", true); setDirMargin(pimgLocation); divContactUs.appendChild(pimgLocation); const pimgPhone = new PImg(str(strPhoneFooter), imgPhoneGray, ""); pimgPhone.setTextColor(colorText); pimgPhone.setTextSize(sizeHeaderText); pimgPhone.setWhiteSpace("normal"); pimgPhone.setAlt("Call"); setHoverPointer(pimgPhone); setHoverAnimation(pimgPhone, "pimgFooter"); pimgPhone.addEventListener("click", function (event) { window.location.href = linkTel1; }); setDirMargin(pimgPhone); divContactUs.appendChild(pimgPhone); const pimgWorkTime = new PImg(str(strWorkTimeFooter), imgWatch, ""); pimgWorkTime.setTextColor(colorText); pimgWorkTime.setTextSize(sizeHeaderText); pimgWorkTime.setWhiteSpace("normal"); pimgWorkTime.setAlt("Work-Time"); setDirMargin(pimgWorkTime); divContactUs.appendChild(pimgWorkTime); const divConfidence = createDiv(); divConfidence.style.flexDirection = "column"; divConfidence.style.marginTop = "1%"; divConfidence.style.marginBottom = "0.5cm"; zoomFooter.appendChild(divConfidence); const pConfidence = createP(str(strConfidence)); pConfidence.style.fontSize = sizeFooterText; pConfidence.style.fontWeight = "bold"; pConfidence.style.marginBottom = "1%"; setDirMargin(pConfidence); divConfidence.appendChild(pConfidence); const srcs = [imgEnamad]; links = [linkEnamad]; for (let i = 0; i < srcs.length; i++) { const a = createA(links[i], ""); a.target = "_blank"; a.style.backgroundColor = "#ffffff"; a.style.borderRadius = "10px"; a.style.display = "flex"; a.style.alignItems = "center"; divConfidence.appendChild(a); const img = document.createElement("img"); img.style.width = "1.6cm"; img.style.height = "1.6cm"; img.style.margin = "0.2cm"; img.alt = "Enamad"; img.src = srcs[i]; a.appendChild(img); } return zoomFooter; } function getHeaderNews() { const postData = new FormData(); postData.append('cookie', localStorage.getItem('cookie')); const xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (this.readyState === 4) { if (this.status === 200) { headerGetData = JSON.parse(this.responseText); if (headerGetData["result"] === "ok") { setData(); } else { // window.alert(str(strErrServerConnection)); } } else { // window.alert(str(strErrServerConnection) + "\n" + this.messageerror); } spinner.style.opacity = 0; } }; xhr.open("POST", apiGetHeaderNews); xhr.send(postData); } function animateHeaderNews(headerNews) { if (!zoom) { let currentIndex = -1; pHeaderNews.addEventListener("animationiteration", function (event) { setTimeout(function () { currentIndex++; currentIndex = currentIndex === headerNews.length ? 0 : currentIndex; pHeaderNews.innerHTML = getPersianDigit(getElapsedTime(Date.now() / 1000 - headerNews[currentIndex]["publishTime"])) + " " + str(strAgo) + " - " + headerNews[currentIndex][language]; }, 250); }, false); pHeaderNews.dispatchEvent(new Event("animationiteration")); pHeaderNews.style.animation = "pHeaderNews 5s ease 0s infinite"; style.textContent += "@keyframes pHeaderNews { 0%{ margin-bottom:1%; opacity:1;} 5%{ margin-bottom:-2%; opacity:0;} 6%{margin-bottom:6%; opacity:0;} 10%{ margin-bottom:1%; opacity:1;} }"; } } function showHeader() { let resized = true; window.addEventListener("resize", function () { resized = true; }); window.dispatchEvent(new Event("resize")); setInterval(function () { if (resized) { if (zoom) { if (HeaderZoomStatus === "none" || HeaderZoomStatus === "default") { headerBaseChange(); } HeaderZoomStyle(); HeaderZoomStatus = "zoom"; } else if (!zoom) { if (HeaderZoomStatus === "none" || HeaderZoomStatus === "zoom") { headerBaseChange(); } HeaderDefaultStyle(); HeaderZoomStatus = "default"; } resized = false; } }, 200); } function showFooter() { let resized = false; window.addEventListener("resize", function () { resized = true; }); window.dispatchEvent(new Event("resize")); setInterval(function () { if (resized) { if (zoom) { if (FooterZoomStatus === "none" || FooterZoomStatus === "default") { footerBaseChange(); } FooterZoomStyle(); FooterZoomStatus = "zoom"; } else if (!zoom) { if (FooterZoomStatus === "none" || FooterZoomStatus === "zoom") { footerBaseChange(); } FooterDefaultStyle(); FooterZoomStatus = "default"; } resized = false; } }, 200); } function headerBaseChange() { if (!zoom) { if (zoomHeader !== null) { zoomHeader.remove(); divMenu.remove(); tiraLayout.remove(); // divProductsDrawerZoom.remove(); menuStatus = "close"; } createHeader(); document.body.appendChild(header); if (headerGetData !== null && headerGetData['result'] === 'ok') { const strs = [strGold, strDollar, strBitcoin, strBourse, strSekeb, strNim, strRob, strTether, strEur]; const values = ['gold18', 'dollar', 'bitcoin', 'bourse', 'sekeb', 'nim', 'rob', 'crypto-tether-irr', 'price_eur']; for (let i = 0; i < pGold.length; i++) { pGold[i].innerHTML = (str(strs[i]) + ": " + (language === EN ? headerGetData['prices'][values[i]] : getPersianSplitterDigit(headerGetData['prices'][values[i]])) + " " + (i === 2 ? str(strDollar) : (i === 3 ? "" : str(strIRT)))); } } } else { if (header !== null) { header.remove(); } createZoomHeader(); document.body.appendChild(zoomHeader); if (headerGetData !== null && headerGetData['result'] === 'ok') { const strs = [strGold, strDollar, strBitcoin, strBourse, strSekeb, strNim, strRob, strTether, strEur]; const values = ['gold18', 'dollar', 'bitcoin', 'bourse', 'sekeb', 'nim', 'rob', 'crypto-tether-irr', 'price_eur']; for (let i = 0; i < pGoldZoom.length; i++) { pGoldZoom[i].innerHTML = (str(strs[i]) + ": " + (language === EN ? headerGetData['prices'][values[i]] : getPersianSplitterDigit(headerGetData['prices'][values[i]])) + " " + (i === 2 ? str(strDollar) : (i === 3 ? "" : str(strIRT)))); } } } getHeaderNews(); setData(); } function footerBaseChange() { if (!zoom) { if (zoomFooter !== null) { zoomFooter.remove(); } createFooter(); document.body.appendChild(footer); } else { if (footer !== null) { footer.remove(); } createZoomFooter(); document.body.appendChild(zoomFooter); } setData(); } function HeaderZoomStyle() { if (header !== null) { header.remove(); } document.body.style.paddingTop = zoomHeader.style.height; divMenu.style.width = "5cm"; divMenu.style.height = windowHeightCm + "cm"; divMenu.style.display = "flex"; if (menuStatus === "close") { divMenu.style.right = "-5cm"; } const divGoldWidthZoom = windowWidthCm * 9 / 10; divGoldZoom.style.width = divGoldWidthZoom + "cm"; // if (pimgOptionsMouseOver) { // divProductsDrawerZoom.style.left = "0cm"; // } else { // divProductsDrawerZoom.style.left = windowWidthCm / 2 + "cm"; // } // divProductsDrawerZoom.style.width = windowWidthCm / 2 + "cm"; // divProductsDrawerZoom.style.top = "5cm"; aLogoTitle.style.right = percent(14); } function HeaderDefaultStyle() { if (zoomHeader !== null) { zoomHeader.remove(); } document.body.style.paddingTop = header.style.height; // divMenu.style.width = windowWidthCm / 2 + "cm"; // divMenu.style.height = windowHeightCm + "cm"; // divMenu.style.display = "none"; // if (menuStatus === "open") { // tiraLayout.dispatchEvent(new Event("click")); // } const divGoldWidth = headerWidthNumeric / 2; divGold.style.width = divGoldWidth + "cm"; divProductsDrawer.style.right = windowWidthCm / 2 - 5.5 + "cm"; divProductsDrawer.style.top = header.clientHeight - divProductsDrawer.clientHeight + "px"; // for (let i = 0; i < divDrawer2.length; i++) { // divDrawer2[i].style.top = header.clientHeight + i * 0.5 + 'cm'; // divDrawer2[i].style.right = windowWidthCm / 2 - 9.5 + "cm"; // } for (let i = 0; i < divDrawer2Header.length; i++) { divDrawer2Header[i].style.top = 3 + i + 'cm'; divDrawer2Header[i].style.right = windowWidthCm / 2 + 0.6 + "cm"; closeDrawerHeader(i); } } function FooterZoomStyle() { if (footer !== null) { footer.remove(); } } function FooterDefaultStyle() { if (zoomFooter !== null) { zoomFooter.remove(); } } function setData() { if (headerGetData !== null && headerGetData['result'] === 'ok') { animateHeaderNews(headerGetData["headerNews"]); if (headerGetData["cookie"]) { if (!zoom) { pRegLogin.p.innerHTML = str(strMyProfile); pRegLogin.setLink("", str(strMyProfile), false); pRegLogin.addEventListener("click", function () { localStorage.setItem('cookie', ''); }); } else { pRegLoginZoom.p.innerHTML = str(strMyProfile); pRegLoginZoom.setLink("", str(strMyProfile), false); pRegLoginZoom.addEventListener("click", function () { localStorage.setItem('cookie', ''); }); } if (window.location.pathname === "/login") { window.location.replace(linkHome); } } else { if (!zoom) { pRegLogin.p.innerHTML = str(strRegLogin); pRegLogin.setLink(linkRegLogin + encodeUrlSearch({"origin": "https://" + window.location.host}), str(strRegLogin), false); } else { pRegLoginZoom.p.innerHTML = str(strRegLogin); pRegLoginZoom.setLink(linkRegLogin + encodeUrlSearch({"origin": "https://" + window.location.host}), str(strRegLogin), false); } localStorage.setItem('cookie', ''); } const strs = [strGold, strDollar, strBitcoin, strBourse, strSekeb, strNim, strRob, strTether, strEur]; const values = ['gold18', 'dollar', 'bitcoin', 'bourse', 'sekeb', 'nim', 'rob', 'crypto-tether-irr', 'price_eur']; if (!zoom) { for (let i = 0; i < pGold.length; i++) { pGold[i].innerHTML = (str(strs[i]) + ": " + (language === EN ? headerGetData['prices'][values[i]] : getPersianSplitterDigit(headerGetData['prices'][values[i]])) + " " + (i === 2 ? str(strDollar) : (i === 3 ? "" : str(strIRT)))); } } else { for (let i = 0; i < pGoldZoom.length; i++) { pGoldZoom[i].innerHTML = (str(strs[i]) + ": " + (language === EN ? headerGetData['prices'][values[i]] : getPersianSplitterDigit(headerGetData['prices'][values[i]])) + " " + (i === 2 ? str(strDollar) : (i === 3 ? "" : str(strIRT)))); } } } }