// описываем пользовательский объект и его методы //
function valid(){
this.msgBox = function (str){
alert(str);
};
this.trim = function(str){
return str.replace(/(^\s+)|(\s+$)/g,"");
};
this.validMail = function(str){
return str.match(/\b(^([\.0-9a-zA-Z_-]+@[0-9a-zA-Z_\.-]+(\.[a-zA-Z]{2,4}){1,2})$)\b/gi);
};
this.validNumber = function(str){
return str.match(/\b(^([0-9]+)$)\b/gi);
};
this.openWindow = function(){
var left= (screen.width / 2) - (arguments[1] / 2);
var top = (screen.height / 2) - (arguments[2] / 2);
return window.open(arguments[0], "newWindow","left=" + left + ",top=" + top + ",width=" + arguments[1] + ",height=" + arguments[2] + ",resizable=" + arguments[3] + ",scrollbars=" + arguments[4]);
};
this.validInputBox = function(form){
var count = form.elements.length;
var bool = false;
for (i=0; iscreen.width || height>screen.height)
wnd = window.open("/shop/photos/" + product_id, "imageWindow",
"left=" + left + ",top=" + top + ",width=" + width + ",height=" + height +",scrollbars=yes");
else
wnd = window.open("/shop/photos/" + product_id, "imageWindow",
"left=" + left + ",top=" + top + ",width=" + width + ",height=" + height);
return false;
}
function openType(type_id,base_url) {
var width=600;
var height=500;
var left= (screen.width / 2) - (width / 2);
var top = (screen.height / 2) - (height / 2);
if (width>screen.width || height>screen.height)
wnd = window.open(base_url + "/shop/type/" + type_id, "imageWindow",
"left=" + left + ",top=" + top + ",width=" + width + ",height=" + height +",scrollbars=yes");
else
wnd = window.open(base_url + "/shop/type/" + type_id, "imageWindow",
"left=" + left + ",top=" + top + ",width=" + width + ",height=" + height);
/* var doc = wnd.document;
doc.open();
doc.write('Увеличенное изображение' +
'' +
'
' +
'
'
);
doc.close();
wnd.focus();*/
return false;
}
function openImg(src,width,height) {
var left= (screen.width / 2) - (width / 2);
var top = (screen.height / 2) - (height / 2);
if (width>screen.width || height>screen.height)
wnd = window.open("", "imageWindow",
"left=" + left + ",top=" + top + ",width=" + width + ",height=" + height +",scrollbars=yes");
else
wnd = window.open("", "imageWindow",
"left=" + left + ",top=" + top + ",width=" + width + ",height=" + height);
var doc = wnd.document;
doc.open();
doc.write('Увеличенное изображение' +
'' +
'
' +
'
'
);
doc.close();
wnd.focus();
return false;
}
function sel(elem,url){
//location.href=url + '/shop/?search_product=' + elem.value;
location.href=url + "/shop/" + elem.value;
}
function validate(form){
var goodEmail = form['email'].value.match(/\b(^([\.0-9a-zA-Z_-]+@[0-9a-zA-Z_\.-]+(\.[a-zA-Z]{2,4}){1,2})$)\b/gi);
if (!goodEmail){
alert('Неправельный формат E-mail');
return false;
}
return true;
}
function trim(s){return s.replace(/(^\s+)|(\s+$)/g,"");}
function popup(file,width,height)
{
window.open(file,"site_path","height="+height+",width="+width+",status=no,location=no,toolbar=no,directories=no,resizable=yes,scrollbars=yes,menubar=no,top=10,left=10");
}
function in_new_window(file,width,height)
{
window.open(file,"site_path","height="+height+",width="+width+",status=no,location=no,toolbar=no,directories=no,resizable=yes,scrollbars=yes,menubar=no,top=10,left=10");
return false;
}
function pop_up(file,width,height)
{
window.open(file,"site_path","menubar=false,height="+height+",width="+width);
}
function makeSiteLink(name) {
if (!window.js_base_url) {
str = document.location.toString();
js_base_url = str.replace("/javascript/editor/scripts/hyperlink.htm","");
js_base_url = js_base_url.replace("/javascript/editor/scripts/moz/hyperlink.htm","");
}
popup(js_base_url+'/admin/index.php?mod=tree&action=mini_browser&returnname='+name,'600','400');
}
function retBack(obj, str) {
window.close();
obj.value = str;
}
function insertIntoWYSIWYG(str) {
doc = "window.opener";
for ( property in eval(doc) ) {
fullPropertyName = "document." + property;
if (fullPropertyName.indexOf("document.myStyle")!=-1) {
objName = fullPropertyName.replace("document.myStyle", "");
break;
}
}
objName = eval(doc+".window."+objName);
objName.insertCustomTag(str);
self.window.close();
}
function check4compare(obj) {
for(i=0; i