// Global Variables //var ; var cookieName = 'navCookie'; var divNames = new Array("leftobj01","leftobj02","leftobj03","leftobj04","leftobj05","leftobj06","leftobj07","leftobj08","leftobj09","leftobj10","leftobj11","leftobj12","leftobj13","leftobj14","leftobj15","leftobj16","leftobj17"); /*-.....................................................................................-*/ // function for show and hide a box. normally the appear fade mode is using here. but it can be change by changing just the mode function getSrcPath(path){ index=path.lastIndexOf("admin_img"); index=index+10; path=path.substring(0,index); return path; } /****Method for empty value check in the CKEDITOR**** Milan 20/11/09 **********/ function notEmpty(){ var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; var textvalue; var framename; var elementValue; if(is_chrome) { elementValue = window.frames['Rich text editor, content'].document.body.innerText; } else if(navigator.appName =="Microsoft Internet Explorer") { elementValue = window.frames['myIframe'].document.body.innterText; } else { elementValue = window.frames['myIframe'].document.body.textContent; } if(elementValue.length<2) { alert("Please write a comment"); return false; } return true; } function hide_show_obj(div_to_hide, change_img) { path=getSrcPath($(change_img).src); $(change_img).src = ( $(div_to_hide).visible() ) ? path+'maximize.gif' : path+'minimize.gif'; new Effect.toggle(div_to_hide, 'appear'); } function hide_show_obj_left(div_to_hide, change_img) { path=getSrcPath($(change_img).src); $(change_img).src = ( $(div_to_hide).visible() ) ? path+'maximize.gif' : path+'minimize.gif'; new Effect.toggle(div_to_hide, 'appear'); for(i = 0; i < divNames.length; i++) { if( div_to_hide == divNames[i] && (i+1) != divNames.length)i++; $(divNames[i]).style.display = 'none'; $('leftobjimg' + divNames[i].substr(7)).src = path+'maximize.gif' ; } } /*-.....................................................................................-*/ function show_hide_left(change_img) { path=getSrcPath($(change_img).src); if ( $('leftcolumn').visible() ) { $(change_img).src = path+'show.gif'; Element.setStyle($('content'),{background:'url()'}); $('leftcolumn').style.display = 'none'; Element.setStyle($('leftcolumn'),{width: '0px'}); Element.setStyle($('contentpanel'),{marginLeft: '30px'}); } else { Element.setStyle($('content'),{background:'url('+path+'lef-nav-bg.gif) repeat-y'}) Element.setStyle($('content'),{overflow:'hidden'}) Element.setStyle($('content'),{position:'relative'}) Element.setStyle($('content'),{backgroundColor:'#30353B'}) $(change_img).src = path+'hide.gif'; $('leftcolumn').style.display = 'block'; Element.setStyle($('contentpanel'),{marginLeft: '265px'}); Element.setStyle($('leftcolumn'),{width: '235px'}); } } /*-.....................................................................................-*/ // change middle contents when click on the left navigation function load_page(pagetoload) { document.body.style.cursor = "wait"; loadreq = (window.XMLHttpRequest ? new XMLHttpRequest(): ((window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : null) ); if (loadreq) { loadreq.onreadystatechange = state_loadreq; loadreq.open("POST",'load-page.php',true); loadreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); loadreq.send('pagetoload='+pagetoload); } } function state_loadreq() { if ( loadreq.readyState == 4 ) { if (loadreq.status == 200) { document.getElementById('contentpanel').innerHTML = loadreq.responseText; } document.body.style.cursor = "default"; } } /*-........................................................................................-*/ // change the mode like dashboard, todo list and msgboard function switch_mode(which) { var divlist = new Array('dashboard','msgboard','todolist'); for (var i = 0; i < divlist.length; i++) { if ( which == divlist[i] ) { $(which+'img1').src = './images/top-nav-bullet.png'; $(which+'img2').src = './images/top-nav-tail.png'; $(which).className = 'top-nav-txt'; } else { $(divlist[i]+'img1').src = './images/top-nav-bullet2.png'; $(divlist[i]+'img2').src = './images/top-nav-tail2.png'; $(divlist[i]).className = 'top-nav-txt2'; } } } /*-......................................................................................... -*/ // adding a category form the add portfolio part into database function isEmpty(frm,cat) { var category = eval("document."+frm+"('"+cat+"').value"); var setval=true if ( ( category == '') || (category == null) ) { alert('This Field Should Not Be Empty.'); setval=false } if(setval) return true } /*-......................................................................................... -*/ // editing a color scheme // just show the edit pane with the value function show_edit_color(colorid) { $('editpane').style.display = 'block'; $('addcolor').style.display = 'none'; } function confirm_delete() { var val; val = confirm("Do you want to delete?"); return val; } // // Here nevigation js code are added // expand all divs function expandAll(ob) { for(i = 0; i < ob.length; i++) { $(ob[i]).style.display = "block" ; } } // collapse all divs function collapseAll(ob) { for(i = 0; i < ob.length; i++) { $(ob[i]).style.display = "none" ; } } // open/close the section div function openClose(ob, timg) { collapseAll(divNames); if (ob.style.display != "none") { ob.style.display= "none"; timg.src = "./images/plus.gif"; } else { ob.style.display= "block"; timg.src = "./images/minus.gif"; } } // store the values of section div's display property on cookie function setCookie(Cookie, value, expiredays) { var ExpireDate = new Date (); ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000)); document.cookie = Cookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString()); } // retrieve the values of section div's display property from cookie function getCookie(Cookie) { //alert(document.cookie); if (document.cookie.length > 0) { begin = document.cookie.indexOf(Cookie+"="); if (begin != -1) { begin += Cookie.length+1; end = document.cookie.indexOf(";", begin); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(begin, end)); } } return null; } // set the section div's display property according to the cookie function LoadMenu() { cookieMenu = getCookie(cookieName);//alert("-- "+cookieMenu); path=getSrcPath($('leftobjimg01').src); if(cookieMenu != null) { for(i = 0; i < divNames.length; i++) { if(cookieMenu.indexOf(divNames[i]) != -1) { new Effect.toggle(divNames[i], 'appear'); //$(divNames[i]).style.display = 'block'; $('leftobjimg' + divNames[i].substr(7)).src = path+'minimize.gif'; } else { $(divNames[i]).style.display = 'none'; $('leftobjimg' + divNames[i].substr(7)).src = path+'maximize.gif' ; } } } else { for(i = 0; i < divNames.length; i++) { $(divNames[i]).style.display = 'none'; $('leftobjimg' + divNames[i].substr(7)).src = path+'maximize.gif' ; } } } // save the values of section div's display property on cookie before unload function SaveMenu() { var cookiestring = ''; for(i = 0; i < divNames.length; i++) { var block = $(divNames[i]); if(block.style.display != 'none') { cookiestring += divNames[i] + '|'; } } setCookie(cookieName,cookiestring,1); //cookieMenu = getCookie(cookieName);alert("# "+cookieMenu); } function emailCheck(id) { var err = ''; var emailStr = document.getElementById(id).value; var checkTLD=1; var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/; var emailPat=/^(.+)@(.+)$/; var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]"; var validChars="\[^\\s" + specialChars + "\]"; var quotedUser="(\"[^\"]*\")"; var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; var atom=validChars + '+'; var word="(" + atom + "|" + quotedUser + ")"; var userPat=new RegExp("^" + word + "(\\." + word + ")*$"); var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$"); var matchArray=emailStr.match(emailPat); if (matchArray==null) { err = "Email address seems incorrect (check @ and .'s)"; return err; } var user=matchArray[1]; var domain=matchArray[2]; for (i=0; i127) { err ="Ths username contains invalid characters."; return err; } } for (i=0; i127) { err ="Ths domain name contains invalid characters."; return err; } } if (user.match(userPat)==null) { err = "The username doesn't seem to be valid."; return err; } var IPArray=domain.match(ipDomainPat); if (IPArray!=null) { for (var i=1;i<=4;i++) { if (IPArray[i]>255) { err = "Destination IP address is invalid!"; return err; } } return true; } var atomPat=new RegExp("^" + atom + "$"); var domArr=domain.split("."); var len=domArr.length; for (i=0;i"); iEndIndex=titleAll.lastIndexOf(""); title=titleAll.substring(0,iIndex); content=titleAll.substring(iIndex+3,iEndIndex);*/ //cont=content.split("#!#"); //alert(cont[0]); //alert(cont[1]); newsId=$('ft_id_'+id).value; title=$('ft_title_'+id).value; content=$('ft_cont_'+id).value; elm.innerHTML = '

