var img_path="data/images/";
/*#######################################################################################*\
###########################################################################################
### NOTICE THIS FILE IS 100% Property Of Mohamed Mahmoud Shehab ###
### And No One Is Ever Allowed ###
### TO USE IT Or Any Part Of It In / With Any Website Unless Under license ... ###
### And Notice This Is Protected By The LAW ###
### shehabic@gmail.com Contact Me For more Info ###
###########################################################################################
\*#######################################################################################*/
var tx="";
var hide_all_cats;
var hide_all_strs;
function returnPos(target){
var x = 0;var y = 0;var tempObj = new Object();
var obj = (typeof target == "object" ? target : $(target));
while(obj.offsetParent!=null){ x+=obj.offsetLeft;y+=obj.offsetTop;obj=obj.offsetParent;}
x+=obj.offsetLeft;y+=obj.offsetTop;tempObj.x=x;tempObj.y=y;return tempObj;
}
function $(id){
var obj = null;
if(document.getElementById){
obj = document.getElementById(id);
}else if(document.all){
obj = document.all[id];
}
return obj;
}
function show_stores()
{
hide_cats(0);
all_pos=returnPos("all_stores");
$("all_stores_layer").style.left=(all_pos.x-2)+"px";
$("all_stores_layer").style.top=(parseInt(all_pos.y)+29)+"px";
$("all_stores_layer").style.visibility="visible";
clearTimeout(hide_all_strs);
}
function hide_strs(after_amount){
if(after_amount==0)
{
$("all_stores_layer").style.visibility="hidden";
clearTimeout(hide_all_strs);
}
else{
hide_all_strs=setTimeout("hide_strs("+(after_amount-1)+")",1000);
}
}
function show_categories()
{
hide_strs(0);
all_pos=returnPos("all_place");
$("all_cats_layer").style.left=(all_pos.x-2)+"px";
$("all_cats_layer").style.top=(parseInt(all_pos.y)+29)+"px";
$("all_cats_layer").style.visibility="visible";
clearTimeout(hide_all_cats);
}
function hide_cats(after_amount){
if(after_amount==0)
{
$("all_cats_layer").style.visibility="hidden";
clearTimeout(hide_all_cats);
}
else{
hide_all_cats=setTimeout("hide_cats("+(after_amount-1)+")",1000);
}
}
function quick_register()
{
$("q_uname").style.background="#FFFFFF";
$("q_pass").style.background="#FFFFFF";
$("q_rept").style.background="#FFFFFF";
$("q_mail").style.background="#FFFFFF";
$('q_err').innerHTML="";
var errs=new Array();
if($("q_uname").value.length<4){
errs[errs.length]="Username Too Short";
$("q_uname").style.background="#FFFFAA";
}
if($("q_pass").value.length<4){
errs[errs.length]="Password Too Short";
$("q_pass").style.background="#FFFFAA";
}
if($("q_pass").value!=$("q_rept").value)
{
$("q_rept").style.background="#FFFFAA";
errs[errs.length]="Password Doesn't Match Its Repeat";
}
if($("q_mail").value.length<1)
{
$("q_mail").style.background="#FFFFAA";
errs[errs.length]="You Must Enter Your Email";
}
if(errs.length>0){
$('q_err').innerHTML=""+errs.join("")+"";
return false;
}
else{
var QUN=$("q_uname").value;
var QPS=$("q_pass").value;
var QML=$("q_mail").value;
sR("modules/quick.php?op=qregister&UN="+QUN+"&PS="+QPS+"&UML="+QML,"","","my_options");
}
}
function checkout()
{
open("?do=checkout","_self");
}
function save_shipping(save_type){
var ship_data=new Array;
if (!check_shipping())return false;
ship_data[ship_data.length]="sfn="+$("customer_first_name").value;
ship_data[ship_data.length]="sln="+$("customer_last_name").value;
ship_data[ship_data.length]="sarea="+$("customer_area").value;
ship_data[ship_data.length]="sstname="+$("customer_street_name").value;
ship_data[ship_data.length]="sbldnum="+$("customer_building_number").value;
ship_data[ship_data.length]="saprtnum="+$("customer_apartment_number").value;
ship_data[ship_data.length]="szip="+$("customer_zip_code").value;
ship_data[ship_data.length]="stype="+$("customer_delivery_type").value;
ship_data[ship_data.length]="stime="+$("customer_delivery_time").value;
ship_data[ship_data.length]="sstate="+$("customer_state").value;
ship_data[ship_data.length]="scity="+$("customercity").value;
ship_data[ship_data.length]="shphone="+$("customer_home_phone").value;
ship_data[ship_data.length]="smphone="+$("customer_mobile_phone").value;
ship_data[ship_data.length]="swphone="+$("customer_work_phone").value;
if(save_type==1)
{
sR("modules/quick.php?op=save_shipping_profile&"+ship_data.join("&"),"","","noID");
}
else if(save_type==2)
{
sR("modules/quick.php?op=save_shipping&"+ship_data.join("&"),"","","noID");
}
}
function flip(ITEM_NAME,CLASS_NAME,ONOFF,CHECKS)
{
if($(CHECKS))
{
if($(CHECKS).checked!=true || ONOFF=="ON")
{
$(ITEM_NAME).className=CLASS_NAME;
}
}else{
$(ITEM_NAME).className=CLASS_NAME;
}
}
function fix_button(prod_id,btn,opt_LEVEL){
if($("prod_title"))p_title=$("prod_title").innerHTML;
p_id=prod_id;
p_opts=new Array();
the_price=$("price"+p_id);
btn=$("atc_btn");
if (parseInt(the_price.value)==0)
{
btn.onclick=function()
{ }
btn.style.cursor="none";
btn.src="images/addtocart_off.gif";
return;
}
btn.style.cursor="pointer";
btn.src="images/addtocart.gif";
if(the_table){
if(the_table.tBodies[0].rows.length>0)
{
for(i=0;i< the_table.tBodies[0].rows.length;i=i+2)
{
txt=the_table.tBodies[0].rows[i].cells[0].innerHTML;
if(txt.indexOf("(")>-1)txt=txt.substr(0,(txt.indexOf("(")-1));
xs=p_opts.length;
p_opts[xs]=txt.toLowerCase();
}
final_optionZ=p_opts.join(',');
var final_optionZ_vals=new Array();
for(LL=0;LL< p_opts.length;LL++)
{
if($(p_opts[LL]+""+prod_id))
{
final_optionZ_vals[final_optionZ_vals.length]=$(p_opts[LL]+prod_id).value;
}
}
var final_optionZ_V=final_optionZ_vals.join(",");
if($("prod_options"))
{
$("prod_options").innerHTML="";
if(final_optionZ_vals.length>0) $("prod_options").innerHTML= "("+final_optionZ_V+")";
}
btn=$("atc_btn");
btn.onclick=function()
{
add_to_cart(p_id,p_title,final_optionZ);
}
}
}
}
var the_table;
function clear_options(opt_val){
the_table=$("options_table");
opt_num=opt_val.replace("opt_","");
opt_num=(parseInt(opt_num)-1)*2;
if(the_table.tBodies[0].rows.length>opt_num)
{
xz=parseInt(the_table.tBodies[0].rows.length);
xz=xz-1;
for(i=xz;i>=opt_num;i--)
{
the_table.tBodies[0].removeChild(the_table.tBodies[0].childNodes[i]);
}
}
}
function add_option(opt_val,op_title,op_content){
clear_options(opt_val);
the_table=$("options_table");
if (!opt_val) opt_val="Heights";
if (!op_title) op_title="Height";
if (!op_content) op_content="2 - 2 - 3 - 4 - 5 - 6";
var found_option=false;
var tr1=document.createElement('tr');
var tr2=document.createElement('tr');
var td1=document.createElement('th');
var td2=document.createElement('td');
td1.appendChild(document.createTextNode(op_title));
td2.appendChild(document.createTextNode(op_content));
tr1.appendChild(td1);
tr2.appendChild(td2);
for(i=0;i< the_table.tBodies[0].rows.length;i++)
{
if(the_table.tBodies[0].rows[i].cells[0].id==opt_val)
{
the_table.tBodies[0].rows[i].cells[0].innerHTML=op_title;
the_table.tBodies[0].rows[i+1].cells[0].innerHTML=op_content;
found_option=true;
}
}
if (!found_option)
{
the_table.tBodies[0].appendChild(tr1);
the_table.tBodies[0].appendChild(tr2);
the_table.tBodies[0].rows[the_table.tBodies[0].rows.length-2].id="TR"+opt_val;
the_table.tBodies[0].rows[the_table.tBodies[0].rows.length-1].id="TR"+opt_val+"_content";
the_table.tBodies[0].rows[the_table.tBodies[0].rows.length-2].cells[0].id=opt_val;
the_table.tBodies[0].rows[the_table.tBodies[0].rows.length-1].cells[0].id=opt_val+"_content";
}
}
var thespeed=50;
var out=1;
var product=new Array();
var req=new Array();
var The_ID=new Array();
var vmid;
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page
function toggle(OBJECT,img_ID)
{
if(img_ID && $(img_ID))
{
var img_source=$(img_ID).src.toString();
}
var obj=$(OBJECT);
if (obj.style.display=="" || obj.style.display=="block")
{
hide_now(OBJECT);
if(img_ID && $(img_ID))$(img_ID).src=img_source.replace("up","down");
}else{
show_now(OBJECT);
if(img_ID && $(img_ID))$(img_ID).src=img_source.replace("down","up");
}
}
var myWidth;
var myHeight;
function alertSize() {
if (self.innerWidth) {
myWidth = self.innerWidth;
myHeight = self.innerHeight;
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if (document.body) {
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
}
function alertSize2() {
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement &&
( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
return (parseInt(myWidth)/2);
}
function sR(url,params,HttpMethod,anyID){
if($(anyID))
{
var wids=$(anyID).offsetWidth;
var hei=$(anyID).offsetHeight;
var lef=$(anyID).offsetLeft;
var rig=$(anyID).offsetTop;
}
if($("admin_loading") && $(anyID)){
var ww=parseInt($("admin_loading").style.width);
var hh=parseInt($("admin_loading").style.height);
$("admin_loading").style.left=(parseInt(lef)+(parseInt(wids)/2)-(ww/2))+"px";
$("admin_loading").style.top=(parseInt(rig)+(parseInt(hei)/2)-(hh/2))+"px";
}
if (!HttpMethod)
{
HttpMethod="POST";
}
req.push(initXMLHTTPRequest());
The_ID.push(anyID);
i=parseInt(req.length)-1;
if (req[i]){
req[i].open(HttpMethod,url,true);
req[i].onreadystatechange=onReadyState;
req[i].setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
req[i].send(params);
}
}
function initXMLHTTPRequest(){
var xRequest=null;
if (window.XMLHttpRequest)
{
xRequest=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
xRequest=new ActiveXObject("Microsoft.XMLHTTP");
}
else {
}
return xRequest;
}
var SENDER_TIMER;
function toConsole(data,pass_ID,methods)
{
if(!methods)var methods="R";
switch(methods.toUpperCase())
{
case "C":
break;
case "R":
if (data)
{
if(typeof $(pass_ID).value != "undefined"){
$(pass_ID).value=data;
}else{
$(pass_ID).innerHTML=data;
}
}
break;
case "A":
if (data)
{
var max_width=parseInt($(pass_ID).style.width);
data=wrapText(data,max_width);
if($(pass_ID))$(pass_ID).innerHTML=$(pass_ID).innerHTML+data;
scrollToBottom($(pass_ID),true);
}
break;
}
}
var scrOfX = 0, scrOfY = 0;
function getScrollXY() {
if( typeof( window.pageYOffset ) == 'number' ) {
//Netscape compliant
scrOfY = window.pageYOffset;
scrOfX = window.pageXOffset;
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
//DOM compliant
scrOfY = document.body.scrollTop;
scrOfX = document.body.scrollLeft;
} else if( document.documentElement &&
( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
//IE6 standards compliant mode
scrOfY = document.documentElement.scrollTop;
scrOfX = document.documentElement.scrollLeft;
}
return [ scrOfX, scrOfY ];
}
function ucf(word_here){
return word_here.charAt( 0 ).toUpperCase()+""+word_here.substr(1,(word_here.length-1)).toLowerCase();
}
function set_option(pid,opt_name,opt_val,opt_LEV)
{
opt_name=opt_name.toLowerCase();
if(opt_LEV){
opt_LEV=opt_LEV.replace("opt_","");
opt_LEV=(parseInt(opt_LEV)-1);
opt_LEV="opt_"+opt_LEV+"";
if($(opt_LEV+"")){
for_display=ucf(opt_name);
$(opt_LEV+"").innerHTML=for_display+" ("+opt_val+") ";
}
}
if($(opt_name+""+pid))
{
$(opt_name+""+pid).value=opt_val;
}
else
{
var some_inp=document.createElement("input");
some_inp.value=opt_val;
some_inp.name=opt_name+""+pid;
some_inp.id=opt_name+""+pid;
some_inp.type="hidden";
if($("product_layer2"))ch=$("product_layer2");
document.body.appendChild(some_inp);
}
}
function hide(layer_id){
$(layer_id).style.visibility='hidden';
}
function poplayer(prod_id){
the_layer=$('product_layer');
the_layer.style.visibility='visible';
var final_html=product[prod_id];
while(final_html.indexOf("<")!=-1) {
final_html=final_html.replace("<","<");
}
the_layer.innerHTML=final_html;
}
function move_product(){
get_mouse_pos;
the_layer=$('product_layer').style.top=parseInt(yMousePos)+"px";
the_layer=$('product_layer').style.left=parseInt(xMousePos)+"px";
}
function get_mouse_pos(e) {
getScrollXY();
if (document.layers) {
xMousePos = e.pageX;
yMousePos = e.pageY;
xMousePosMax = window.innerWidth+window.pageXOffset;
yMousePosMax = window.innerHeight+window.pageYOffset;
} else if (document.all) {
xMousePos = window.event.x+scrOfX;
yMousePos = window.event.y+scrOfY;
xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
yMousePosMax = document.body.clientHeight+document.body.scrollTop;
} else if (document.getElementById) {
xMousePos = e.pageX;
yMousePos = e.pageY;
xMousePosMax = window.innerWidth+window.pageXOffset;
yMousePosMax = window.innerHeight+window.pageYOffset;
}
var abcd=new Array(2);
abcd[0]=xMousePos;abcd[1]=yMousePos;return abcd;
}
function $(id){
var obj = null;
if(document.getElementById){
obj = document.getElementById(id);
}else if(document.all){
obj = document.all[id];
}
return obj;
}
function getobjbyid(id){
var obj = null;
if(document.getElementById){
obj = document.getElementById(id);
}else if(document.all){
obj = document.all[id];
}
return obj;
}
var current_product="";
function detail_flash(some2){
current_product=some2;
disp();
}
function detail(some){
current_product=some;
$('details').style.visibility="visible";
var Hing=returnPos("im_"+some);
var finalx=parseInt($("im_"+some).width)+parseInt(Hing.x);
var finaly=parseInt($("im_"+some).height)+parseInt(Hing.y);
$('details').style.left=(parseInt(finalx-75))+"px";
$('details').style.top=(parseInt(finaly-20))+"px";
}
function show_tab(tab_name){
switch(tab_name){
case "options":
$("p_options").style.display="block";
$("p_description").style.display="none";
$("opt_pic").src="images/layer/options.gif";
$("desc_pic").src="images/layer/description2.gif";
break;
case "descr":
$("p_options").style.display="none";
$("p_description").style.display="block";
$("opt_pic").src="images/layer/options2.gif";
$("desc_pic").src="images/layer/description.gif";
break;
}
}
function disp(){
some=current_product;
sR('prodinfo.php?product='+some,'','','float_layer');
$('rect').style.width="10px";
$('rect').style.height="10px";
if (navigator.appName == "Microsoft Internet Explorer"){
$('rect').style.filter='alpha(opacity=60)';
}else{
$('rect').style.opacity="0.6";
}
resize_rect();
}
function disp3(LETTER){
sR('modules/quick.php?op=manufact&LETTER='+LETTER,'','','manufacturer_area');
var chars="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for(var k=0;k< chars.length;k++){
if(chars.charAt(k)!=LETTER){
if($("LT"+chars.charAt(k))){
$("LT"+chars.charAt(k)).style.color="#DD0000";
$("LT"+chars.charAt(k)).style.background="";
}
}
else{
if($("LT"+chars.charAt(k))){
$("LT"+chars.charAt(k)).style.color="#FFFFFF";
$("LT"+chars.charAt(k)).style.background="#DD0000";
}
}
}
}
function resize_M_LAYER(){
var M_pos=returnPos("by_manufact");
BHEIGHT=parseInt(M_pos.y)+parseInt($("by_manufact").offsetHeight);
if (parseInt($("M_LAYER").style.height)<150)
{
alertSize();
getScrollXY();
hei=parseInt($("M_LAYER").style.height)+10;
$("M_LAYER").style.height=(hei)+"px";
$("M_LAYER").style.top=(parseInt(BHEIGHT)-parseInt($("M_LAYER").style.height)-35)+"px";
xtime=setTimeout("resize_M_LAYER()",2);
$("M_LAYER").style.visibility="visible";
}
else {
clearTimeout(xtime);
$("M_LAYER").style.height="150px";
$("M_LAYER").style.top=(parseInt(BHEIGHT)-150-35)+"px";
}
}
function $(id){
var obj = null;
if(document.getElementById){
obj = document.getElementById(id);
}else if(document.all){
obj = document.all[id];
}
return obj;
}
var the_man=0;
var M_TIMER=0;
function hide_M_LAYER(M_NUM){
if(!M_NUM){
clearTimeout(M_TIMER);
M_TIMER=setTimeout("hide_M_LAYER(2)",1500);
}else{
if (the_man==0)$("M_LAYER").style.visibility="hidden";
clearTimeout(M_TIMER);
}
}
document.onmousedown=function(){
if(out==1){
if ($('product_layer2'))
hide('product_layer2');
if ($('ob'))
$('ob').style.visibility='visible';
}
}
var xtime;
function resize_rect(layerNAME,maxWIDTH){
if(!maxWIDTH)maxWIDTH=320;
else maxWIDTH=parseInt(maxWIDTH);
if(!layerNAME)layerNAME="product_layer2";
if (parseInt($("rect").style.width)< maxWIDTH && parseInt($("rect").style.width)<320)
{
// alert(layerNAME+"---"+maxWIDTH+"|--WAS--->"+$("rect").style.width+"<-->"+$("rect").style.height);
$("rect").style.visibility="visible";
alertSize();
getScrollXY();
wid=parseInt($("rect").style.width);
hei=parseInt($("rect").style.height);
$("rect").style.width=(wid*1.25)+"px";
$("rect").style.height=(hei*1.25)+"px";
$("rect").style.left=(parseInt(myWidth)/2)+scrOfX-parseInt(wid/2)+"px";
$("rect").style.top=(parseInt(myHeight)/2)+scrOfY-parseInt(hei/2)+"px";
xtime=setTimeout("resize_rect('"+layerNAME+"',"+maxWIDTH+")",10);
}
else {
clearTimeout(xtime);
$("rect").style.visibility="hidden";
$(layerNAME).style.left=parseInt($("rect").style.left)+"px";
$(layerNAME).style.top=parseInt($("rect").style.top)+"px";
$(layerNAME).style.visibility="visible";
if($("ob"))
{
$("ob").style.visibility="hidden";
}
}
}
function setCookie(name, value, expires, path, domain, secure)
{
document.cookie= name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
//--------------------------------------------------------------------------------------------
function getCookie(name)
{
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1)
{
begin = dc.indexOf(prefix);
if (begin != 0) return "";
}
else
{
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
if (end == -1)
{
end = dc.length;
}
return unescape(dc.substring(begin + prefix.length, end));
}
var z=new Array();
var thespeed=10;
function hide_now(obj_here)
{
x=$(obj_here);
ht=x.offsetHeight;
thespeed=parseInt(parseInt(ht)/10)+1;
$(obj_here).style.height=parseInt(ht)+"px";
decrease(obj_here);
}
function show_now(obj_here,extra)
{
if(!extra)extra=0;
x=$(obj_here);
x.style.display="block";
x.style.overflow="visible";
x.style.height="";
ht=x.offsetHeight;
thespeed=parseInt(parseInt(ht)/10)+2;
x.style.overflow="hidden";
x.style.height="0px";
x.style.display="block";
increase(ht,obj_here,z.length,extra);
}
function decrease(obj_here,IndexOFz,extraOPTION){
if(!extraOPTION)extraOPTION=0;
x.style.overflow='hidden';
x=$(obj_here);
ht=x.style.height;
if (parseInt(ht)>(thespeed-1))
{
ht=parseInt(ht)-thespeed;
if(extraOPTION==1){
x.style.top=(parseInt(x.style.top)+thespeed)+"px";
}
x.style.height=parseInt(ht)+"px";
if(!IndexOFz){
var IndexOFz=z.length;
}
z[IndexOFz]=setTimeout("decrease('"+obj_here+"',"+IndexOFz+","+extraOPTION+")",30);
}
else {
x.style.height=0+"px";
x.style.display="none";
clearTimeout(z[IndexOFz]);
}
}
function increase(hx,obj_here,IndexOFz,extraOPTION){
IndexOFz=0;
if(!extraOPTION)extraOPTION=0;
var x=$(obj_here);
x.style.overflow='hidden';
ht=x.style.height;
if (parseInt(ht)<(parseInt(hx)-(thespeed-1)))
{
ht=parseInt(ht)+thespeed;
x.style.height=parseInt(ht)+"px";
z[IndexOFz]=setTimeout("increase("+hx+",'"+obj_here+"',"+IndexOFz+","+extraOPTION+")",30);
if(extraOPTION==1){
x.style.top=(parseInt(x.style.top)-thespeed)+"px";
}
}
else {
x.style.height="";
x.style.overflow='visible';
clearTimeout(z[IndexOFz]);
x.style.visibility='visible';
}
}
state=new Array();
function HL(x)
{
for(i=1;i<=x;i++)
{
z=document.getElementById("s"+i+"");
z.src='images/staron.gif';
}
}
function DL()
{
for(i=1;i<=5;i++)
{
z=document.getElementById("s"+i+"");
if (state[i]!=1)z.src='images/staroff.gif';
else if (state[i]==1)z.src='images/staron2.gif';
}
}
function vote(x,PID_HERE)
{
if(x<5)for(i=x+1;i<=5;i++){
state[i]=0;
}
for(i=1;i<=x;i++)
{
state[i]=1;
z=document.getElementById("s"+i+"");
z.src='images/staron2.gif';
}
sR("modules/quick.php?op=rate&product="+PID_HERE+"&rate="+x+"","","","the_rating");
}
function rotate_image(direction){
if(direction==1){
var positions=$("state_image").innerHTML;
var positions2=positions.split('/');
var curr_image=parseInt(positions2[0]);
var list_images=$("im_list").value;
var the_product_id=$('product_id').value;
var current_image=list_images.split(",");
if(curr_image< current_image.length){
curr_image++;
}else {
curr_image=1;
}
$("im_"+the_product_id).src=img_path+current_image[curr_image-1];
}
else if(direction==-1){
var positions=$("state_image").innerHTML;
var positions2=positions.split('/');
var curr_image=parseInt(positions2[0]);
var list_images=$("im_list").value;
var the_product_id=$('product_id').value;
var current_image=list_images.split(",");
if(curr_image>1){
curr_image--;
}else {
curr_image=current_image.length;
}
$("im_"+the_product_id).src=img_path+current_image[curr_image-1];
}
$("state_image").innerHTML=curr_image+"/"+current_image.length;
}
function scrollToBottom(el, force) {
var bottom = el.scrollHeight - el.clientHeight;
if (el.scrollTop == arguments.callee.scrollAtBottom || force === true) {
el.scrollTop = bottom;
arguments.callee.scrollAtBottom = bottom;
}
}
function wrapText(msg_content,MAX_WIDTH)
{
var final_msg="";
var this_line="";
for(i=0;i< msg_content.length;i++){
$("text_TD").innerHTML=$("text_TD").innerHTML+msg_content.charAt(i);
if(parseInt( $("text_TABLE").offsetWidth ) < MAX_WIDTH)
{
this_line=this_line+msg_content.charAt(i);
}else{
final_msg=final_msg+this_line+" ";
this_line=msg_content.charAt(i);
$("text_TD").innerHTML=msg_content.charAt(i);
}
}
if(this_line!="")final_msg=final_msg+this_line+" ";
return final_msg;
}
var focused=false;
function alignPos(ITEM_1,ITEM_2,OFFX,OFFY)
{
if(!OFFX)OFFX=0;
if(!OFFY)OFFY=0;
var COORDS1=returnPos(ITEM_1);
document.getElementById(ITEM_2).left=(parseInt(COORDS1.x)+parseInt(OFFX))+"px";
document.getElementById(ITEM_2).left=(parseInt(COORDS1.y)+parseInt(OFFY))+"px";
}
function load_shipping(FLD_NAME){
var SHIP=$(FLD_NAME).value;
var ALL=SHIP.split("[+]");
for(i=0;i< ALL.length;i++)
{
SPLITS=ALL[i].split("===");
if($(SPLITS[0]))
$(SPLITS[0]).value=SPLITS[1];
}
}
function special_display(SPECIAL_ITEM){
if(getobjbyid(SPECIAL_ITEM).style.overflow=="visible"){
return;
}
show_now(SPECIAL_ITEM);
}
var cdown=new Array();var cday=new Array();var cmin=new Array();var chour=new Array();
var cmsec=new Array();var csec=new Array();var cholder=new Array();
var flip=new Array();
function count_down(index2){
// clearTimeout(cdown[index2]);
// if(flip[index2])==true){
cmsec[index2]=cmsec[index2]-10;
if(cmsec[index2]<=0)csec[index2]=csec[index2]-1;
if(csec[index2]==0)cmin[index2]=cmin[index2]-1;
if(cmin[index2]==0)chour[index2]=chour[index2]-1;
if(chour[index2]==0)cday[index2]--;
if(csec[index2]<10)csec[index2]="0"+parseInt(csec[index2]);
if(cmin[index2]<10)cmin[index2]="0"+parseInt(cmin[index2]);
if(chour[index2]<10)chour[index2]="0"+parseInt(chour[index2]);
if(document.getElementById(cholder[index2]))
document.getElementById(cholder[index2]).innerHTML=""+cday[index2]+"d : "+chour[index2]+"h : "+cmin[index2]+"m : "+csec[index2]+"s "/*+"+cmsec[index2]*/+"";
if(cmsec[index2]<=0)cmsec[index2]=10;
if(csec[index2]==0)csec[index2]=60;
if(cmin[index2]==0)cmin[index2]=60;
if(chour[index2]==0)chour[index2]=24;
flip[index2]=false;
// }
// cdown[index2]=setTimeout("count_down("+index2+")",1000);
}
function flip_counter(index3){
flip[index3]=true;
}
/*The playing Div function*/
var rhd_start_timer=null;
var timer=10;
function resize(){
rhd_start_timer=setInterval('resizeDiv()',timer);
}
/*function adjuster fine tunes the animated object borders*/
function adjuster()
{
$(rhd_div).style.width=rhd_end_obj_width+"px";
$(rhd_div).style.height=rhd_end_obj_height+"px";
$(rhd_div).style.top=rhd_end_obj_top+"px";
$(rhd_div).style.left=rhd_end_obj_left+"px";
}
var steps=15;
var rhd_end_obj_width,rhd_end_obj_height,rhd_end_obj_top,rhd_end_obj_left,div_width,div_height,div_top,div_left;
/*function resizeDiv adjusts the animated object parameters*/
function resizeDiv(){
var c1=null,c2=null,c3=null,c4=null;
div_width=parseFloat($(rhd_div).style.width);
div_height=parseFloat($(rhd_div).style.height);
div_top=parseFloat($(rhd_div).style.top);
div_left=parseFloat($(rhd_div).style.left);
if(Math.abs(div_width-rhd_end_obj_width)>Math.abs(parseFloat(rhd_end_obj_width-div_width_init)/steps)){
$(rhd_div).style.width=div_width+((rhd_end_obj_width-div_width_init)/steps)+"px";
}else{
adjuster();
c1=true;
}
if(Math.abs((parseFloat($(rhd_div).style.height)-rhd_end_obj_height))>Math.abs(parseFloat(rhd_end_obj_height-div_height_init)/steps)){
$(rhd_div).style.height=div_height+((rhd_end_obj_height-div_height_init)/steps)+"px";
}else{
adjuster();
c2=true;
}
if(Math.abs((parseFloat($(rhd_div).style.top)-rhd_end_obj_top))>Math.abs(parseFloat(rhd_end_obj_top-div_top_init)/steps)){
$(rhd_div).style.top=div_top+((rhd_end_obj_top-div_top_init)/steps)+"px";
}else{
adjuster();
c3=true;
}
if(Math.abs((parseFloat($(rhd_div).style.left)-rhd_end_obj_left))>Math.abs(parseFloat(rhd_end_obj_left-div_left_init)/steps)){
$(rhd_div).style.left=div_left+((rhd_end_obj_left-div_left_init)/steps)+"px";
}else{
adjuster();
c4=true;
}
if(c1&&c2&&c3&&c4)
{
clearInterval(rhd_start_timer);
rhd_start_timer=null;
$(rhd_end_obj_passed).style.visibility="visible";
$(rhd_div).style.visibility="hidden";
}
}
var rhd_end_obj_passed;
var rhd_div="roshdawyDiv";
var rhd_div_created;
var div_width_init,div_height_init,div_top_init,div_left_init,rhd_end_obj_width,rhd_end_obj_height,rhd_end_obj_top,rhd_end_obj_left;
/*function transfer draws animation as if start_obj transfers to end obj */
function transfer(rhd_start_obj,rhd_end_obj,rhd_still_appear){
var rhd_position=returnPos($(rhd_start_obj));
if(($(rhd_end_obj).style.visibility!='hidden' && rhd_still_appear) || rhd_start_timer!=null)return;
if($(rhd_start_obj).style.visibility=='hidden')return;
if(!rhd_div_created){
rhd_div_created=document.createElement('div');
rhd_div_created.setAttribute('id',rhd_div);
document.body.appendChild(rhd_div_created);
rhd_div_created.style.visibility="hidden";
}
rhd_end_obj_passed=rhd_end_obj;
$(rhd_div).style.width=$(rhd_start_obj).offsetWidth+"px";
$(rhd_div).style.height=$(rhd_start_obj).offsetHeight+"px";
$(rhd_div).style.top=rhd_position.y+"px";
$(rhd_div).style.left=rhd_position.x+"px";
if (navigator.appName == "Microsoft Internet Explorer")$(rhd_div).style.filter='alpha(opacity=70)';
$(rhd_div).style.opacity='0.7';$(rhd_div).style.position="absolute";
$(rhd_div).style.backgroundColor="#99CCFF";
$(rhd_div).style.border="#6699CC 4px solid";
$(rhd_div).style.visibility='visible';
$(rhd_div).zIndex="1";
div_width_init=$(rhd_start_obj).offsetWidth;
div_height_init=$(rhd_start_obj).offsetHeight;
div_top_init=rhd_position.y;
div_left_init=rhd_position.x;
rhd_end_obj_width=parseFloat($(rhd_end_obj).offsetWidth);
rhd_end_obj_height=parseFloat($(rhd_end_obj).offsetHeight);
rhd_end_obj_top=parseFloat($(rhd_end_obj).offsetTop);
rhd_end_obj_left=parseFloat($(rhd_end_obj).offsetLeft);
if(!rhd_still_appear)$(rhd_start_obj).style.visibility='hidden';
resize();
}
function pic_to_prod(PR_ID){
sR('prodinfo.php?product='+PR_ID,'','','float_layer');
alertSize();
getScrollXY();
var wid,hei;
wid=$("product_layer2").offsetWidth;
hei=$("product_layer2").offsetHeight;
$("product_layer2").style.left=(parseInt(myWidth)/2)+scrOfX-parseInt(wid/2)+"px";
$("product_layer2").style.top=(parseInt(myHeight)/2)+scrOfY-parseInt(hei/2)+"px";
transfer("prod_pic"+PR_ID,"product_layer2",1);
}