var is_beingnow=false;
var element_id=0;
var element_title="";
var user_name="";
function addFavorites(B,C,A){if(!is_beingnow){showModalBackground();
is_beingnow=true;
element_id=B;
element_title=C;
user_name=A;
favoritesDWR.existFavorite(element_id,6,user_name,createFavorites);
hideModalBackground();
is_beingnow=false
}else{defineDivToShow(1)
}}function success(A){if(A){defineDivToShow(2)
}element_id=0;
element_title="";
user_name=""
}function createFavorites(A){if(!A){favoritesDWR.addNewFavorite(element_id,6,element_title,user_name,success)
}else{defineDivToShow(3)
}}function showModalBackground(){background=document.createElement("div");
background.id="background-modal";
background.className="imagen";
$(background).css("position","absolute").css("top",0).css("left",0).css("z-index",100).css("background","#4B4B4B url(../img/matt-loader.gif) no-repeat center").css("display","none").appendTo(document.body).css("opacity",0).show();
$(background).css("height",$(window).height()+"px").css("width",$(window).width()+"px").fadeTo(100,0.25);
$(window).resize(function(){$("#background-modal").css("height",$(window).height()+"px").css("width",$(window).width()+"px")
})
}function hideModalBackground(){$("#background-modal").remove();
$(window).resize(null)
}function defineDivToShow(A){switch(A){case 1:divContainer="div1post";
break;
case 2:divContainer="divAdded";
break;
case 3:divContainer="divExist";
break;
default:divContainer="divCantAdd"
}displayMessage()
}function displayMessage(){createWindowToShow();
jQuery("#new-div-temp").Grow(500);
window.setTimeout("jQuery('#new-div-temp').Puff(500)",3000)
}function createWindowToShow(){var A=document.body;
var B=document.getElementById(divContainer);
if(document.getElementById("new-div-temp")){A.removeChild(document.getElementById("new-div-temp"))
}var E=document.createElement("div");
E.id="new-div-temp";
E.style.position="absolute";
E.style.width="350px";
E.style.height="30px";
E.style.zIndex="101";
E.style.display="none";
E.style.border="1px solid #999999";
E.style.backgroundColor="#F7F7F7";
E.style.lineHeight="25px";
E.style.textAlign="center";
E.style.color="#0076C0";
E.style.fontWeight="bold";
E.style.fontSize="12px";
var D=document.getElementById("divFavorite");
var C=getObjectPosition(D);
E.style.top=C[1]+C[3]+"px";
E.style.left=C[0]-C[2]+"px";
A.appendChild(E);
E.innerHTML=B.innerHTML
}function getObjectPosition(F){if(F==null){return null
}var G=0;
var E=0;
var A=0;
var B=0;
var C=true;
if(F.offsetParent){while(F.offsetParent){G+=F.offsetLeft;
E+=F.offsetTop;
if(C){A+=F.offsetWidth;
B+=F.offsetHeight;
C=false
}F=F.offsetParent
}}var D=new Array();
D[0]=G;
D[1]=E;
D[2]=A;
D[3]=B;
return D
};
