
function n_im(){
	im_index++
	if(im_index == image_array.length){
		im_index = 0
	}
	document.images["id"].src = "/images/products/" + image_array[im_index]
	document.images["id"].width = w_array[im_index]
	document.images["id"].height = h_array[im_index]
}
function p_im(){
	im_index--
	if(im_index < 0){
		im_index = image_array.length - 1
	}
	document.images["id"].src = "/images/products/" + image_array[im_index]
	document.images["id"].width = w_array[im_index]
	document.images["id"].height = h_array[im_index]
}

function showDIV(ID){
   with(document.getElementById('dv'+ID).style){
      display = display == 'none' ? 'block' : 'none';
   }
return false;
}

function show(url,wi,he,ran_win) {
        myWindow=window.open(url,ran_win,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,height=" + he + ",width=" + wi);
        return false;
}

function show2(url,wi,he,ran_win) {
        myWindow=window.open(url,ran_win,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,height=" + he + ",width=" + wi);
}

function setBookmark() {
        HomePage = top.location.href;
        window.external.AddFavorite(HomePage,'BabyElit - Интернет магазин дестких товаров');
}

function setNSHomepage(URL) {  // this HAS to be signed if it is to run on the web
        var Text = 'Ваш броузер не поддерживает функцию\n';

        Text += ' автоматического добавления сайта\n';
        Text += 'в \'Избранное\'\n';
        Text += 'Вы можете добавить его вручную.';

        if (confirm(Text)) {
                        netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesWrite");
                  navigator.preference('browser.startup.homepage',URL);
        }
}

function preSetHome(lnk){
        HomePage = top.location.href;
        if (document.layers) {
                setNSHomepage(HomePage);
        } else if (isIE5up) {
                 lnk.style.behavior='url(#default#homepage)';
                 lnk.setHomePage(HomePage);
        } else {
                alert('К сожалению, Ваш броузер не поддерживает даную функцию.\n Измените даную настройку вручную');
        }
        return false;
}

function displayImage(targetURL, caption, width, height,cat){
        if (width == null || width == "")
                width = 600;
        if (height == null || height == "")
                height = 430;
        if(targetURL.indexOf(".jpg") != -1 || targetURL.indexOf(".gif") != -1
                || targetURL.indexOf(".jpeg") != -1 || targetURL.indexOf(".png") != -1)
                window.open("/displayImage.php?image="+targetURL+"&title="+caption+"&cat="+cat,"","titlebar=no,toolbar=no,location=no,directories=no,menubar=no,resizable=yes,scrollbars=yes,width="+width+",height="+height+",status=no");
		else
			alert('Данный файл не является изображением');
        return false;
}