function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != "function") {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
function isValidEmail(email, required) {
if (required==undefined) { // if not specified, assume it's optional
required=false;
}
if (email==null) {
if (required) {
return false;
}
return true;
}
if (email.length==0) {
if (required) {
return false;
}
return true;
}
if (! allValidChars(email)) { // check to make sure all characters are valid
return false;
}
if (email.indexOf("@") < 1 || email.indexOf("@") > eval(email.length - 5)) { // must contain @, and it must not be the first character
return false;
} else if (email.lastIndexOf(".") <= email.lastIndexOf("@")) { // last dot must be after the @
return false;
} else if (email.indexOf("@") != email.lastIndexOf("@")) { // must not contain two @'s
return false;
} else if (email.length-email.lastIndexOf(".") < 3) { // dot must have at least 2 characters behind it
return false;
}
return true;
}
function allValidChars(email) {
var parsed = true;
var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";
for (var i=0; i < email.length; i++) {
var letter = email.charAt(i).toLowerCase();
if (validchars.indexOf(letter) != -1)
continue;
parsed = false;
break;
}
return parsed;
}
function colorBorder(box,color){
if (box==null) return;
box.style.borderColor=color;
}
function checkForm(nform){
result = true;
vform = document.forms[nform];
if (nform.substr(0,11) == "frm_comment"){
if (!isValidEmail(vform.email.value,true)||vform.email.value==""){
colorBorder(vform.email, "red");
result = false;
} else {
colorBorder(vform.email, "gray");
}
if (vform.name.value==""){
colorBorder(vform.name, "red");
result = false;
} else {
colorBorder(vform.name, "gray");
}
if (vform.homepage.value!=""&&vform.homepage.value.indexOf(".")<2){
colorBorder(vform.homepage, "pink");
} else {
colorBorder(vform.homepage, "gray");
}
if (vform.comment.value==""){
colorBorder(vform.comment, "red");
result = false;
} else {
colorBorder(vform.comment, "gray");
}
}
return result;
}
function get_root(){
return "/";
}
var picWindow;
function iPop(u, w, h, d) {
var doc = "showpic";
if (/collection=/.test(u)){
w=910;
h=700;
doc = "showslide";
}
if (picWindow!=null && !picWindow.closed){
if (document.all) {
l = picWindow.screenLeft-12+(picWindow.document.body.offsetWidth/2)-(w/2);
t = picWindow.screenTop-35+(picWindow.document.body.offsetHeight/2)-(h/2);
} else {
l = picWindow.screenX-10+(picWindow.outerWidth/2)-(w/2);
t = picWindow.screenY-23+(picWindow.outerHeight/2)-(h/2);
}
picWindow.close();
} else {
l = (screen.availWidth/2) - (w/2);
t = (screen.availHeight/2) - (h/2);
}
w+=12;
h+=20;
var p;
if (screen) {
if (w > screen.availWidth) {
w = screen.availWidth;
p = ",scrollbars=yes";
h=h+24;
}
if (h > screen.availHeight) {
h = screen.availHeight;
p = ",scrollbars=yes";
w=w+24;
}
}
if (d=="") d = get_root();
picWindow = window.open(d+"jcms/"+doc+".php?"+u, "Image", "width="+w+",height="+h+",left="+l+",top="+t+",sreenX="+l+",screenY="+t+",resizable,status=no"+p);
if (picWindow) {picWindow.focus();}
}
function toggle(item, mode){
if (mode==null) mode="block";
var ShowItems=document.getElementById(item).style;
if (ShowItems.display=="none"){
ShowItems.display=mode;
} else {
ShowItems.display="none";
}
}
function toggle_img(item, img1, img2){
var img = document.getElementById(item);
var regex = /^.*\/jcms\//
var urlbase = regex.exec(img.src);
if(img.src==urlbase+img2){
img.src=urlbase+img1;
} else {
img.src=urlbase+img2;
}
}
var timeoutId;
var interval = 5000;
function setCloseLink(){
if (opener) document.getElementById("closelink").href="javascript:self.close();";
}
function slideShow(ctrl){
var ret;
var frm = document.getElementById("frmSlide");
var inputs = frm.getElementsByTagName("input");
for (var i=0;i loading image...";
if (!(http_request = getHttpObject())){
imgdiv.innerHTML = "Unable to display the image.";
if (imgloaddiv) imgloaddiv.innerHTML = "";
return true;
}
var url = get_root()+"jcms/return.php?img="+imageid;
http_request.onreadystatechange = function(){
if (http_request.readyState == 4) {
if (http_request.status == 200) {
var ret = http_request.responseXML;
if (imgtextdiv) imgtextdiv.innerHTML="("+getvalue(ret,"views")+" views) "+getvalue(ret, "caption")+"
"+getvalue(ret, "description")+"";
imgdiv.innerHTML="";
if (nav==true){
setNav(cid, imageid);
restartSlide();
} else {
var today = new Date();
var cookietime = new Date();
cookietime.setTime(today.getTime()+3600000*24*7);
document.cookie = "img_"+cid+"="+imageid+";path="+get_root()+";"+";expires="+cookietime.toGMTString();
}
} else {
imgdiv.innerHTML="Unable to display the image.";
}
if (imgloaddiv) imgloaddiv.innerHTML = "";
return false;
}
}
http_request.open("GET", url, true);
http_request.send(null);
return false;
}
function setNav(cid, imageid){
var divprev = document.getElementById("imgprev");
var divnext = document.getElementById("imgnext");
var listarray = imglist.split("|");
var url = document.URL;
var uid = /img=([0-9]+.*)/.exec(url);
if (uid){
url = url.substring(0, url.length-uid[1].length);
} else {
if (/\?/.test(url)){
url += "&img=";
} else {
url += "?img=";
}
}
setThumbShown(imageid);
for (var i=0; i < listarray.length;i++){
if(listarray[i]==imageid){
if (i!=0){
divprev.className="enabled";
var previd = listarray[i-1];
divprev.href=url+previd;
divprev.onclick=function(){return showContentImage(cid, previd);}
} else {
divprev.className="disabled";
divprev.href="#";
divprev.onclick=function(){this.blur();return false}
}
if (i!=(listarray.length-1)){
divnext.className="enabled";
var nextid = listarray[i+1];
divnext.href=url+nextid;
divnext.onclick=function(){return showContentImage(cid, nextid);}
} else {
divnext.className="disabled";
divnext.href="#";
divnext.onclick=function(){this.blur();return false}
}
return;
}
}
}
function setThumbShown(imageid){
var thumbs = document.getElementById("thumbs").getElementsByTagName("img");
for (var i=0;i=marginbottom-2*snow[i].size || parseInt(snow[i].style.left)>(marginright-3*lftrght[i])){
// if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size)}
// if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size)}
// if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4}
// if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2}
// snow[i].posy=0
// }
// }
// var timer=setTimeout("movesnow()",50)
// }
//
// for (i=0;i<=snowmax;i++) {
// document.write(""+snowletter+"")
// }
// if (browserok) {
// window.onload=initsnow
// }
// }