'+title+'

'+ '

'+content+'

'+ 'read more >>'; new Effect.Move(elm, { x:0 , y: -30, mode:'relative', duration: 6}); obj.addClassName('select'); } function inload() { $('msg_cont').setStyle({opacity:0.5}); }; function reqAction(parms){ //Dialog.alert("You have to agree to the Terms and Conditions for get an account.", {top: 150, width:250, className: "alphacube"}); Dialog.confirm($('reqaction').innerHTML, {top: 150, width:350, className: "alphacube", okLabel: "Submit", cancelLabel:"Close", onOk:function(win){ if($('reason').value == ''){ $('msg_suc').hide(); $('msg_err').innerHTML='Please provide a reason'; $('msg_err').show(); Windows.focusedWindow.updateHeight(); new Effect.Shake(Windows.focusedWindow.getId()); return false; } else{ parms=parms+'&reason='+$('reason').value; new Ajax.Request('/req_actions/add/', {method: 'post', parameters: parms}); //Windows.focusedWindow.close(); $('msg_err').hide(); $('msg_suc').innerHTML='Your message is successfully sent'; $('msg_suc').show(); $('reason').value=''; Windows.focusedWindow.updateHeight(); new Effect.Shake(Windows.focusedWindow.getId()); return false; } } }); } function sendMsg(id){ parms='user_id='+id; Dialog.confirm($('sendmsg').innerHTML, {top: 150, width:350, className: "alphacube", okLabel: "Send", cancelLabel:"Close", onOk:function(win){ if($('title').value == '' || $('msg').value == ''){ $('msg_suc').hide(); $('msg_err').innerHTML='Please Complete both the fields'; $('msg_err').show(); Windows.focusedWindow.updateHeight(); new Effect.Shake(Windows.focusedWindow.getId()); return false; } else{ parms=parms+'&title='+$('title').value+'&msg='+$('msg').value; new Ajax.Request('/users/send_msg/', {method: 'post', parameters: parms, onSuccess: function(re) { if(re.responseText=='error'){ $('msg_suc').hide(); $('msg_err').innerHTML='Could not send message'; $('msg_err').show(); Windows.focusedWindow.updateHeight(); new Effect.Shake(Windows.focusedWindow.getId()); return false; } else if(re.responseText=='success'){ $('msg_err').hide(); $('msg_suc').innerHTML='Your message is successfully sent'; $('msg_suc').show(); Windows.focusedWindow.updateHeight(); new Effect.Shake(Windows.focusedWindow.getId()); return false; } } }); //Windows.focusedWindow.close(); } } }); } function forgetPass(){ Dialog.confirm($('forgetpass').innerHTML, {top: 150, width:350, className: "alphacube", okLabel: "Yes", cancelLabel:"No", onOk:function(win){ if($('email').value == ''){ $('email_suc').hide(); $('email_err').innerHTML='Please give an email address'; $('email_err').show(); Windows.focusedWindow.updateHeight(); new Effect.Shake(Windows.focusedWindow.getId()); return false; } else{ parms='email='+$('email').value; new Ajax.Request('/users/forget_pass/', {method: 'post', parameters: parms, onSuccess: function(re) { if(re.responseText=='invalid email'){ $('email_suc').hide(); $('email_err').innerHTML='Please give a valid email address'; $('email_err').show(); Windows.focusedWindow.updateHeight(); new Effect.Shake(Windows.focusedWindow.getId()); return false; } else if(re.responseText=='success'){ $('email_err').hide(); $('email_suc').innerHTML='Your new password is sent to your email address'; $('email_suc').show(); Windows.focusedWindow.updateHeight(); new Effect.Shake(Windows.focusedWindow.getId()); return false; } } }); //Windows.focusedWindow.close(); } } }); } function showEmblem(id,title,img){ //$('emblem_details').style.display='block'; Effect.Appear('emblem_details', { duration: 0.5 }); $('em_title').innerHTML=title; $('em_img').innerHTML=''+title+''; $('em_des').innerHTML=$('emblem_des_'+id).value; //Dialog.alert($('emblem_details').innerHTML,{top: 100, width:350, height:300, className: "alphacube", okLabel: "Close"}); } function showEmblemBadge(id,title,img){ document.getElementById('emblem_details').style.display='block'; //Effect.Appear('emblem_details', { duration: 0.5 }); document.getElementById('em_title').innerHTML=title; document.getElementById('em_img').innerHTML=''+title+''; document.getElementById('em_des').innerHTML=document.getElementById('emblem_des_'+id).value; //Dialog.alert($('emblem_details').innerHTML,{top: 100, width:350, height:300, className: "alphacube", okLabel: "Close"}); } function closeEmblemBadge(id,title,img){ document.getElementById('emblem_details').style.display='none'; } function showAssignEmblem(id,user){ document.getElementById('assign_box').style.display='block'; $('UserName').value=user; $('UserId').value=id; $('emblemId').value = ''; } function showStausUser(id,user,status){ document.getElementById('assign_box').style.display='block'; $('UserName').value=user; $('UserId').value=id; $('Status').value=status; } function selEmblem(id,cur){ $('emblemId').value=id; for(i=1;i< $('cur').value;i++){ if(i==cur) $('emb_'+i).style.border='2px solid red'; else $('emb_'+i).style.border='0'; } } function checkAssign(){ if($('emblemId').value == ""){ alert('Please Select An Emblem'); return false; } return true; } function showMe(x){ document.getElementById(x).style.display='block'; } function hideMe(x){ document.getElementById(x).style.display='none'; //alert(x); } function swapDisplay(id){ if($(id).style.display=='none') $(id).style.display='block'; else $(id).style.display='none'; } function showPurposeInp(){ if($('purpose').value=='Others') $('purposeinp').style.display='block'; else $('purposeinp').style.display='none'; } function swapTopic(id){ if(id == 1){ $('topic_cont').style.display='block'; $('link_cont').style.display='none'; $('feat_topic').className='select'; $('quick_link').className=''; } else if(id == 2){ $('topic_cont').style.display='none'; $('link_cont').style.display='block'; $('quick_link').className='select'; $('feat_topic').className=''; } } function chkContact(){ if($('chkAll').checked){ for(i=1;i<=$('sel_count').value;i++) $('friend_'+i).checked=true; } else{ for(i=1;i<=$('sel_count').value;i++) $('friend_'+i).checked=false; } } function selBlog(id){ if($('owner').value ==''){ alert('Please Select A Blog Type'); return; } $('blog_id').value=id; if($('owner').value =='admin'){ $('type').value='Admin Blog'; } else if($('owner').value =='user'){ $('type').value='User Blog'; } } function selLink(id,title){ $('link_type').value=$('type').value; $('type_id').value=id; $('title').value=title; } function stickyTopic(){ Dialog.confirm('Do you really want to make this topic sticky?', {top: 150, width:250, className: "alphacube", okLabel: "Yes", cancelLabel:"No", onOk:function(win){ document.sticky.submit(); Windows.focusedWindow.close(); } }); } function lockTopic(){ Dialog.confirm('Do you really want to lock this topic?', {top: 150, width:250, className: "alphacube", okLabel: "Yes", cancelLabel:"No", onOk:function(win){ document.lock.submit(); Windows.focusedWindow.close(); } }); } function unstickyTopic(){ Dialog.confirm('Do you really want to make this topic unsticky?', {top: 150, width:250, className: "alphacube", okLabel: "Yes", cancelLabel:"No", onOk:function(win){ document.unsticky.submit(); Windows.focusedWindow.close(); } }); } function unlockTopic(){ Dialog.confirm('Do you really want to unlock this topic?', {top: 150, width:250, className: "alphacube", okLabel: "Yes", cancelLabel:"No", onOk:function(win){ document.unlock.submit(); Windows.focusedWindow.close(); } }); } function checkMove(){ if($('move_board').value==''){ //alert('Please Enter a tag name'); Dialog.alert("Please Select a board to move the topic", {top: 150, width:250, className: "alphacube"}); return false; } return true; } function topicLength(e){ var isIE = (window.event) ? 1 : 0; val=$('poll_content').value ; if (isIE) { if (val.length > 50 ) { e.returnValue = false; } } else { if (val.length > 50 ) { e.preventDefault(); } } } function showSignIn(){ //var winH=$('wrap').offsetHeight+$('ftr').offsetHeight; var winH= 300; //$('wrap').offsetHeight+$('').offsetHeight; var winW=GetWinWidth(); var left=(winW/2)-151; $('project_layer').setStyle({height:winH+'px'}); $('project_inner').setStyle({left:left+'px'}); new Effect.Appear('project_layer',{ from: 0.0, to: 0.7 }); new Effect.Appear('project_inner'); $('popupsignup').hide(); $('popupsignin').show(); } function showSignUp(){ //var winH=$('wrap').offsetHeight+$('ftr').offsetHeight; var winH= 400;//$('wrap').offsetHeight+$('ftr').offsetHeight; var winW=GetWinWidth(); var left=(winW/2)-151; $('project_layer').setStyle({height:winH+'px'}); $('project_inner').setStyle({left:left+'px'}); new Effect.Appear('project_layer',{ from: 0.0, to: 0.7 }); new Effect.Appear('project_inner'); $('popupsignin').hide(); $('popupsignup').show(); } function closeSignPop(){ new Effect.Fade('project_inner'); new Effect.Fade('project_layer'); $('popupsignin').hide(); $('popupsignup').hide(); } function popSignIn(){ if($('pop_user').value=='' || $('pop_password').value==''){ $('signInErr').innerHTML='Please complete the required fields'; $('signInErr').show(); } else{ parms='username='+$('pop_user').value+'&password='+$('pop_password').value; new Ajax.Request('/users/poplogin/', {method: 'post', parameters: parms, onSuccess: function(re) { if(re.responseText=='invalid'){ $('signInErr').innerHTML='invalid Username or password.'; $('signInErr').show(); return false; } else if(re.responseText=='success'){ window.location.reload(); return false; } } }); } } function pageSignIn(){ if($('pop_user').value=='' || $('pop_password').value==''){ $('signInErr').innerHTML='Please complete the required fields'; $('signInErr').show(); } else{ parms='username='+$('pop_user').value+'&password='+$('pop_password').value; new Ajax.Request('/users/signuppagelogin/', {method: 'post', parameters: parms, onSuccess: function(re) { if(re.responseText=='invalid'){ $('signInErr').innerHTML='invalid Username or password.'; $('signInErr').show(); return false; } else if(re.responseText=='success'){ //alert('hi'); //window.location.reload(); window.location ="http://www.noobfeed.com/" return false; } } }); } } function pageSignUp(){ if($('su_email').value=='' || $('su_username').value=='' || $('su_password').value=='' || $('su_conf_password').value=='' || $('su_month').value=='' || $('su_year').value=='' || $('su_day').value=='' || !($('su_terms_service').checked)){ $('signUpErr').innerHTML='Please complete the required fields'; $('signUpErr').show(); return; } p=emailCheck('su_email') if(!(p==true)){ $('signUpErr').innerHTML=p; $('signUpErr').show(); return; } if($('su_password').value != $('su_conf_password').value){ $('signUpErr').innerHTML='Please Retype Same Password'; $('signUpErr').show(); return; } if($('su_gender_1').checked) gender=$('su_gender_1').value; else if($('su_gender_2').checked) gender=$('su_gender_2').value; else if($('su_gender_3').checked) gender=$('su_gender_3').value; parms='email='+$('su_email').value+'&username='+$('su_username').value+'&password='+$('su_conf_password').value+'&month='+$('su_month').value+'&year='+$('su_year').value+'&day='+$('su_day').value+'&gender='+gender; new Ajax.Request('/users/popsignup/', {method: 'post', parameters: parms, onSuccess: function(re) { if(re.responseText==''){ $('signUpErr').hide(); $('signUpSuc').innerHTML="Your account has been created. Please wait for the activation"; $('signUpSuc').show(); $('su_email').value=''; $('su_username').value=''; $('su_password').value=''; $('su_conf_password').value=''; $('su_month').value=''; $('su_year').value=''; $('su_day').value=''; $('su_terms_service').checked=false; $('su_gender_1').checked=false; $('su_gender_2').checked=false; $('su_gender_3').checked=false; return false; } else{ $('signUpSuc').hide(); $('signUpErr').innerHTML=re.responseText; $('signUpErr').show(); return false; } } }); } function popSignUp(){ if($('su_email').value=='' || $('su_username').value=='' || $('su_password').value=='' || $('su_conf_password').value=='' || $('su_month').value=='' || $('su_year').value=='' || $('su_day').value=='' || !($('su_terms_service').checked)){ $('signUpErr').innerHTML='Please complete the required fields'; $('signUpErr').show(); return; } p=emailCheck('su_email') if(!(p==true)){ $('signUpErr').innerHTML=p; $('signUpErr').show(); return; } if($('su_password').value != $('su_conf_password').value){ $('signUpErr').innerHTML='Please Retype Same Password'; $('signUpErr').show(); return; } if($('su_gender_1').checked) gender=$('su_gender_1').value; else if($('su_gender_2').checked) gender=$('su_gender_2').value; else if($('su_gender_3').checked) gender=$('su_gender_3').value; parms='email='+$('su_email').value+'&username='+$('su_username').value+'&password='+$('su_conf_password').value+'&month='+$('su_month').value+'&year='+$('su_year').value+'&day='+$('su_day').value+'&gender='+gender; new Ajax.Request('/users/popsignup/', {method: 'post', parameters: parms, onSuccess: function(re) { if(re.responseText==''){ $('signUpErr').hide(); $('signUpSuc').innerHTML="Your account has been created. Please wait for the activation"; $('signUpSuc').show(); $('su_email').value=''; $('su_username').value=''; $('su_password').value=''; $('su_conf_password').value=''; $('su_month').value=''; $('su_year').value=''; $('su_day').value=''; $('su_terms_service').checked=false; $('su_gender_1').checked=false; $('su_gender_2').checked=false; $('su_gender_3').checked=false; return false; } else{ $('signUpSuc').hide(); $('signUpErr').innerHTML=re.responseText; $('signUpErr').show(); return false; } } }); } function GetWinWidth() { var x = 0; if (self.innerHeight) { x = self.innerWidth; } else if (document.documentElement && document.documentElement.clientHeight) { x = document.documentElement.clientWidth; } else if (document.body) { x = document.body.clientWidth; } return x; }