var objWindow;

function LoadCounter()
{
	var strTitle = "";
	var strReferer = "";
	var strColorDepth = "";
	var strScreenDimensions = "";
    var objCounterImage = document.getElementById("imgCounter");
    
    if (document.title)
    {
		strTitle = "&PageTitle=" + escape(document.title);
    }
    
    if (document.referrer && document.referrer!="")
    {
        strReferer = "&Referer=" + escape(document.referrer);
    }
    
    if (window.screen)
	{
		if (window.screen.colorDepth)
			strColorDepth = "&ColorDepth=" + window.screen.colorDepth;
		if (window.screen.height && window.screen.width)
			strScreenDimensions = "&ScreenDimensions=" + window.screen.width + "x" + window.screen.height;
    }
    
    if (objCounterImage != null)
    {
        objCounterImage.src = '/counter/counter.aspx?ts=' + GetTimeStamp() + strTitle + strColorDepth + strScreenDimensions + strReferer;
    }
    return true;
}

function SetContentDivHeight()
{
    var intAvailHeight = 500;
    var intAdjustment = 242
    
    if (window.innerHeight)
    {
        intAvailHeight = window.innerHeight - intAdjustment;
    }
    else if (document.body.clientHeight)
    {
        intAvailHeight = document.body.clientHeight - intAdjustment;
    }
    else if (document.documentElement.clientHeight)
    {
        intAvailHeight = document.documentElement.clientHeight - intAdjustment;
    }
    
    var objMainContentDiv = document.getElementById("MainContentDiv");
    objMainContentDiv.style.height = intAvailHeight + "px";
}

function GetTimeStamp()
{
    var objDate = new Date();

    return  objDate.getYear().toString() +
            objDate.getMonth().toString() +
            objDate.getDate().toString() +
            objDate.getHours().toString() +
            objDate.getMinutes().toString() +
            objDate.getSeconds().toString() +
            objDate.getMilliseconds().toString();
}

function isUndefined(a) 
{
    return typeof a == 'undefined';
} 

var intDefaultHeight = 600;
var intDefaultWidth = 600;

var _POPUP_FEATURES = 'resizable=yes, menubar=no, toolbar=no, status=no, scrollbars=no, location=yes, titlebar=yes';

function raw_popup(url, target, features)
{
    if (isUndefined(features)) {
        features = _POPUP_FEATURES+',width='+intDefaultWidth+', height='+intDefaultHeight;
    }
    if (isUndefined(target)) {
        target = '_blank';
    }
    var theWindow = window.open(url, target, features);
    theWindow.focus();
    return theWindow;
}

function link_popup(src, features)
{
    return raw_popup(src.getAttribute('href'),
        src.getAttribute('target') || '_blank',
        features);
}

function link_popup2(src, intWidth, intHeight)
{
    if (isUndefined(intWidth)) {
        intWidth = intDefaultWidth;
    }
    if (isUndefined(intHeight)) {
        intWidth = intDefaultHeight;
    }
    return link_popup(src,_POPUP_FEATURES+',width='+intWidth+',height='+intHeight);
}

function ShowPreview(strBasePath,strImageName, intWidth, intHeight)
{
	var objDiv = document.getElementById("ImagePreviewDiv");
	var objCell = document.getElementById("ImagePreviewCell");
	
	objCell.width = intWidth;
	objCell.height = intHeight;
	objCell.style.width = intWidth + 'px';
	objCell.style.height = intHeight + 'px';
	
	objDiv.style.width = intWidth + 4 + 'px';
	objDiv.style.display = 'block';
	objCell.innerHTML = '<img src="'+strBasePath+'images/sample_projects/large/' + strImageName + '.jpg">';
}

function HidePreview()
{
	var objDiv = document.getElementById("ImagePreviewDiv");
	
	objDiv.style.display = 'none';
}

function WriteString1()
{
	var strString =	'E' + '-' + 'mail';
					
	document.write(strString);
}

function WriteString2()
{
	var strString =	'<a href="m' + 'ailto:Eugene' +	String.fromCharCode(64) + 'TangerineEarth.com.au' +	'">' + 'Eugene' + String.fromCharCode(64) + 'TangerineEarth.com.au' + '</a>';
					
	document.write(strString);
}

