/***********************************************************************************************/
/********************************** Javascript window DHTML ************************************/
/***********************************************************************************************/
function urlencode( str ) {
var histogram = {}, histogram_r = {}, code = 0, tmp_arr = [];
var ret = str.toString();
var replacer = function(search, replace, str) {
var tmp_arr = [];
tmp_arr = str.split(search);
return tmp_arr.join(replace);
};
// The histogram is identical to the one in urldecode.
histogram['!'] = '%21';
histogram['%20'] = '+';
// Begin with encodeURIComponent, which most resembles PHP's encoding functions
ret = encodeURIComponent(ret);
for (search in histogram) {
replace = histogram[search];
ret = replacer(search, replace, ret) // Custom replace. No regexing
}
// Uppercase for full PHP compatibility
return ret.replace(/(\%([a-z0-9]{2}))/g, function(full, m1, m2) {
return "%"+m2.toUpperCase();
});
return ret;
}// }}}
function opacity(id, opacStart, opacEnd, millisec) {
//speed for each frame
var speed = Math.round(millisec / 100);
var timer = 0;
//determine the direction for the blending, if start and end are the same nothing happens
if(opacStart > opacEnd) {
for(i = opacStart; i >= opacEnd; i--) {
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
timer++;
}
setTimeout("closeDiv();",(timer * speed)*2);
} else if(opacStart < opacEnd) {
for(i = opacStart; i <= opacEnd; i++)
{
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
timer++;
}
}
}
function chkObject(inParent,theVal) {
if(inParent){
if (window.opener.document.getElementById(theVal) != null) {
return true;
} else {
return false;
}
}else{
if (document.getElementById(theVal) != null) {
return true;
} else {
return false;
}
}
}
//change the opacity for different browsers
function changeOpac(opacity, id) {
var object = document.getElementById(id).style;
object.opacity = (opacity / 100);
object.MozOpacity = (opacity / 100);
object.KhtmlOpacity = (opacity / 100);
object.filter = "alpha(opacity=" + opacity + ")";
}
function close_Commentwindow(){
opacity("layerdiv", 100, 0, 500);
show_hide("cmt_Section");
}
function Open_window(bookId,userid){
texttbl='
';
successtbl='\
|
';
if(chkObject(0,'layerdiv')){
opacity('layerdiv', 0, 100, 500);
document.getElementById('layerdiv').innerHTML=texttbl;
}else{
var layerdiv = document.createElement('div');
layerdiv.setAttribute('id', 'layerdiv');
//layerdiv.style.width = "390";
layerdiv.style.height = "100";
layerdiv.style.paddingTop= "5px";
layerdiv.style.paddingLeft= "5px";
layerdiv.style.paddingRight= "5px";
layerdiv.style.paddingBottom= "5px";
layerdiv.style.background= 'url(images/modal.png)';
layerdiv.style.position = "absolute";
layerdiv.style.marginRight= "auto";
layerdiv.style.marginLeft= "auto";
layerdiv.style.filter="alpha(opacity=" + 0 + ")";
// layerdiv.filter = "alpha(opacity=" + 0 + ")";
//alert(screen.width);
layerdiv.style.left = ((screen.width/2)-(480/2));
//layerdiv.style.left = "50%";
layerdiv.style.top = '200';
layerdiv.style.align = "center";
layerdiv.style.background = "#b42328";
layerdiv.style.border = "1px solid #000";
layerdiv.innerHTML=texttbl;
document.body.appendChild(layerdiv);
var contdiv = document.createElement('contdiv');
contdiv.setAttribute('id', 'contdiv');
document.body.appendChild(contdiv);
opacity('layerdiv', 0, 100, 500);
}
return false;
}
function PostComment(bookid,userid){
var Comment = urlencode(document.getElementById('Comment').value);
document.getElementById('layerdiv').style.height="100px";
ajaxpage("/post.php?comment="+Comment+"&bookid="+bookid,'contdiv');
document.getElementById('layerdiv').innerHTML=successtbl;
gotourl('/manage_comments.php?do=nav&userid='+userid+'&bookId='+bookid,'Commentsblock');
return true;
}
function hide_all_selects(){
var tags=document.getElementsByTagName('select');
for(tg=0;tg |
|
';
document.body.appendChild(layerdiv3);
var contdiv3 = document.createElement('contdiv3');
contdiv3.setAttribute('id', 'contdiv3');
document.body.appendChild(contdiv3);
return false;
}
function closeDiv3(){
var target3 = document.getElementById('layerdiv3');
document.body.removeChild(target3);
return false;
}
function show_comments(bookid,divcont){
ajaxpage("/manage_comments.php?bookid="+bookid,divcont);
return false;
}
function delete_comment(CommentID,bookid,divcont){
ajaxpage('/manage_comments.php?bookId='+bookid+'&do=del&CommentID='+CommentID,divcont);
return false;
}
function show_hide(id){
if(!id)return false;
var target=document.getElementById(id);
if(target.style.display==''){
target.style.display='none';
}else{
target.style.display='';
}
return false;
}
function Open_images(lang,pointer,img_front,img_back,onlyfront){
var imagediv = document.createElement('div');
imagediv.setAttribute('id', 'imagediv');
var Yaxis=findPosY(pointer);
var Xaxis=findPosX(pointer);
imagediv.style.top = Yaxis-11;
if(onlyfront){
imagediv.style.width = "475";
imagediv.style.right = Xaxis+478;
}else{
imagediv.style.width = "826";
imagediv.style.right = Xaxis+205;
}
if((lang=="kr")||(lang=="ar")){
imagediv.style.right = Xaxis+305;
}
imagediv.style.height = "655";
imagediv.style.position = "absolute";
//layerdiv3.style.zIndex = 1;
imagediv.style.background = "#FFFFFF";
imagediv.style.border = "0px solid #000";
if(onlyfront){
imagediv.innerHTML='';
}else{
if((lang=="kr")||(lang=="ar")){
imagediv.innerHTML='
';
}else{
imagediv.innerHTML='
';
}
}
document.body.appendChild(imagediv);
var contimagediv = document.createElement('contimagediv');
contimagediv.setAttribute('id', 'contimagediv');
document.body.appendChild(contimagediv);
return false;
}
function closeImageDiv(){
var target3 = document.getElementById('imagediv');
document.body.removeChild(target3);
return false;
}
function readonline(id,lang){
window.open ("http://www.araspress.com/online_read/readBook.php?bookid="+id+"&lang="+lang,"mywindow","status=1,location=0,menubar=0,resizable=1,directories=0,toolbar=0");
return false;
}