/* programmed by Jaro Nemcok & Neeki Patel */ function setCol( item, color, bgcolor ) { item.style.color = color; item.firstChild.style.color = color; item.style.backgroundColor = bgcolor; } function shft( txt1, txt2 ) { if (navigator.appName == 'Microsoft Internet Explorer') if (event.shiftKey==true) return txt1; return txt2; } function gotoPage(link,pge,pp,limit) { _pge = prompt('E N T E R N E W P A G E N U M B E R :',pge); if (_pge=='undefined') return; if (_pge==pge) return; if (_pge<=0) return; if (( limit > 0 ) && ( Number(_pge) > Number(limit) )) _pge = limit; window.location = link + '&index=' + pp*(_pge-1); return true; } function swipeCard(t) { _pge = prompt('E N T E R N E W C A R D N U M B E R :',''); if (_pge=='undefined') return false; if (_pge=='') return false; if (_pge=='null') return false; t.value = _pge; return true; } function transformCardId(t) { a = t.innerHTML; c = a.substr(0,100); t.innerHTML = c; return true; } function renameFile(link,oldName) { newName = prompt('E N T E R N E W N A M E :',oldName); if (newName=='undefined') return; if (newName==oldName) return; if (newName=='') return; if (newName=='null') return; window.location = link + '&newName=' + newName; return true; } function trim(text) { while (text.value.charAt(0)==' ') { text.value = text.value.substr(1); } while (text.value.charAt(text.value.length-1)==' ') { text.value = text.value.substr(0,text.value.length-1); } return text; } function validate(myField,rexp,name) { if (rexp==0) return true; myField = trim(myField); if ((rexp.test(myField.value))||(myField.value=="")) { return true; } else { alert('Invalid entry for ' + name + '.'); return false; } } function require(myField,name) { //if (myField.type=="textarea")// && myField.innerHTML=="") //{ // alert(name + ' is a required field'); // return false; //} if (myField.value != "" && myField.value != "0000-00-00") { return true; } else { alert(name + ' is a required field'); return false; } } function chk_psw(myField,myField2,name) { if ( myField.value == "" && myField2.value == "" ) { alert(name + ' is required'); return false; } if ( myField.value == "" ) { alert(name + ' must be retyped twice'); return false; } if ( myField2.value == "" ) { alert(name + ' must be retyped twice'); return false; } if (myField.value != myField2.value) { alert(name + ' must be retyped twice with the same value'); return false; } return true; } function chk_radio(myField,name) { if ( myField[0].checked || myField[1].checked ) { return true; } alert(name + ' : select Yes or No'); return false; } function cancelation() { if (!document.forms.agree.agree.checked) { alert('Please carefuly read the cancelation policy\nbefore proceed the cancellation/rescheduling action'); return false; } else { return true; } } function takeZeroOff(nmb) { for (i = 0; i < nmb.length; i++) { if (nmb.substr(0,1) == "0") { nmb = nmb.substr(1,nmb.length-1); } } return nmb } function check_signout() { a = document.getElementsByTagName("body"); a[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)"; if (confirm('Are you sure you want to sign out?')) { return true; } else { a[0].style.filter = ""; return false; } } function check_fields(form) { var alphabeth; var digits; var alrtmsg; var err; var nerr; var nat; var maxlen; alphabeth= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; digits = "0123456789"; alrtmsg = ""; err = 0; nerr = 0; nat = 0; maxlen = 1000; // password if((form.password.value==form.password2.value) && (form.password.value!="none")) { if(form.password.value=="") { alrtmsg=alrtmsg+"Missing password input.\n"; err++; } if ((form.password.value!="") && (form.password.value.length < 6)) { alrtmsg=alrtmsg+"Password length must be at least 6 characters.\n"; err++; form.password.value=""; form.password2.value=""; } if (form.password.value.length > 20) { alrtmsg=alrtmsg+"Password length must be at most 20 characters.\n"; err++; form.password.value=""; form.password2.value=""; } for (i = 0; i < form.password.value.length; i++) { if (digits.indexOf(form.password.value.substr(i,1)) == -1 && (alphabeth.indexOf(form.password.value.substr(i,1).toUpperCase()) == -1)) { nerr++; } } if (nerr>0) { alrtmsg=alrtmsg+"Some invalid character(s) in password.\n"; err++; form.password.value=""; form.password2.value=""; } } if(form.password.value!=form.password2.value) { alrtmsg=alrtmsg+"Incorrect password input.\n\tYou should re-enter the same password twice.\n"; err++; form.password.value=""; form.password2.value=""; } // final alert if(alrtmsg.length>maxlen) alrtmsg = alrtmsg.substr(0,maxlen-21)+"...\n\t...and more..."; if(err>0) { if (err==1) { alert("There is error in entered data\n\n"+alrtmsg); return false; } if (err>1) { alert("There are errors in entered data\n\n"+alrtmsg); return false; } } return true; } function check_terms(form) { // agree with terms if ((form.terms_check.value!="none") && !form.terms_check.checked) { alert("Please be sure to agree with 'Terms & Conditions'.\n"); return false; } return true; } var popUpDate=0; function popUpDateWindow(URLStr, left, top) { if(popUpDate) { if(!popUpDate.closed) popUpDate.close(); } popUpDate = window.open(URLStr, 'popUpDate','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=147,height=215,left='+left+', top='+top+',screenX='+left+',screenY='+top+''); } var popUpWin=0; function popUpWindow(URLStr, left, top, width, height) { if(popUpWin) { if(!popUpWin.closed) popUpWin.close(); } popUpWin = window.open(URLStr, 'popUpWin','toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+''); } function getTimeFromTimestamp( timestamp ) { if ( timestamp == '') { return 'N/A'; } time = timestamp.substr(0,4) + '/' + timestamp.substr(4,2) + '/' + timestamp.substr(6,2); t = timestamp.substr(8,2); pm = 'AM'; if ( t > 12 ) { t = t - 12; pm = 'PM'; } if ( t == 12 ) { pm = 'PM'; } if ( t == 0 ) { t = 12; pm = 'AM'; } time = time + ' ' + t + ':' + timestamp.substr(10,2) + pm; return time; } function get_date( my_date, type ) { digits = "0123456789"; if ( my_date == '') { return 'N/A'; } error = ''; if (digits.indexOf(my_date.substr(1,1)) == -1) { my_date = '0' + my_date; } if (digits.indexOf(my_date.substr(4,1)) == -1) { my_date = my_date.substr(0,3) + '0' + my_date.substr(3,10); } if (( my_date.length == 8 ) && (digits.indexOf(my_date.substr(2,1)) != -1)) { my_month= my_date.substr(0,2); my_day = my_date.substr(2,2); my_year = my_date.substr(4,4); } else { if (( my_date.length == 6 ) && (digits.indexOf(my_date.substr(2,1)) != -1)) { my_month= my_date.substr(0,2); my_day = my_date.substr(2,2); my_year = my_date.substr(4,2); } else { my_month= my_date.substr(0,2); my_day = my_date.substr(3,2); my_year = my_date.substr(6,6); } } if ((my_month>12) && (my_day<=12)) { p_month = my_month; my_month = my_day; my_day = p_month; } if (!(my_month>=1) || !(my_month<=12)) { error = error + 'wrong month\n'; if ( type == 1 ) if ( my_month > 12 ) { my_month = '12'; } else { my_month = '01'; } } if (!(my_day>=1) || !(my_day<=31)) { error = error + 'wrong day\n'; if ( type == 1 ) my_day = '01'; } if (my_year.length!=4) { if (my_year.length==1) { my_year = '0' + my_year; } if (my_year.length!=2) { error = error + 'wrong year'; } else { if (my_year<30) { my_year = '20' + my_year; } else { my_year = '19' + my_year; } } } else { year2 = my_year.substr(0,2); if (( year2 != '19' ) && ( year2 != '20' )) { error = error + 'year is out of century'; } } if (( error != '' ) && ( type == 1 )) { alert ( error ); return 'no value'; } if (type==1) return my_year + '-' + my_month + '-' + my_day; return my_month + '-' + my_day + '-' + my_year; } text_box = 0; function color_from_background( x ) { if ( x.toLowerCase() == 'black') return "#FFFFFF"; if ( x.toLowerCase() == 'blue') return "#FFFFFF"; if ( x.toLowerCase() == 'darkblue') return "#FFFFFF"; if ( x.toLowerCase() == 'darkred') return "#FFFFFF"; if ( x.toLowerCase() == 'darkgreen') return "#FFFFFF"; if ( x.toLowerCase() == 'purple') return "#FFFFFF"; r = x.substr(1, 2); g = x.substr(3, 2); b = x.substr(5, 2); r = hex_to_dec( r ); g = hex_to_dec( g ); b = hex_to_dec( b ); sum = 2*r + 3*g + b; if( sum < 400) return "#FFFFFF"; else return "#000000"; } function setColor( c ) { document.getElementById(text_box).value = c; document.getElementById(text_box).style.backgroundColor = c; document.getElementById(text_box).style.color = color_from_background(c); document.getElementById('color_picker').style.visibility = "hidden" } function Show( box ) { box.value = box.value; text_box = box; if (document.layers) getMouseLoc; //NS else if (document.all) getMouseLoc(); //IE document.getElementById('color_picker').style.left = mouseLocation.x document.getElementById('color_picker').style.top = mouseLocation.y document.getElementById('color_picker').style.visibility = "visible" } function Point(x,y) { this.x = x; this.y = y; } mouseLocation = new Point(-500,-500); function getMouseLoc(e) { if(!document.all) //NS { mouseLocation.x = e.pageX; mouseLocation.y = e.pageY; } else //IE { mouseLocation.x = event.x + document.body.scrollLeft; mouseLocation.y = event.y + document.body.scrollTop; } return true; } //NS init: if(document.layers) { document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = getMouseLoc; } // converts two digits hexa number to decadic form function hex_to_dec( num ) { first = num.substr(0,1); second = num.substr(1,1); switch(first) { case 'A': first = 10; break; case 'B': first = 11; break; case 'C': first = 12; break; case 'D': first = 13; break; case 'E': first = 14; break; case 'F': first = 15; break default: first = first *1; } switch(second) { case 'A': second = 10; break; case 'B': second = 11; break; case 'C': second = 12; break; case 'D': second = 13; break; case 'E': second = 14; break; case 'F': second = 15; break; default: second = second * 1; } return (first * 16) + second; } function backgroundcolor( c ) { x = c.value; c.style.color = color_from_background(x); c.style.backgroundColor = c.value } function visible_calc() { if (document.all) { if (document.all.calc.style.visibility=='visible') { document.all.calc.style.visibility='hidden'; } else { document.onmousedown = drags; document.onmouseup = new Function("dragapproved=false"); document.all.calc.style.visibility = 'visible'; if ((document.all.calc.style.left=='0px')&&(document.all.calc.style.top=='0px')) { getMouseLoc(); document.all.calc.style.left = mouseLocation.x - 180; document.all.calc.style.top = mouseLocation.y - 280; } } } else { if (document.getElementById['calc'].style.visibility=='visible') { document.getElementById['calc'].style.visibility='hidden'; } else { document.onmousedown = drags document.onmouseup = new Function("dragapproved=false") document.getElementById['calc'].style.visibility = 'visible'; if ((document.getElementById['calc'].style.left=='0px')&&(document.getElementById['calc'].style.top=='0px')) { getMouseLoc; document.getElementById['calc'].style.left = mouseLocation.x - 180; document.getElementById['calc'].style.top = mouseLocation.y - 280; } } } } function move(e) { var ns6 = document.getElementById&&!document.all if (dragapproved) { z.style.left = ns6 ? temp1+e.clientX-x : temp1+event.clientX-x; z.style.top = ns6 ? temp2+e.clientY-y : temp2+event.clientY-y; return false; } } function drags(e) { var ie = document.all var ns6 = document.getElementById&&!document.all if (!ie&&!ns6) return; var firedobj = ns6 ? e.target : event.srcElement; var topelement = ns6 ? "HTML" : "BODY"; while ( firedobj.tagName!=topelement && firedobj.className!="drag" ) { firedobj = ns6 ? firedobj.parentNode : firedobj.parentElement; } if (firedobj.className=="drag") { dragapproved = true; z = firedobj; temp1 = parseInt(z.style.left+0); temp2 = parseInt(z.style.top+0); x = ns6 ? e.clientX : event.clientX; y = ns6 ? e.clientY : event.clientY; document.onmousemove = move; return false; } }