// JavaScript functions for MV COASTAL.

function TopInfo () {

	return 'MV COASTAL, INC. • PO BOX 1431 • EDGARTOWN, MA 02539 • 508-627-3492';
}



// function WindowOpen (theURL, winName, features) {

//	window.open (theURL, winName, features);
// }

function WindowOpen(theURL,winName,features) { //v2.0 

	window.open(theURL,winName,features);
}

function Tscroll_init (id) {
	document.write ('<iframe id="Tscr' + id + '" scrolling=no frameborder=no src="scroll.html?' + id + '" width="1" height="1"></iframe>');
}


DEFAULT = {
	'clas' : {
		'bck':'Back',
		'aup':'ArrowUp',
		'adn':'ArrowDn',
		'itm':'ItemBody'
	},
	'size' : [150, 100],
	'up' : 'aup.gif',
	'dn' : 'adn.gif'
}



var LOOK = {

	// scroller box size: [width, height]
	'size': [350, 200]
},



BEHAVE = {

	// autoscroll - true, on-demand - false
	'auto': true,
	
	// vertical - true, horizontal - false
	'vertical': true,
	
	// scrolling speed, pixels per 40 milliseconds;
	// for auto mode use negative value to reverse scrolling direction
	'speed': 1
},



// a data to build scroll window content
ITEMS = [

	{	// file to get content for item from; if is set 'content' property doesn't matter
		// only body of HTML document is taken to become scroller item content
		// note: external files require time for loading 
		// it is RECOMMENDED to use content property to speed loading up
		// please, DON'T forget to set ALL IMAGE SIZES 
		// in either external file or in 'content' string for scroller script 
		// to be able to estimate item sizes
		'file': '',
		'content': '&quot;To us &lsquo;craftsmanship&rsquo; and &lsquo;communication&rsquo; sum ' +
							 'up the MV Coastal experience. Compared to other builders we&rsquo;ve dealt with, ' +
							 'Stephen&rsquo;s constant attention to the details of our project were impressive, ' +
							 'and his proactive communication efforts to keep us imformed of its progress were ' +
							 'remarkable. He made our Vineyard home-building experience one of the best ever.&quot;' +
							 '<br><div align="right">&mdash;William E. and Kay M. Griffin</div>',
		'pause_b': 15,
		'pause_a': 0
	},
	
	{
		'file': '',
		'content' : '<b>Item with some <font color="red">HTML STUFF</font></b>',
		'pause_b': 15,
		'pause_a': 0
	}
	
	
// add as many items here as you need.
// don't forget to separate them with commas, make sure there is no comma after the last item
]


function PreLoad () {

	var d = document;
	
	if (d.images) {
	
		if (!d.p) d.p = new Array();
		
		var i, j = d.p.length, a = PreLoad.arguments;
		
		for (i = 0; i < a.length; i++)
		
			if (a[i].indexOf("#") != 0) {
			
				d.p[j] = new Image;
				d.p[j++].src = a[i];
			}
	}
}

function FindObj (n, d) {

	var p, i, x;
	
	if (!d) d = document;
	
	if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
	
		d = parent.frames[n.substring(p + 1)].document;
		
		n = n.substring(0, p);
	}
	
	if (!(x = d[n]) && d.all) x = d.all[n];
	
	for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
	
	for (i = 0; !x && d.layers && i < d.layers.length; i++) x = FindObj(n, d.layers[i].document);
	
	if (!x && d.getElementById) x = d.getElementById(n);
	
	return x;
}

function SwapImage () {

	var x, params = SwapImage.arguments;
	
	x     = FindObj(params[0]);
	
	x.src = params[1];

}

