var imageWin = null; function showPopupImage(image_url, image_width, image_height){ var w = screen.width; var h = screen.height; var ww = image_width * 1 + 20; var wh = image_height * 1 + 35; var wx = (w - ww)/2; var wy = (h - wh)/2; if(imageWin != null){ imageWin.close(); } imageWin = null; imageWin = window.open( "", "ProductImageWindow", "titlebar=yes, toolbar=no, menubar=no, status=no, directories=no, resizable=no, scrollbars=no, top=" + wy.toString() + ", left=" + wx.toString() + ", width=" + ww.toString() + ", height=" + wh.toString() + "" ); while(imageWin==null); imageWin.focus(); imageWin.document.body.innerHTML = ""; imageWin.document.write(''); imageWin.document.write('
'); imageWin.document.write('
Close Window
'); imageWin.document.write(''); imageWin.width = ww; imageWin.height = wh; } var filemanagerWin = null; function showFileManager(folder){ var w = screen.width; var h = screen.height; var window_width = 780; var window_height = 600; var wx = (w - window_width)/2; var wy = (h - window_height)/2; if(filemanagerWin != null){ filemanagerWin.close(); } filemanagerWin = null; filemanagerWin = window.open( "admin.php?p=filemanager&printing=true&folder=" + folder, "FileManagerWindow", "titlebar=yes, toolbar=yes, addressbar=no, menubar=no, status=no, directories=no, resizable=yes, scrollbars=yes, top=" + wy.toString() + ", left=" + wx.toString() + ", width=" + window_width.toString() + ", height=" + window_height.toString() + "" ); while(filemanagerWin==null); filemanagerWin.focus(); } function isEmail(entry){ var rex= /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,5})(\]?)$/; return rex.test(entry); } function isDate(y,m,d){ if((m<1) || (m>12)) return false; if((m==4 || m==6 || m==9 || m==11) && (d > 30)) return false; if((m==2) && (d > 29)) return false; var isVYear = (y % 4 == 0) && ((y % 100 != 0) || (y % 400 == 0)); if(m == 2 && !isVYear && d>28) return false; return true; } function isColor(color){ var rex = /^((\#([a-fA-F0-9]{6}))|([a-zA-Z]{1,100})){1}$/ // var rex = /^(\#([a-fA-F0-9]{6}))|([a-zA-Z]{1,100})$/ return rex.test(color); } function toDays(y, m, d){ return y * 366 + m * 32 + d * 1; } function checkNumber(number){ //check numbers in 123,123,122.23 or 123123123.123 or 123,123,123 or 123123123 format var rex = /^((\d{1,3},)?(\d{3},)?(\d{3})|(\d{1,}))((\.(\d{1,}))?)$/; return rex.test(number); } function isInt(number){ var rex = /^(\d{1,})$/; return rex.test(number); } function isText(txt){ var rex = /.{0,}((\w{1,})|(\d{1,})|([\~\!\@\#\$\%\^\&\*\(\)\_\+\`\-\=\{\}\[\]\:\;\"\'\<\>\,\.\?\/\\\|]{1,2})).{0,}/; return rex.test(txt); } function isURL(url){ //var rex = /^http:\/\/([\w-]+\.)+[\w\-]*(/[\w- ./?%=]*)?$/ //return rex.test(url); } function normalizeNumber(number){ var s = number; var ss = ""; var c = ""; var rex = /^(\d{1})|(\.{1})$/; for(i=0; i < s.length; i++){ c = s.charAt(i); if(rex.test(c)){ ss = ss + c; } } return parseFloat(ss); } function hideBlockDiv(menu_id){ document.getElementById('block_' + menu_id).style.display = "none"; //document.getElementById('menuimg_' + menu_id).src = site_skin_images + "/menu_tree_arrow_right.gif"; } function showBlockDiv(menu_id){ document.getElementById('block_' + menu_id).style.display = "block"; //document.getElementById('menuimg_' + menu_id).src = site_skin_images + "/menu_tree_arrow_down.gif"; } function showHideBlock(menu_id){ //return false; alert(document.getElementById('block_' + menu_id)); if(document.getElementById('block_' + menu_id).style.display == "block") { hideBlockDiv(menu_id); } else{ showBlockDiv(menu_id); } } function checkAddCurrency(frm){ if(frm.elements["code"].value == ""){ alert("Please enter currency code!"); frm.elements["code"].focus(); return false; } if(frm.elements["title"].value == ""){ alert("Please enter currency title!"); frm.elements["title"].focus(); return false; } if(!checkNumber(frm.elements["exchange_rate"].value)){ alert("Please enter valid exchange rate!"); frm.elements["exchange_rate"].focus(); return false; } if(frm.elements["symbol_left"].value == "" && frm.elements["symbol_right"].value == ""){ alert("Please enter left or right symbol!"); frm.elements["symbol_left"].focus(); return false; } } function CreateInvoice(URL, winName, w, h, l, t, act) { var logo = 0; //alert(act); feature = "location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes,left=0,top=0,width=600,height=800"; if (act!="print_invoice") { if(confirm("Are you going to send email?") && act!="email_error") { feature = "location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes,left="+l+",top="+t+",width="+w+",height="+h; newWin = window.open(URL+"&logo="+logo+"&act="+act,winName,feature); setTimeout("newWin.close()", 5000); //after 5 seconds alert("Sent Successful!"); window.focus(); //newWin.focus(); return true; } else { alert("Sent Failure!"); return false; } } else { newWin = window.open(URL+"&logo="+logo+"&act="+act,winName,feature); newWin.focus(); } } function PrintFunction(data, winName, w, h, l, t, act) { var p = document.row_form.printthing.options[document.row_form.printthing.selectedIndex].value; //alert(URL); if (p!="") { feature = "location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes,left="+l+",top="+t+",width="+w+",height="+h; newWin = window.open(data+p+"&act="+act,winName,feature); newWin.focus(); } }