var slideShowSpeed 5000 var Pic new Array var Ref new Array var Ref_na

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
var slideShowSpeed = 5000;
var Pic = new Array();
var Ref = new Array();
var Ref_name = new Array();
var Price = new Array();
<?php
if(isset($_GET['cat']))
{
$cat1=$_GET['cat'];
$cat1 = stripslashes($cat1);
$cat1 = htmlspecialchars($cat1);
$cat1 = trim($cat1);
}
if(isset($_GET['price1']))
{
$price1=$_GET['price1'];
$price1 = stripslashes($price1);
$price1 = htmlspecialchars($price1);
$price1 = trim($price1);
$price2=$price1-1000;
$price3=$price1+1000;
}
$db = mysql_connect ("localhost","mebel-baby-ua","erhdthcbz");
mysql_select_db ("mebel-baby-ua",$db);
/* Выбираем из таблицы все категории где родитель переменная $a */
//$result = mysql_query("SELECT productID, name, Price, url, default_picture FROM MB_category_products INNER JOIN MB_products using(productID) WHERE categoryID='$cat1' ORDER BY RAND() LIMIT 30",$db) or die('Произошла ошибка!');
$result = mysql_query("SELECT pro.productID, name, Price, url, default_picture FROM MB_product_related re INNER JOIN MB_products pro ON re.relatedID = pro.productID INNER JOIN MB_category_products cat ON re.relatedID = cat.productID WHERE re.productID='$cat1' ORDER BY RAND()",$db) or die('Произошла ошибка!');
$myrow = mysql_fetch_array($result);
if (!empty($myrow))
{
/* выводим ы цикле категории */
$n=0;
do
{
$name1=$myrow['name'];
if ((strlen($name1))>20)
{
$name1=(substr($name1, 0, 18));
$name1.='...';
}
$name1 = str_replace('"', '',$name1);
$name1 = str_replace("'","",$name1);
echo "Ref[".$n."] = 'http://www.mebel-baby.com.ua/".$myrow['url'].".html'; ";
echo "Ref_name[".$n."] = '".$name1."'; ";
echo "Price[".$n."] = '".$myrow['Price']."'; ";
$product[$n]=$myrow['default_picture'];
$n=$n+1;
}
while ($myrow = mysql_fetch_array($result));
$k=0;
do
{
$image=$product[$k];
$result = mysql_query("SELECT filename FROM MB_product_pictures WHERE photoID='$image'",$db);
if (!$result)
{
echo "<p>Запрос на выборку данных не прошел! Напишите об этом администратору admin@mebel-baby.com.ua. <strong>Код ошибки:<strong></p>";
exit(mysql_error());
}
if (mysql_num_rows($result) > 0)
{
$myrow = mysql_fetch_array($result);
echo "Pic[".$k."] = 'http://www.mebel-baby.com.ua/products_pictures/".$myrow['filename']."'; ";
$k=$k+1;
}
else
{
$myrow = mysql_fetch_array($result);
echo "Pic[".$k."] = 'http://www.mebel-baby.com.ua/products_pictures/mebel_baby_no_img.jpg'; ";
$k=$k+1;
}
}
while ($k < $n );
}
?>
var t;
var t1;
var b;
var k;
var j = -1;
var p = Pic.length;
var interval = 1000;
function hideSlideShow() {
$('#SlideShow img[width=140]').fadeOut(interval);
$('#title a').fadeOut(interval);
$('#all_price span').fadeOut(interval);
t1=setTimeout(runSlideShow, interval+100);
}
function runSlideShow() {
if (j > (p - 2)) j = -1;
j = j+1;
$('#SlideShow1').attr( { src: Pic[j]});
$('#aaa_link').attr('href', Ref[j]);
$('#aaa').attr('href', Ref[j]);
$('#aaa').text(Ref_name[j]);
$('#price1').text(Price[j]);
if (j > (p - 2)) j = -1;
j = j+1;
$('#SlideShow2').attr( { src: Pic[j]});
$('#bbb_link').attr('href', Ref[j]);
$('#bbb').attr('href', Ref[j]);
$('#bbb').text(Ref_name[j]);
$('#price2').text(Price[j]);
if (j > (p - 2)) j = -1;
j = j+1;
$('#SlideShow3').attr( { src: Pic[j]});
$('#ccc_link').attr('href', Ref[j]);
$('#ccc').attr('href', Ref[j]);
$('#ccc').text(Ref_name[j]);
$('#price3').text(Price[j]);
$('#title a').fadeIn(interval);
$('#SlideShow img[width=140]').fadeIn(interval);
$('#all_price span').fadeIn(interval);
t = setTimeout(hideSlideShow, slideShowSpeed);
interval = 1000;
}
function next()
{
interval = 500;
clearTimeout(t)
clearTimeout(t1)
runSlideShow();
}
function previus()
{
interval = 500;
clearTimeout(t)
clearTimeout(t1)
b=j-6;
if (b<-1)
{
k=p+b;
if (k<-1)
{
j=p+k;
runSlideShow();
}
else
{
j=k;
runSlideShow();
}
}
else
{
j=b;
runSlideShow();
}
}
document.writeln('<div style="background-color:#ea557b;width:100%; height:18px; padding-top:3px; color:#FFF; text-align:center"><b>ДРУГИЕ ПРЕДЛОЖЕНИЯ</b></div><br><br><div id="title" style="width:100%; text-align:center; height:30px; margin-bottom:10px;"><table width="100%" border="0" cellpadding="0" cellspacing="0" ><tr><td width="59">&nbsp;</td><td align="center" width="160"><a id="aaa" href="#"></a></td><td align="center" width="161"><a id="bbb" href="#"></a></td><td align="center" width="161"><a id="ccc" href="#"></a></td><td width="59">&nbsp;</td></tr></table></div><div id="SlideShow" style="width:100%; height:105px; margin-bottom:10px;"><div style="float:left; margin-left:19px; position:relative; top:33px;"><img style="cursor:pointer" id="nazad" src="http://www.mebel-baby.com.ua/images_alex/nazad1_1.jpg" width="37" height="37" /></div><div style="float:left; margin-left:10px;"><a id="aaa_link" href="111"><img border="0" id="SlideShow1" src="http://www.mebel-baby.com.ua/products_pictures/mebel_baby_no_img.jpg" width="140" height="105"></a></div><div style="float:left; margin-left:17px;"><a id="bbb_link" href="#"><img border="0" id="SlideShow2" src="http://www.mebel-baby.com.ua/products_pictures/mebel_baby_no_img.jpg" width="140" height="105"></a></div><div style="float:left; margin-left:17px; margin-right:7px;"><a id="ccc_link" href="#"><img border="0" id="SlideShow3" src="http://www.mebel-baby.com.ua/products_pictures/mebel_baby_no_img.jpg" width="140" height="105"></a></div><div style=" position:relative; float:right; margin-right:19px; top:33px;"><img style="cursor:pointer" id="vpered" src="http://www.mebel-baby.com.ua/images_alex/vpered1_1.jpg" width="37" height="37" /></div></div><div id="all_price" style="width:100%; margin-bottom:10px; text-align:center; height:30px; "><!-- Закоментил, так как некоректно выводится валюта <table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td width="59">&nbsp;</td><td width="160" align="center"><span style="color:#F00"><b id="price1"></b> <b>грн.</b></span></td><td width="161" align="center"><span style="color:#F00"><b id="price2"></b> <b>грн.</b></span></td><td width="161" align="center"><span style="color:#F00"><b id="price3"></b> <b>грн.</b></span></td><td width="59">&nbsp;</td></tr></table>--></div>');
runSlideShow()
$('#vpered').click(function () {
next()
});
$('#nazad').click(function () {
previus()
});
$("#vpered").mousemove(function(){
$(this).attr( { src: "http://www.mebel-baby.com.ua/images_alex/vpered2_2.jpg"});
});
$("#vpered").mouseout(function(){
$(this).attr( { src: "http://www.mebel-baby.com.ua/images_alex/vpered1_1.jpg"});
});
$("#nazad").mousemove(function(){
$(this).attr( { src: "http://www.mebel-baby.com.ua/images_alex/nazad2_2.jpg"});
});
$("#nazad").mouseout(function(){
$(this).attr( { src: "http://www.mebel-baby.com.ua/images_alex/nazad1_1.jpg"});
});