function init() { designSetup(); } window.onresize=function() { //designSetup(); } function designSetup() { document.getElementById('footer').style.display='block'; var ht_1=document.getElementById('header').clientHeight; var ht_2=document.getElementById('home_body').clientHeight; var ht_3=document.getElementById('footer').clientHeight; var ttl_h=(ht_1+ht_2+ht_3); if(myHeight>ttl_h) document.getElementById('extra_spacing').style.height=(myHeight-ttl_h)+'px'; } function submitUserLogin(url,loadtoid) { loader_html='checking Login'; olo.$(loadtoid).innerHTML=loader_html; olo.sendAndLoad(base_url+"/oloka/olo/"+pageName+".php",params,postLoadComplete,loadtoid,'POST'); return false; } //O0H1M2#N0O1M2O3H4#S0H1I2B3A4Y5 //PROGRAMMER : PRAN KRISHNA PAUL //DATE : DECEMBER, 26, 2010 //FRAMEWORK : oloka //URL : www.oloka.org //COPYRIGHT : www.oloka.org var oloka =function() {//class start this.version ='OLOKA-01'; this.pageWidth=getSize('W'); this.pageHeight=getSize('H'); function $(iid) { return document.getElementById(iid); }this.$=$; this.postAndLoad=function postAndLoad(loadtoid,pageName,params,loader_html) { if(isNaN(loader_html))loader_html='Loading...'; $(loadtoid).innerHTML=loader_html; sendAndLoad(base_url+"/oloka/olo/"+pageName+".php",params,postLoadComplete,loadtoid,'POST'); } function postLoadComplete(data,loadtoid) { if(loadtoid!='') { try {$(loadtoid).innerHTML=data;} catch(e) {alert('"'+ loadtoid + '" not found in this page!');} } } //Ajax function for submit data by POST or GET method function sendAndLoad(php_page_url,params,rtnFunc,loadtoid,method) { var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { rtnFunc(xmlHttp.responseText,loadtoid); } } //alert(method); //if(isNaN(method) || method=='')method='POST'; var rndn=Math.random(); params = params+'&rnd='+rndn; if(method=='POST') { xmlHttp.open(method,php_page_url,true); xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlHttp.setRequestHeader("Content-length", params.length); xmlHttp.setRequestHeader("Connection", "close"); xmlHttp.send(params); } else { xmlHttp.open(method,php_page_url+'?'+params,true); xmlHttp.send(null); } } this.sendAndLoad=sendAndLoad; function getSize(type) { 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; } if(type=='W')return myWidth; else return myHeight; } //======================================================Absolute Positioning of div======================> function setDivToPosition(div_id,allign_x,allign_y,xfactor,yfactor) { var mydiv=$(div_id); mydiv.style.display='block'; mydiv.style.position='absolute'; divWidth=mydiv.offsetWidth; divHeight=mydiv.offsetHeight; if(allign_x=='left')mydiv.style.left=xfactor+'px'; else if(allign_x=='right')mydiv.style.left=(myWidth-xfactor-divWidth)+'px'; else if(allign_x=='middle')mydiv.style.left=document.documentElement.scrollLeft+((myWidth-divWidth)/2+xfactor)+'px'; if(allign_y=='top')mydiv.style.top=yfactor+'px'; else if(allign_y=='bottom')mydiv.style.top=(myHeight-yfactor-divHeight)+'px'; else if(allign_y=='middle')mydiv.style.top=document.documentElement.scrollTop+((myHeight-divHeight)/2-yfactor)+'px'; //alert((myHeight-divHeight)/2-yfactor); } this.setDivToPosition=setDivToPosition; //======================================================Absolute Positioning of div======================| //======================================================Fadein Fadeout Div================================> function fadeOut(thisId,speed,fromOpacity) { var obj = $(thisId); //obj.style.zoom = 1; //needed for IE speed = speed/20; var i = fromOpacity; var intervalId = setInterval(function() { if(i>=0) { obj.style.opacity = (i / 100); obj.style.MozOpacity = (i / 100); obj.styleKhtmlOpacity = (i / 100); obj.style.filter = "alpha(opacity=" + i + ")"; //$('info').innerHTML=i; i -= 5; } else { setTimeout(function() {obj.style.display = "none";}, speed); clearInterval(intervalId); return false; } }, speed); } function fadeIn(thisId,speed,maxOpacity) { var obj = $(thisId); obj.style.display = "block"; //obj.style.zoom = 1; //needed for IE obj.style.opacity = 0; obj.style.filter = "alpha(opacity = 0)"; speed = speed/20; var i = 0; var intervalId = setInterval(function() { if(i <= maxOpacity) { obj.style.opacity = (i / 100); obj.style.MozOpacity = (i / 100); obj.styleKhtmlOpacity = (i / 100); obj.style.filter = "alpha(opacity=" + i + ")"; //$('info').innerHTML=i; i += 5; } else { //setTimeout(function() {obj.style.display = "block";}, speed); clearInterval(intervalId); return false; } }, speed); } //======================================================Fadein Fadeout Div================================| this.cover=document.createElement('div'); this.showCover=function showCover() { this.cover.id='bkcover'; this.cover.innerHTML=''; this.cover.style.width=getSize('W')+'px'; this.cover.style.height=getSize('H')+'px'; this.cover.style.position='absolute'; this.cover.style.top=document.documentElement.scrollTop+'px'; this.cover.style.left=document.documentElement.scrollLeft+'px'; this.cover.style.backgroundColor='#000000'; this.cover.style.opacity='0.50'; this.cover.style.filter='alpha(opacity: 50)'; document.body.style.overflow='hidden'; fadeIn('bkcover',500,50); } function hideCover() { document.body.style.overflow='auto'; fadeOut('bkcover',500,50); } this.hideCover = hideCover; function expandDiv(divId,fromSz,toSz,expBy,speed) { var obj = $(divId); obj.style.display = "block"; //obj.style.height=fromSz+'px'; var i = 0; var inc=1; exp_act='expand'; switch(expBy) { case 'width': if(parseInt(obj.style.width)==toSz)exp_act='declose'; else obj.style.width=fromSz+'px'; break; default: if(parseInt(obj.style.height)==toSz)exp_act='declose'; else obj.style.height=fromSz+'px'; break; } var intervalId = setInterval(function() { if(expBy=='width') { switch(exp_act) { case 'expand': if(parseInt(obj.style.width)fromSz) { i += inc; if(i>fromSz)i=fromSz; obj.style.width= (parseInt(obj.style.width)-i)+'px'; } else { clearInterval(intervalId); obj.style.width=fromSz+'px'; return false; } break; } } else { switch(exp_act) { case 'expand': if(parseInt(obj.style.height)<=toSz) { i += inc; obj.style.height= (parseInt(obj.style.height)+i)+'px'; } else { clearInterval(intervalId); obj.style.height=toSz+'px'; return false; } break; case 'declose': if(parseInt(obj.style.height)>=fromSz) { i += inc; if(i>fromSz)i=fromSz; obj.style.height= (parseInt(obj.style.height)-i)+'px'; } else { obj.style.height=fromSz+'px'; clearInterval(intervalId); return false; } break; } } }, speed); } function changeLanguage(langid,url) { createLoader('rtnbox','Changing Language') params = 'lang='+langid; sendAndLoad(base_url+"/oloka/olo/change_language.php",params,afterChangeLanguage,url,'GET'); } this.changeLanguage=changeLanguage; function afterChangeLanguage(data,url) { if(data=='Y') location=url; else alert('Language not changed'); } function createLoader(container,str) { currLdr=document.createElement('div'); currLdr.id='pageloader'; currLdr.style.position='absolute'; currLdr.align='center'; currLdr.style.fontFamily='Verdana, Arial, Helvetica, sans-serif'; currLdr.style.fontSize='11px'; currLdr.style.fontWeight='bold'; currLdr.style.color='#333333'; currLdr.style.zIndex='999999'; currLdr.style.border='1px solid #999999'; currLdr.style.backgroundColor='#FFFFCC'; currLdr.style.padding='5px'; currLdr.style.opacity='0.80'; currLdr.style.filter='alpha(opacity: 80)'; document.getElementById(container).style.display='block'; document.getElementById(container).appendChild(currLdr); currLdr.innerHTML=''+str+''; currLdr.style.width=currLdr.offsetWidth+'px'; currLdr.innerHTML=str; /*currLdr.style.display="none";*/ setDivToPosition('pageloader','middle','top',0,0); showLoader(); }this.createLoader=createLoader; function showLoader() { str=currLdr.innerHTML; strlen=str.length; view_str=''; curpos=0; var ldrintervalId = setInterval(function() { curpos++; if(curpos>=strlen){curpos=0;view_str='';} pre_str=str.slice(0,curpos); post_str=str.slice(curpos+1,strlen); view_str='

'+pre_str+''+str.charAt(curpos)+''+post_str+'

PLEASE BE PATIENT WHILE LOADING

'; currLdr.innerHTML=view_str; },100); } //functions for view_edit_update_data==============================================> this.deleteRow=function deleteRow(table,rowid, field, condition_sql, limit_start, limit_end, order_by, field_editable, me_style, inner_style, parent_div_id, msg, isactive) { if(confirm('Sure Delete ?')) { var tbl_arr = table.split('|'); $(tbl_arr[0]+'_msg').style.backgroundColor='#FFCC22'; $(tbl_arr[0]+'_msg').innerHTML='Deleting...'; var params_arr = new Array(); params_arr[0]=table; params_arr[1]=field; params_arr[2]=condition_sql; params_arr[3]=limit_start; params_arr[4]=limit_end; params_arr[5]=order_by; params_arr[6]=field_editable; params_arr[7]=me_style; params_arr[8]=inner_style; params_arr[9]=parent_div_id; params_arr[10]='One row has deleted'; params_arr[11]=isactive; var params='table_name='+table+'&row_id='+rowid; sendAndLoad(base_url+"/oloka/olo/veud_row_delete.php",params,onDeleteAllRow,params_arr,'GET'); } } this.editRow = function editRow(rowid, divid, lang, table, field, condition_sql, limit_start, limit_end, order_by, field_editable, me_style, inner_style, parent_div_id, msg, isactive) { $(divid).innerHTML='
Oppening...
'; var params_arr = new Array(); params_arr[0]=table; params_arr[1]=field; params_arr[2]=condition_sql; params_arr[3]=limit_start; params_arr[4]=limit_end; params_arr[5]=order_by; params_arr[6]=field_editable; params_arr[7]=me_style; params_arr[8]=inner_style; params_arr[9]=parent_div_id; params_arr[10]=''; params_arr[11]=isactive; var params = 'table='+params_arr[0]+'&field='+params_arr[1]+'&condition_sql='+params_arr[2]+'&limit_start='+params_arr[3]+'&limit_end='+params_arr[4]+'&order_by='+params_arr[5]+'&field_editable='+params_arr[6]+'&me_style='+params_arr[7]+'&inner_style='+params_arr[8]+'&parent_div_id='+params_arr[9]+'&message='+params_arr[10]+'&is_active='+params_arr[11]+'&row_id='+rowid+'&language='+lang; sendAndLoad(base_url+"/oloka/olo/veud_edit_row.php",params,openEditRow,divid,'POST'); this.showCover(); $(divid).style.zIndex=999999; this.setDivToPosition(divid,'middle','middle',0,0); } function openEditRow(data,loadtoid) { if(loadtoid!='') { try { $(loadtoid).innerHTML=data; } catch(e) { alert('"'+ loadtoid + '" not found in this page!'); } setDivToPosition(loadtoid,'middle','middle',0,0); } } function closeEditRow(divid) { $(divid).innerHTML=' '; hideCover(); } this.closeEditRow=closeEditRow; this.checkAllRow = function checkAllEditRow(table,len,cbox) { for(ci=0;ciTry with valid email address"; } } function ForgetPassword() { url=''; olo.$('fperror').innerHTML='Authenticating...'; params='useremail='+olo.$('fuseremail').value+'&oloAuth='+olo.$('f_oloAuth').value; olo.sendAndLoad(base_url+"/site/user/php/olo/sendpassword.php",params,onForgetPassword,url,'POST'); return false; } function onForgetPassword(data,curr_url) { olo.$('fperror').innerHTML=data; if(curr_url=='')curr_url=location; if(data=='TIMEOUT') { olo.createLoader('rtnbox','Reloading Page ...'); curr_url=location; location=curr_url; } else if(data=='success') { olo.$('fpbox').innerHTML="Please check your Email
We have send your Password.


If your email address invalid you won't get your password.
Try with valid email address"; } } function saveAccountChanges() { olo.$('page_title').innerHTML='Authenticating...'; if(olo.$('user_password').value==olo.$('conf_password').value) { if(olo.$('username')!='') { params='username='+olo.$('user_name').value+'&userpass='+olo.$('user_password').value+'&oloAuth='+olo.$('oloAuth').value; olo.sendAndLoad(base_url+"/site/user/php/olo/update_account.php",params,onSaveAccountChanges,'','POST'); } else olo.$('page_title').innerHTML='[!] Your name is blank.'; } else olo.$('page_title').innerHTML='[!] Your confirm password not matched.'; return false; } function onSaveAccountChanges(data,curr_url) { olo.$('page_title').innerHTML=data; if(curr_url=='')curr_url=location; if(data=='TIMEOUT') { olo.createLoader('rtnbox','Reloading Page ...'); curr_url=location; location=curr_url; } else if(data=='success') { olo.$('page_title').innerHTML='√ Your account has updated'; } } function showSptf() { window.scroll(0,1050); olo.$('femail').value=''; olo.$('sptf').style.display='block'; olo.$('sptf_info').style.display='none'; } function hideSptf() { olo.$('sptf').style.display='none'; olo.$('sptf_info').style.display='none'; } function sendPhotoToFriend(photoid) { olo.$('sptf').style.display='none'; olo.$('sptf_info').style.display='block'; olo.$('sptf_info').innerHTML='Checking email...'; var params='femail='+olo.$('femail').value+'&photo_id='+photoid+'&oloAuth='+olo.$('oloAuth').value; olo.sendAndLoad(base_url+"/site/user/php/olo/sendphototofriend.php",params,onSendPhotoToFriend,'N','GET'); return false; } function onSendPhotoToFriend(data,mdiv) { olo.$('sptf').style.display='none'; if(data=='TIMEOUT') { olo.$('sptf_info').innerHTML='Time out! Try again ...'; olo.createLoader('rtnbox','Reloading Page ...'); curr_url=location; location=curr_url; } if(data=='success') { olo.$('sptf_info').style.display='block'; olo.$('sptf_info').innerHTML='Your photo has sent '+'
'; } else olo.$('sptf_info').innerHTML=data+'
'; } function quickContactForm() { frm_err=0; frm_err+=validate('qc_name','empty'); frm_err+=validate('qc_email','empty'); frm_err+=validate('qc_email','email', 'Email not valid'); frm_err+=validate('qc_message','empty'); if(document.getElementById('qc_name').value=='Your Name') frm_err+=customvalidate('qc_name_err','Please give your valid name'); if(document.getElementById('qc_email').value=='Your Email') frm_err+=customvalidate('qc_email_err','Please give your valid Email'); if(document.getElementById('qc_message').value=='Your Message') frm_err+=customvalidate('qc_message_err','Please give your valid message'); if(frm_err==0) return true; else return false; } function checkFocus(obj_div,msg) { var obj=document.getElementById(obj_div); obj.onfocus=function(){if(obj.value==msg)obj.value='';} //obj.onfocusout=function(){if(obj.value=='')obj.value=msg;} obj.onblur=function(){if(obj.value=='')obj.value=msg;} obj.onchange=function(){if(obj.value=='')obj.value=msg;} } function validate(objectId,type,errMsg) { var err=0; obj=document.getElementById(objectId); objerr=document.getElementById(objectId+'_err'); noerr='Your Input is Correct'; switch(type) { case 'email': if(!isEmail(obj.value)){err=1;messageBubble(objerr,errMsg);} else {objerr.innerHTML='';} break; case 'alphanum': if(!isAlphaNumeric(obj.value)){err=1;messageBubble(objerr,errMsg);} else {objerr.innerHTML='';} break; case 'confirm': objc=document.getElementById(objectId+'_conf'); if(!isConfirm(obj.value,objc.value)){err=1;messageBubble(objerr,errMsg);} else {objerr.innerHTML='';} break; case 'num': if(!isNumeric(obj.value)){err=1;messageBubble(objerr,errMsg);} else {objerr.innerHTML='';} break; case 'empty': if(!isEmpty(obj.value)){err=1;messageBubble(objerr,errMsg);} else {objerr.innerHTML='';} break; case 'onlyalpha': if(!isOnlyAlpha(obj.value)){err=1;messageBubble(objerr,errMsg);} else {objerr.innerHTML='';} break; case 'boxalias': if(!isBoxAlias(obj.value)){err=1;messageBubble(objerr,errMsg);} else {objerr.innerHTML='';} break; case 'boxlength': if(obj.value.length<3 || obj.value.length>30){err=1;messageBubble(objerr,errMsg);} else {objerr.innerHTML='';} break; } return err; } function isEmail(email) { if(email.length <= 0) { return false; } var splitted = email.match("^(.+)@(.+)$"); if(splitted == null) return false; if(splitted[1] != null ) { var regexp_user=/^\"?[\w-_\.]*\"?$/; if(splitted[1].match(regexp_user) == null) return false; } if(splitted[2] != null) { var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/; if(splitted[2].match(regexp_domain) == null) { var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/; if(splitted[2].match(regexp_ip) == null) return false; }// if return true; } return false; } function isOnlyAlpha(val) { if(val=='') return false; if(val.search("[^A-Za-z]")==-1) return true; else return false; } function isAlphaNumeric(val) { if(val=='') return false; if(val.search("[^A-Za-z0-9\-_ ]")==-1) return true; else return false; } function isBoxAlias(val) { if(val=='') return false; if(val.search("[^A-Za-z0-9\-.]")==-1) return true; else return false; } function isEmpty(val) { if(val=='') return false; else return true; } function isNumeric(val) { if(val=='') return false; if(val.search("[^0-9\.]")==-1) return true; else return false; } function isConfirm(val,val1) { if(val==val1) return true; else return false; } function customvalidate(objectId,msg) { cuserrnok=msg; objerr=document.getElementById(objectId); messageBubble(objerr,cuserrnok); return 1; } function customvalidateok(objectId,msg) { cuserrok=msg; objerr=document.getElementById(objectId); objerr.innerHTML=''; return 0; } function messageBubble(obj,msg) { var bubble='
'+msg+'
 
'; //alert(bubble); obj.innerHTML=bubble; //alert(obj.innerHTML); }