function warning(url) {
  popupWin = window.open(url, 'Disclaimer', 'width=800,height=600,left=5,top=5')
}
function openWindow(url) {
  popupWin = window.open(url, 'Poll', 'width=300,height=300,left=100,top=100')
}
function camWindow(url) {
  popupWin = window.open(url, 'Cam', 'width=450,height=400,left=200,top=200')
}
function epinionWindow(url) {
  popupWin = window.open(url, 'Picture', 'width=600,height=400,left=100,top=100')
}
function portfolioWindow(url) {
  popupWin = window.open(url, 'Portfolio', 'width=700,height=600,left=50,top=50')
}
function phbWindow(url) {
  popupWin = window.open(url, 'PHB', 'width=400,height=400,left=100,top=100')
}

function OpenComments (c) { window.open('/cgi-bin/mt/mt-comments.cgi?' + 'entry_id=' + c, 'comments', 'width=480,height=480,scrollbars=yes,status=yes');}

function OpenTrackback (c) {window.open(c,
                    'trackback',
                    'width=480,height=480,scrollbars=yes,status=yes');
}
function blogroll() {
	popupWin = window.open('/blogrolling/blogroll.html','Blogroll','width=150,height=400,left=0,top=100,scrollbars=yes,status=yes');}

function customWindow( pageToLoad, winName, width, height, center, scroll) 
{   xposition=0; yposition=0;
    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }
    args = "width=" + width + "," 
    + "height=" + height + "," 
    + "location=0," 
    + "menubar=0,"
    + "resizable=1,"
//    + "scrollbars=0,"
    + "status=0," 
    + "titlebar=0,"
    + "toolbar=0,"
    + "hotkeys=0,"
    + "screenx=" + xposition + ","  //NN Only
    + "screeny=" + yposition + ","  //NN Only
    + "left=" + xposition + ","     //IE Only
    + "top=" + yposition + ","          //IE Only
    + "scrollbars=" + scroll;

    window.open( pageToLoad,winName,args );
}

// adrotator.js 
function AdRotator(imgTagNameAttribute, adURLs, adImageURLs, rotationTime,
  adRotatorVarName) {
 this.imgTagNameAttribute = imgTagNameAttribute
 this.adURLs = adURLs
 this.adImageURLs = adImageURLs
 this.rotationTime = rotationTime
 this.adRotatorVarName = adRotatorVarName
 this.index = 0
 this.adImages = new Array(adImageURLs.length)
 for(var i=0; i<adImageURLs.length; ++i) {
  this.adImages[i] = new Image()
  this.adImages[i].src = adImageURLs[i]
 }
 this.writeHTML = AdRotator_writeHTML
 this.start = AdRotator_start
 this.rotate = AdRotator_rotate
 this.handleClick = AdRotator_handleClick
}

function AdRotator_writeHTML() {
 document.write('<p align="center">')
 document.write('<a href="javascript:void(0)" ')
 document.write('onclick="'+this.adRotatorVarName+'.handleClick()" ')
 document.write('onmouseover="window.status=\'view the webcam\'; return true;" onmouseout="window.status=\' \'; return true;">')
 document.write('<img name="'+this.imgTagNameAttribute+'" border="0" ')
 document.write('src="'+this.adImageURLs[0]+'">')
 document.write('</a></p>')
}

function AdRotator_start() {
 window.setInterval(this.adRotatorVarName + '.rotate()', this.rotationTime)
}

function AdRotator_rotate() {
 ++this.index
 this.index %= this.adImageURLs.length
 document.images[this.imgTagNameAttribute].src = this.adImages[this.index].src
}

function AdRotator_handleClick() {
 setTimeout("window.location.href = '"+this.adURLs[this.index]+"'",500)
}


var HOST = 'adam.gerstein.net';

// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.

function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
    document.cookie = curCookie;
}

function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function deleteCookie (name, path, domain) {
    if (getCookie(name))
        document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function fixDate (date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0)
        date.setTime(date.getTime() - skew);
}

function rememberMe (f) {
    var now = new Date();
    fixDate(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    setCookie('mtcmtauth', f.author.value, now, '', HOST, '');
    setCookie('mtcmtmail', f.email.value, now, '', HOST, '');
    setCookie('mtcmthome', f.url.value, now, '', HOST, '');
}

function forgetMe (f) {
    deleteCookie('mtcmtmail', '', HOST);
    deleteCookie('mtcmthome', '', HOST);
    deleteCookie('mtcmtauth', '', HOST);
    f.email.value = '';
    f.author.value = '';
    f.url.value = '';
}

function nav(sel) {
   if (sel.selectedIndex == -1) return;
   var opt = sel.options[sel.selectedIndex];
   if (opt && opt.value)
      location.href = opt.value;
}

