function appendTextToElement(elementName, text){ document.getElementById(elementName).innerHTML += text; document.getElementById(elementName).style.display = ""; } function checkEmail(str) { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; if(reg.test(str) == false) { return false; } return true; var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false } 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 } function confirmSubmit(text) { var agree=confirm(text); if(agree) return true; else return false ; } function expand(thistag, img, hideText, showText, newSrcUrl) { styleObj=document.getElementById(thistag).style; if (styleObj.display=='none') { styleObj.display=''; //img.innerHTML = hideText; img.src = newSrcUrl+"/collapse.gif"; } else { styleObj.display='none'; //img.innerHTML = showText; img.src = newSrcUrl+"/expand.gif"; } } function iframe(name,url,params,width,height) { // Remove old dialog $('#iframe').dialog('close'); $('#iframe').remove(); // Create iframe var iframe = document.createElement("iframe"); iframe.setAttribute('id',name); var $dialog = $('
').html('') .dialog({ autoOpen: false, modal: true, height: width, width: height, title: '', closeOnEscape: true }); $dialog.dialog('open'); } function iframeWithPost(name,url,params,width,height) { // Remove old dialog if ($('#iframe') != null) { $('#iframe').dialog('close'); $('#iframe').remove(); } // Create iframe var iframe = document.createElement("iframe"); iframe.setAttribute('id',name); iframe.setAttribute('name',name); iframe.setAttribute('frameborder','0'); iframe.setAttribute('width','100%'); iframe.setAttribute('height','100%'); var $dialog = $('').html(iframe) .dialog({ autoOpen: false, modal: true, height: width, width: height, title: '', closeOnEscape: true, open: function(event, ui) { form = document.createElement("form"); $(form).attr({"action":url,"method":"POST","target":name}); for (var i in params) { if (params.hasOwnProperty(i)) { var input = document.createElement('input'); input.type = 'hidden'; input.name = i; input.value = params[i]; form.appendChild(input); } } $('#iframe').append(form); $(form).submit() } }); $dialog.dialog('open'); //$(form).submit(); } function imagePreview(picture,value) { if(value!="") picture.src = "file://localhost/" + value; } function imageResizeWidth(img,maxWidth) { if(img.width>maxWidth) img.width=maxWidth; img.height=maxWidth*(img.height/img.width); } function imageResizeHeight(img,maxHeight) { if(img.height>maxHeight) img.height=maxHeight; img.width=maxHeight*(img.width/img.height); } function popup(mypage,myname,w,h,features) { if(screen.width){ var winl = (screen.width-w)/2; var wint = (screen.height-h)/2; } else { winl = 0; wint =0; } if(winl<0) winl = 0; if(wint<0) wint = 0; var settings = 'height=' + h + ','; settings += 'width=' + w + ','; settings += 'top=' + wint + ','; settings += 'left=' + winl + ','; settings += features; win = window.open(mypage,myname,settings); win.window.focus(); if(!win.opener) win.opener = self; } function popupWithPost(mypage,myname,w,h,features,params) { if(screen.width){ var winl = (screen.width-w)/2; var wint = (screen.height-h)/2; } else { winl = 0; wint =0; } if(winl<0) winl = 0; if(wint<0) wint = 0; var settings = 'height=' + h + ','; settings += 'width=' + w + ','; settings += 'top=' + wint + ','; settings += 'left=' + winl + ','; settings += features; //note I am using a post.htm page since I did not want to make double request to the page //it might have some Page_Load call which might screw things up. //window.open("post.htm", name, windowoption); win = window.open("index.htm",myname,settings); win.window.focus(); if(!win.opener) win.opener = self; var form = document.createElement("form"); form.setAttribute("method", "post"); form.setAttribute("action", mypage); form.setAttribute("target", myname); for (var i in params) { if (params.hasOwnProperty(i)) { var input = document.createElement('input'); input.type = 'hidden'; input.name = i; input.value = params[i]; form.appendChild(input); } } document.body.appendChild(form); form.submit(); document.body.removeChild(form); } function protectMail(name, domain) { window.location = 'mailto:' + name + '@' + domain; } function replaceText(thistag, img, hideText, showText, newSrcUrl) { object=document.getElementById(thistag); object.innerHTML = hideText; } function selectAll(form, checkAllBox, select) { for(var i=0;i