0byt3m1n1
Path:
/
data
/
17
/
1
/
18
/
11
/
1670011
/
user
/
1801231
/
htdocs
/
tanningonline_com
/
js
/
[
Home
]
File: global.js
function new_window(url, name, attrib) { if (typeof(attrib) == "undefined") { attrib = "toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1"; } window.open(url, name, attrib); } function trim(stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""); } function emailCheck(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) // check if string contains @sign if (str.indexOf(at)==-1) { return false } // check if @sign not at beginning of string if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) { return false } // check if period not at beginning of string if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) { return false } if (str.indexOf(at,(lat+1))!=-1) { return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) { return false } if (str.indexOf(dot,(lat+2))==-1) { return false } if (str.indexOf(" ")!=-1) { return false } return true }// end function emailCheck new function($) { $.fn.setCursorPosition = function(pos) { if ($(this).get(0).setSelectionRange) { $(this).get(0).setSelectionRange(pos, pos); } else if ($(this).get(0).createTextRange) { var range = $(this).get(0).createTextRange(); range.collapse(true); range.moveEnd('character', pos); range.moveStart('character', pos); range.select(); } } }(jQuery); function clearText(obj){ if (obj.value == obj.title){ obj.value = '' } else if(obj.value == ''){ obj.value = obj.title; } } function opaqueText(form_id) { $(document).ready(function() { var myForm = document.getElementById(form_id); for (var i = 0; i < myForm.elements.length; i++) { if(myForm.elements[i].title != '') { $(myForm.elements[i]).bind('focus blur keypress', function (e) { if (e.type != 'keypress') { if (this.value == this.title && e.type == 'focus') { // Resets position of the input cursor $(this).css({'color' : '#cccccc'}); $(this).setCursorPosition(0); } else if(this.value == this.title || this.value == '' && e.type == 'blur') { $(this).css({'color' : '#000000'}); this.value = this.title; } else if(trim(this.value) == '') { $(this).css({'color' : '#000000'}); this.value = this.title; } } else { if (this.value != this.title) { $(this).css({'color' : '#000'}); } else { $(this).css({'color' : '#000'}); this.value = ''; } } }); }// end if }// end for loop });// end document ready }