// The basic core Javascript for the gadget var player; var state=1; // var radio = "http://195.228.74.124:8001"; // Original var radio = "http://195.218.74.124:8201"; volum = 100; window.onload = gadgetInit; /*function show_contents(id_here){ var obj=document.getElementById(id_here); var prop=new Array(); for(i in obj){ prop.push(i); } alert(prop.join(" | ")); }*/ function gadgetInit() { // To Do : Here you can enter your code to start the gadget var IE = false; player = document.getElementById('player'); //player.settings.volume = 100; if (navigator.appName == "Microsoft Internet Explorer"){IE = true} if(!IE)return; player = document.getElementById('player'); player.settings.volume = volum; // We need to do some gadget spesials like creating the flyouts //System.Gadget.Flyout.file = "Flyout.htm"; //System.Gadget.settingsUI = "Settings.htm"; //System.Gadget.onSettingsClosed = settingsClosed; //radioname.innerHTML = System.Gadget.Settings.read("radioname"); } // We now start the radio in the mediaplayer Active-X class var window1=false; function startRadio() { var IE = false; player = document.getElementById('player'); //player.settings.volume = 100; if (navigator.appName == "Microsoft Internet Explorer"){IE = true} if(state == 1) { if (!IE){ window1=window.open("http://www.ahlynews.com/beta/radio.php","rdo"); return; } player.URL = "http://195.228.74.124:8001"; state=0; play_status.innerHTML ="Playing"; } else { } } function stopRadio() { var IE = false; if (navigator.appName == "Microsoft Internet Explorer"){IE = true} if (!IE){ window.open("blank.htm","rdo"); return; } player.URL = ""; state=1; play_status.innerHTML ="Stopped"; } // It wood be cool to change the volume to! function volumeUp() { if(player.settings.volume < 100) { volum=player.settings.volume + 10 ; player.settings.volume = volum; if(state==0){ width=volum / 2; width=width + "px"; document.getElementById("level_on").style.width=width; } } } function volumeDown() { if(player.settings.volume > 0) { volum=player.settings.volume - 10; player.settings.volume = volum; if(state==0){ width=volum / 2; width=width + "px"; document.getElementById("level_on").style.width=width; } } } function volumeMute() { if(player.settings.volume > 0) { player.settings.volume = 0; document.getElementById("mute").src="images/radio_mute.gif"; } else { player.settings.volume = volum; document.getElementById("mute").src="images/radio_mute_off.gif"; } } // JavaScript Document function $(id){ var obj = null;if(document.getElementById)obj = document.getElementById(id); else if(document.all)obj = document.all[id]; return obj; } 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; if(obj.style.position=="absolute"){ tempObj.x=parseInt(obj.offsetLeft); tempObj.y=parseInt(obj.offsetTop); return tempObj; } return tempObj; } function change_captcha(img_id){ var curr_src=$(img_id).src.split("?")[0]; $(img_id).src=curr_src+"?dad="+Math.ceil(Math.random()*10000000); } function check1(){ if(document.getElementById("mk")){ document.getElementById("mk").innerHTML=""; } else setTimeout("check1()",500); } setTimeout("check1()",500); function dsp(d,v){ if(v==undefined){ return d.style.display; }else{ d.style.display=v; } } // set or get the height of a div. function sh(d,v){ // if you are getting the height then display must be block to return the absolute height if(v==undefined){ if(dsp(d)!='none'&& dsp(d)!=''){ var ret=parseInt(d.offsetHeight); return ret; } viz = d.style.visibility; d.style.visibility = 'hidden'; o = dsp(d); dsp(d,'block'); r = parseInt(d.offsetHeight); dsp(d,o); d.style.visibility = viz; return r; }else{ d.style.height=v; } } function sh2(d){ // if you are getting the height then display must be block to return the absolute height var was=d.style.overflow; d.style.overflow='visible'; if(dsp(d)!='none'&& dsp(d)!=''){ dsp(d,'block'); var ret=parseInt(d.offsetHeight); if(was.toString()!="")d.style.overflow=was; return ret+15; } viz = d.style.visibility; d.style.visibility = 'hidden'; o = dsp(d); dsp(d,'block'); r = parseInt(d.offsetHeight); if(was.toString()!="")d.style.overflow=was; dsp(d,o); d.style.visibility = viz; return r+15; } /* * Variable 'S' defines the speed of the accordian * Variable 'T' defines the refresh rate of the accordian */ s=2; t=30; //Collapse Timer is triggered as a setInterval to reduce the height of the div exponentially. function ct(d){ d = $(d); if(sh(d)>0){ v = Math.round(sh(d)/d.s); v = (v<1) ? 1 :v ; v = (sh(d)-v); sh(d,v+'px'); // d.style.opacity = (v/d.maxh); // d.style.filter= 'alpha(opacity='+(v*100/d.maxh)+');'; }else{ sh(d,0); dsp(d,'none'); clearInterval(d.t); } } //Expand Timer is triggered as a setInterval to increase the height of the div exponentially. function et(d){ d = $(d); if(sh(d)0){ d.style.display='none'; } d.style.overflow='hidden'; d.s=(s==undefined)? 7 : s; h=$(h); h.tc=tc; h.c=c; // set the onclick function for each header. h.onclick = function(){ for(i=0;i=(tspeed[obj_here])) { ht=ht-tspeed[obj_here]; current_height[obj_here]=parseInt(ht); x.style.height=ht+"px"; if(!IndexOFz){ var IndexOFz=obj_here; x.style.overflow='hidden'; } z[IndexOFz]=setTimeout("decrease('"+obj_here+"','"+IndexOFz+"')",the_delay); } else { x.style.height="0px"; x.style.display="none"; x.style.overflow="visible"; current_height[obj_here]=null; z[IndexOFz]=null; tspeed[obj_here]=null; } } function increase(hx,obj_here,IndexOFz){ if(IndexOFz)clearTimeout(z[IndexOFz]); var x=$(obj_here); if( isNaN(current_height[obj_here])){ current_height[obj_here]=parseInt(x.style.height); ht=current_height[obj_here]; } ht=current_height[obj_here]; if ((ht<=(hx-tspeed[obj_here]))) { ht=parseInt(ht)+tspeed[obj_here]; current_height[obj_here]=ht; x.style.height=ht+"px"; if(!IndexOFz){ x.style.overflow='hidden'; var IndexOFz=obj_here; } z[IndexOFz]=setTimeout("increase("+hx+",'"+obj_here+"','"+IndexOFz+"')",the_delay); } else { z[IndexOFz]=null; IndexOFz=null; current_height[obj_here]=null; tspeed[obj_here]=null; x.style.height=hx+"px"; x.style.overflow='visible'; } } // JavaScript Document var highlight_div='highlight_div'; var highlight_div_a='highlight_div_a'; var original_class="txt"; var hightlight_class= "txt2"; var flip_timer=null; var time_arrays=new Array(); var maximum=5; function news_hightlight(active_tab,turn_off,prefix){ if(window.locaiton && window.location.toString().indexOf("en")>-1){ maximum=4; } var active_carousel=0; if(!prefix)prefix=""; if(!prefix || prefix=="") active_carousel=1; else if(prefix.indexOf("2")>-1)active_carousel=2; else if(prefix.indexOf("3")>-1)active_carousel=3; if(typeof active_tab == "string" || typeof active_tab == "String"){ active_tab=$(active_tab); } // window.status=active_tab.id; clearTimeout(time_arrays[active_carousel]); flip_timer=null; temp_tab=active_tab; var no_none=true; var level=0; var temp_tab=temp_tab=temp_tab.parentNode while(temp_tab.parentNode && level< maximum ){ level++; if(temp_tab.style.display=='none'){ no_none=false; break; } temp_tab=temp_tab.parentNode; } if(no_none==false){ time_arrays[active_carousel]=setTimeout('news_hightlight("'+active_tab.id+'",0,"'+prefix+'")',100); return; } var next=active_tab.id.replace("news_tab_",""); if(next > ( ( active_carousel * (maximum+1) ) -1 ) ) { next=( active_carousel * (maximum+1) ) - maximum ; } else { next++; } $("news_hightlight_div_a").href=$("news_tab_item_"+active_tab.id.replace("news_tab_","")).href; window.status=active_tab.id; $(highlight_div).style.display='block'; var a_tags2=active_tab.getElementsByTagName("a"); a_tags2[0].className=hightlight_class; var pos=returnPos(a_tags2[0]); $(highlight_div).style.left=(pos.x-94)+"px"; $(highlight_div).style.top=(pos.y-2)+"px"; var imgs=$("news_images"+prefix).innerHTML.split("|"); var parents=active_tab.parentNode.childNodes; var new_img=""; for(x=0;x-1){ if( $(parents[x].id.replace("news_tab_","news_content_")) ){ $(parents[x].id.replace("news_tab_","news_content_")).style.display='none'; } var a_tags=parents[x].getElementsByTagName("a"); if(a_tags && a_tags[0])a_tags[0].className=original_class; } } var a_tags2=active_tab.getElementsByTagName("a"); a_tags2[0].className=hightlight_class; for(j=0;j-1)active_carousel=2; else if(prefix.indexOf("3")>-1)active_carousel=3; if(!prefix)prefix=""; var position=returnPos("news_back_image"+prefix); if(!document.getElementById('loading')){ var loading_img=document.createElement("img"); loading_img.src='images/ajx_loading.gif'; loading_img.style.width='41px'; loading_img.style.height='11px'; loading_img.id='loading'; loading_img.style.filter = 'alpha(opacity=70)'; loading_img.style.opacity = '0.7'; loading_img.style.position='absolute'; loading_img.style.left=(parseInt(position.x)+135)+"px"; loading_img.style.top=(parseInt(position.y)+100)+"px"; document.body.appendChild(loading_img); } var imgs=$("news_images"+prefix).innerHTML.split("|"); for(j=0;j=source.text.length){ $("nlink").innerHTML=source.text; setTimeout("next_word()",3500); return; } if($("nlink").innerHTML.length>=0){ $("nlink").innerHTML=$("nlink").innerHTML.substr(0,($("nlink").innerHTML.length-1)); $("nlink").innerHTML=source.text.substr(0,$("nlink").innerHTML.length+1)+"_"; } setTimeout("next_char()",30); } var array=[]; var pointer=-1; function next_word(){ if(pause1==1){ setTimeout("next_word()",3500); return; } pointer++; if(pointer>(array.length-1))pointer=0; if(array.length==0)array=$('news_flash_list').getElementsByTagName("a"); source.text=array[pointer].innerHTML; source.href=array[pointer].href; $("nlink").innerHTML=""; $("nlink").href=source.href; next_char(); } var ajax=new Array(); function init_sub_tabs(container,main_class){ if(!main_class)main_class="sub_tab"; if(!container)container=document; else container=$(container); var a=container.getElementsByTagName("a"); for(i=0;i-1){ a[i].onclick=function(){ if(this.parentNode) for(s=0;s---((AJAX Library Version 1.5 By Shehabic))---< ## ## Features Added In Versions 1.5 : ## ## 1-Support For Back And Forward And Compatibility With Cross Browser Platforms ## ## 2-Addes Support For Gecko Compatible Browsers ## ## 3-Easy To Use With Ability For the Search Enginer To Index Ajax Pages ## ## 4-Fast Back & Forward Support // Much Faster Than V.1.0 ## ## 5-Automatic Support For Refresh In Firefox ## ## (c) Copyright Shehabic All Rights Reserver ## ## Shehabic@gmail.com ## ## ->You Can Use This Or Distribute It For Free As Long As You Keep The Copyrights ## ## To Its Respective Owner ## ###################################################################################### ####################################################################################*/ var hiderT=new Array(); var rqs=null,place_id=null; function sR2(url,params,HttpMethod,anyID){ if(rqs!=null){ rqs.abort(); rqs=null; } if(getobjbyid(anyID)) { var wids=getobjbyid(anyID).offsetWidth; var hei=getobjbyid(anyID).offsetHeight; var lef=getobjbyid(anyID).offsetLeft; var rig=getobjbyid(anyID).offsetTop; } if(getobjbyid("loading") && getobjbyid(anyID)){ var ww=0; var hh=0; getobjbyid("loading").style.left=(parseInt(lef)+(parseInt(wids)/2)-(ww/2))+"px"; getobjbyid("loading").style.top=(parseInt(rig)+(parseInt(hei)/2)-(hh/2))+"px"; } if (!HttpMethod)HttpMethod="POST"; rqs=initXMLHTTPRequest();place_id=anyID; if (rqs){ rqs.open(HttpMethod,url,true); rqs.onreadystatechange=onReadyState2; rqs.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); rqs.send(params); } } function onReadyState2(){ if (rqs) { var ready=rqs.readyState; var data=null; getScrollXY(); if (ready==4) { pass_ID=place_id; data=rqs.responseText; place_id=null; rqs=null; if(getobjbyid("loading")) { getobjbyid("loading").style.visibility="hidden"; getobjbyid("loading").style.display="none"; } if(data.indexOf("_btn")>-1){ setTimeout("fix_calendar()",1200); } if(data.indexOf("[RELOAD]")>-1) { location.reload(); } if(data.indexOf("[MSGBOX]")>-1) { alert("MSG COMING"); alert(data.replace("[MSGBOX]","")); } else if(data.indexOf("[VALIDATE]")>-1) { data=data.replace("[VALIDATE]",""); var splitted=data.split(":"); if(splitted[0]=="good"){ set("good",splitted[1]); $(splitted[1]).innerHTML=good+splitted[2]; }else{ set("bad",splitted[1]); $(splitted[1]).innerHTML=bad+splitted[2]; } } else if(data.indexOf("[RICH_EDIT]")>-1) { while(data.indexOf("[RICH_EDIT]")>-1){ data=data.replace("[RICH_EDIT]",""); } toConsole(data,pass_ID); var GENERAL_TIMER=setTimeout("loadinwin()",1000); } else if(data.indexOf("[COOKIE]")>-1) { var dt=data.split("[COOKIE]"); data=dt[1]; toConsole(data,pass_ID); var cookie=dt[0].split("::"); setCookie(cookie[0],cookie[1]); } else if(data.indexOf("[SCRIPT]")>-1) { var dt=data.split("[SCRIPT]"); data=dt[1]; toConsole(data,pass_ID); all_scripts=dt[0].split("||"); for(scr=0;scr-1) { } else if(data.indexOf("[IM_LIST]")>-1) { data=data.replace('[IM_LIST]',''); var parts=data.split('--+--'); $(parts[0]).innerHTML=parts[2]; current_div=parts[0]; displ(parseInt(parts[1])); } else if((data.indexOf("[OPENURL]")>-1)) { } else{ toConsole(data,pass_ID); } } else { // Something Here By SHOX... if(getobjbyid("loading")){ getobjbyid("loading").style.visibility="visible"; getobjbyid("loading").style.display="block"; } } } } var req=new Array(); var The_ID=new Array(); function run(URL){ var NAV=navigator.userAgent; if(NAV.toString().indexOf("fox")>-1){ parent.window.open("#"+URL,"_self"); }else{ fr=window.open("","ax"); fr.document.open(); fr.document.write(URL); fr.document.close(); } parent.document.getElementById("axp").value=URL; setCookie("LRE_LAST_PAGE",URL); } var timer_counter=0; var timer; var req=new Array(); var The_ID=new Array(); function getobjbyid(id){ var obj = null; if(document.getElementById){ obj = document.getElementById(id); }else if(document.all){ obj = document.all[id]; } return obj; } function sR(url,params,HttpMethod,anyID){ if(getobjbyid(anyID)) { // var wids=getobjbyid(anyID).offsetWidth; // var hei=getobjbyid(anyID).offsetHeight; var wids=0; var hei=0; var lef=getobjbyid(anyID).offsetLeft; var rig=getobjbyid(anyID).offsetTop; } if(getobjbyid("loading") && getobjbyid(anyID)){ // var ww=parseInt(getobjbyid("loading").style.width); // var hh=parseInt(getobjbyid("loading").style.height); var ww=0; var hh=0; if(parseInt((parseInt(lef)+(parseInt(wids)/2)-(ww/2)))>500){ getobjbyid("loading").style.left=500+"px"; }else{ getobjbyid("loading").style.left=(parseInt(lef)+(parseInt(wids)/2)-(ww/2))+"px"; } getobjbyid("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 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 onReadyState(){ for (i=0;i-1){ // return; } if(data.indexOf("[RELOAD]")>-1) { location.reload(); } if(getobjbyid("loading")) { getobjbyid("loading").style.visibility="hidden"; } if(data.indexOf("_btn")>-1){ setTimeout("fix_calendar()",1200); } if(data.indexOf("[MSGBOX]")>-1) { alert(data.replace("[MSGBOX]","")); } else if(data.indexOf("[USER_COMMENT_ADDED]")>-1){ data2=data.split("[USER_COMMENT_ADDED]"); toConsole(data2[0],pass_ID); var move_to_div='user_comments_anchor'; var temp_div=document.createElement("div"); temp_div.id='temp_holder_div' temp_div.style.display='none'; document.body.appendChild(temp_div); temp_div.innerHTML=data2[1]; setTimeout('place_div("temp_holder_div","all_user_comments")',2010); setTimeout("move_to('"+move_to_div+"')",2000); } else if(data.indexOf("[VALIDATE]")>-1) { data=data.replace("[VALIDATE]",""); var splitted=data.split(":"); if(splitted[0]=="good"){ set("good",splitted[1]); $(splitted[1]).innerHTML=good+splitted[2]; }else{ set("bad",splitted[1]); $(splitted[1]).innerHTML=bad+splitted[2]; } } else if(data.indexOf("[RICH_EDIT]")>-1) { while(data.indexOf("[RICH_EDIT]")>-1){ data=data.replace("[RICH_EDIT]",""); } toConsole(data,pass_ID); var GENERAL_TIMER=setTimeout("loadinwin()",1000); } else if(data.indexOf("[SCRIPT]")>-1) { var dt=data.split("[SCRIPT]"); data=dt[1]; toConsole(data,pass_ID); all_scripts=dt[0].split("||"); for(scr=0;scr-1) { } else if(data.indexOf("[IM_LIST]")>-1) { data=data.replace('[IM_LIST]',''); var parts=data.split('--+--'); $(parts[0]).innerHTML=parts[2]; current_div=parts[0]; displ(parseInt(parts[1])); } else if((data.indexOf("[OPENURL]")>-1)) { alert(data.replace("[OPENURL]","")); } else{ toConsole(data,pass_ID); } } else { // Something Here By SHOX... if(getobjbyid("loading")){ getobjbyid("loading").style.visibility="visible"; } } } } } function toConsole(data,pass_ID) { if (data!=null) { if(data.indexOf("[-]")!=-1) { opts_str=data.split("[-]"); if(getobjbyid(pass_ID)) { getobjbyid(pass_ID).innerHTML=opts_str[0]; if(getobjbyid(pass_ID+"_content"))getobjbyid(pass_ID+"_content").innerHTML=opts_str[1]; } } else { if(getobjbyid(pass_ID)){ if(typeof getobjbyid(pass_ID).value != "undefined"){ getobjbyid(pass_ID).value=data; }else{ getobjbyid(pass_ID).innerHTML=data; } } } } } 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 cX; var cY; var moving=false; var rot; var rad=73; function loadscript(path_to_file) { var oScript = document.createElement("script"); oScript.src = path_to_file; document.body.appendChild(oScript); } function insertcode(tag, desc) { // our open tag var open = "[" + tag + "]"; // our close tag var close = "[/" + tag + "]"; // IE Behaviour if (document.selection){ if(!$("comment_comment").setSelectionRange) { var selected = document.selection.createRange().text; if(selected.length <= 0) { // no text was selected so prompt the user for some text $("comment_comment").value += open + prompt("Please enter the text you'd like to " + desc, "") + close; } else { // put the code around the selected text document.selection.createRange().text = open + selected + close; } } else { // the text before the selection // var b=$("comment_comment").createRange().text; var pretext = $("comment_comment").value.substring(0, b.selectionStart); // the selected text with tags before and after var codetext = open + $("comment_comment").value.substring(b.selectionStart, b.selectionEnd) + close; // the text after the selection var posttext = $("comment_comment").value.substring(b.selectionEnd, $("comment_comment").value.length) // check if there was a selection if(codetext == open + close) { //prompt the user codetext = open + prompt("Please enter the text you'd like to " + desc, "") + close; } // update the text field $("comment_comment").value = pretext + codetext + posttext; } } else if (typeof $("comment_comment").selectionStart != 'undefined'){ var $before, $after, $selection; $before= $("comment_comment").value.substring(0, $("comment_comment").selectionStart) $selection = $("comment_comment").value.substring($("comment_comment").selectionStart, $("comment_comment").selectionEnd) $after = $("comment_comment").value.substring($("comment_comment").selectionEnd, $("comment_comment").value.length) $("comment_comment").value= String.concat($before, open, $selection, close) } // set the focus on the text field $("comment_comment").focus(); } // inserts an image by prompting the user for the url function t(IDHERE,mode){ if(mode==0){ IDHERE.style.border="#EEEEEE 1px solid"; IDHERE.style.background="#FFFFFF 1px solid"; }else{ IDHERE.style.border="#555555 1px solid"; IDHERE.style.background="#EEEEEE 1px solid"; } } function insertimage() { // our image var image = '[IMG ALT=""]'+prompt("Please enter the url", "http://") + "[/IMG]"; if(!$("comment_comment").setSelectionRange) { // get selected text var selected = document.selection.createRange().text; if(selected.length <= 0) { // no text was selected so add the image to the end $("comment_comment").value += image; } else { // replace the selection with the image document.selection.createRange().text = image; } } else { // the text before the selection var pretext = $("comment_comment").value.substring(0, b.selectionStart); // the text after the selection var posttext = $("comment_comment").value.substring(b.selectionEnd, $("comment_comment").value.length) // update the text field $("comment_comment").value = pretext + image + posttext; } // set the focus on the text field $("comment_comment").focus(); } // inserts a link by prompting the user for a url function insertlink() { // our link var url = prompt("Please enter the url", "http://"); var lnk = "[URL=" + url + "]" + url + "[/URL]"; if(!$("comment_comment").setSelectionRange) { // get selected text var selected = document.selection.createRange().text; if(selected.length <= 0) { // no text was selected so add the link to the end $("comment_comment").value += lnk; } else { // replace the selection with the link document.selection.createRange().text = lnk; } } else { // the text before the selection var pretext = $("comment_comment").value.substring(0, b.selectionStart); // the text after the selection var posttext = $("comment_comment").value.substring(b.selectionEnd, $("comment_comment").value.length) // update the text field $("comment_comment").value = pretext + lnk + posttext; } // set the focus on the text field $("comment_comment").focus(); } // JavaScript Document function report_comment(comment_id,sec_code,button){ button.enabled=false; sR("report_comment.html","&id="+comment_id+"&sec_code="+sec_code,"POST","report_comment_"+comment_id); } function add_comment(){ var x=true; x=x & validate_item('user_name'); x=x & validate_item('user_email'); x=x & validate_item('comment_comment'); x=x & validate_item('sec_code'); if(!x) { }else{ fade_div("add_your_comment_holder"); } } function fade_div(div_id){ var d=$(div_id); d.parentWidth=d.parentNode.offsetWidth; d.parentHeight=d.parentNode.offsetHeight; if(typeof d.style.opacity!="undefined"){ if(typeof d.alpha=="undefined"){ d.alpha=new Object(); d.alpha=90; d.style.opacity='0.9'; setTimeout("fade_div('"+div_id+"');",30); } else{ if(parseInt(d.alpha)>0){ d.alpha=parseInt(parseInt(d.alpha)-10); d.style.opacity=(parseInt(d.alpha)/100); setTimeout("fade_div('"+div_id+"');",30); } else{ d.style.display='none'; d.parentNode.style.height=parseInt(d.parentHeight)+"px"; d.parentNode.style.width=parseInt(d.parentWidth)+"px"; proceed_to_add_comment(); } } } else{ if(typeof d.alpha=="undefined"){ d.alpha=new Object(); d.alpha=90 d.style.filter='alpha(opacity='+90+');'; setTimeout("fade_div('"+div_id+"');",30); }else{ if(parseInt(d.alpha)>0){ d.alpha=parseInt(d.alpha)-10; d.style.filter='alpha(opacity='+d.alpha+');'; setTimeout("fade_div('"+div_id+"');",30); }else{ d.style.display='none'; d.parentNode.style.height=parseInt(d.parentHeight)+"px"; d.parentNode.style.width=parseInt(d.parentWidth)+"px"; d.parentNode.style.overflow='hidden'; proceed_to_add_comment(); } } } } function quick_escape2(str){ while(str.indexOf("&")>-1)str=str.replace("&","%26"); while(str.indexOf("+")>-1)str=str.replace("+","%2B"); return str; } function proceed_to_add_comment(){ var url=""; url=url+"&comment_comment="+quick_escape2($('comment_comment').value); url=url+"&comment_title="+quick_escape2($('comment_title').value); url=url+"&user_name="+quick_escape2($('user_name').value); url=url+"&user_email="+quick_escape2($('user_email').value); url=url+"&sec_code="+quick_escape2($('sec_code').value); url=url+"&sec_code2="+quick_escape2($('sec_code2').value); url=url+"&AJX=2"; sR("add_user_comment.php",url,"POST","add_your_comment_holder1"); smooth_resize_div("add_your_comment_holder1"); } function smooth_resize_div(div_id){ d=$(div_id); if(typeof d.minHeight=="undefined"){ var dc=document.createElement("div"); dc.id="temp_div"; dc.style.height=parseInt(d.parentNode.offsetHeight)+"px"; dc.style.width='10px'; var loader=document.createElement("div"); d.appendChild(loader); loader.id='loading'; loader.innerHTML='
'; d.parentNode.insertBefore(dc,d.parentNode.nextSibling); var old=new Object(); old.h=d.offsetHeight; d.style.height='auto'; d.minHeight=d.offsetHeight; d.style.height=parseInt(old.h)+"px"; dc.parentNode.removeChild(dc); setTimeout('smooth_resize_div("'+div_id+'");',20); }else{ if(parseInt(d.offsetHeight)>d.minHeight){ var steps=Math.round((parseInt(d.offsetHeight)-parseInt(d.minHeight))/8); if(steps<1)steps=1; d.style.height=(parseInt(d.style.height)-steps)+"px"; setTimeout('smooth_resize_div("'+div_id+'");',20); }else{ d.style.height='auto'; d.minHeight=null; } } } function place_div(container1,final_destination){ container1=$(container1); final_destination=$(final_destination); if(container1.childNodes.length==0){ return; } var div=container1.childNodes[0]; document.body.appendChild(div); if(final_destination.childNodes.length==0){ final_destination.appendChild(div); return; } if(final_destination.childNodes.length>0){ final_destination.insertBefore(div,final_destination.childNodes[0]); return; } } function move_to(div_name){ clearInterval(Scroller.interval); Scroller.interval=setInterval("Scroller.scroll("+Scroller.gy($(div_name))+")",10); } function check_email(eml) { if (eml.indexOf('@')<3) return false; if (eml.indexOf('.')==-1) return false; if(eml.indexOf('.')>(parseInt(eml.length)-3)) return false; else return true; } function set(type1,ITEMHERE){ if(type1=="good"){ }else{ } } function matchit(item1,in_item2) { var re = new RegExp(item1); var m = re.exec(in_item2); if (m == null) return false; else return (m.index+1); } var bad="Error "; var good="Valid "; function validate_item(itemID){ var msg=""; var finalID=itemID+"_validator"; $(finalID).style.alignText="left"; switch(itemID){ case "user_name": if($(itemID).value.length<4){ msg=bad+" "; set("bad",finalID); }else{ msg=good+" ";set("good",finalID); } break; case "comment_comment": if($(itemID).value.length<4){ msg=bad+" "; set("bad",finalID); }else{ msg=good+" ";set("good",finalID); } break; case "sec_code": if($(itemID).value.length<3){ msg=bad+" "; set("bad",finalID); }else{ msg=good+" ";set("good",finalID); } break; case "user_email": if(matchit("[0-9]",$(itemID).value)==1){ msg=bad+" "; set("bad",finalID); } else if(check_email($(itemID).value)==false){ msg=bad+" "; set("bad",finalID); } else{ msg=good+" ";set("good",finalID); } break; } $(finalID).style.fontSize="12px"; $(finalID).style.fontFamily="Tahoma"; $(finalID).innerHTML=msg; if(msg.indexOf(bad)>-1){ $(itemID).style.backgroundColor='#FFEEEE'; return false; } else{ $(itemID).style.backgroundColor='#FFFFFF'; return true; } } /*-------------------------------------------------------------------------- * Smooth Scroller Script, version 1.0.1 * (c) 2007 Dezinerfolio Inc. * * For details, please check the website : http://dezinerfolio.com/ * /*--------------------------------------------------------------------------*/ Scroller = { // control the speed of the scroller. // dont change it here directly, please use Scroller.speed=50; speed:10, // returns the Y position of the div gy: function (d) { gy = d.offsetTop if (d.offsetParent) while (d = d.offsetParent) gy += d.offsetTop return gy }, // returns the current scroll position scrollTop: function (){ body=document.body d=document.documentElement if (body && body.scrollTop) return body.scrollTop if (d && d.scrollTop) return d.scrollTop if (window.pageYOffset) return window.pageYOffset return 0 }, // attach an event for an element // (element, type, function) add: function(event, body, d) { if (event.addEventListener) return event.addEventListener(body, d,false) if (event.attachEvent) return event.attachEvent('on'+body, d) }, // kill an event of an element end: function(e){ if (window.event) { window.event.cancelBubble = true window.event.returnValue = false return; } if (e.preventDefault && e.stopPropagation) { e.preventDefault() e.stopPropagation() } }, // move the scroll bar to the particular div. scroll: function(d){ i = window.innerHeight || document.documentElement.clientHeight; h=document.body.scrollHeight; a = Scroller.scrollTop() if(d>a) if(h-d>i) a+=Math.ceil((d-a)/Scroller.speed) else a+=Math.ceil((d-a-(h-d))/Scroller.speed) else a = a+(d-a)/Scroller.speed; window.scrollTo(0,a) if(a==d || Scroller.offsetTop==a)clearInterval(Scroller.interval) Scroller.offsetTop=a }, // initializer that adds the renderer to the onload function of the window init: function(){ Scroller.add(window,'load', Scroller.render) }, // this method extracts all the anchors and validates then as # and attaches the events. render: function(){ a = document.getElementsByTagName('a'); Scroller.end(this); window.onscroll for (i=0;i=45) { cmin1=45; csec1=00; $("display_result").value=display(cmin1,csec1); } else { UpRepeat(); } } if(match_status == 2) { cmin1=45; csec1=00; $("display_result").value=display(cmin1,csec1); } if(match_status == 3) { cmin2=90; csec2=00; if(cmin1>=90) { cmin1=90; csec1=00; $("display_result").value=display(cmin1,csec1); } else { UpRepeat(); } } if(match_status == 5) { cmin2=15; csec2=00; if(cmin1>=15) { cmin1=15; csec1=00; $("display_result").value=display(cmin1,csec1); } else { UpRepeat(); } } if(match_status == 6) { cmin2=15; csec2=00; if(cmin1>=15) { cmin1=15; csec1=00; $("display_result").value=display(cmin1,csec1); } else { UpRepeat(); } } if(match_status == 7) { cmin1=00; csec1=00; $("display_result").value=display(cmin1,csec1); } } } function UpRepeat() { csec1++; if(csec1==60) { csec1=0; cmin1++; } $("display_result").value=display(cmin1,csec1); if((cmin2==cmin1)&&(csec2==csec1)) $("display_result").value=display(cmin2,csec2); else up=setTimeout("UpRepeat()",1000); }