/* Default Standard Javascript Functions */

// Display an Image in a new window sized to the image //
function DisplayImage( imgURL,imgWidth,imgHeight ){
	// newWindow receives a reference to the new window object, if the window does not get created, //
	// it returnS null  which evaluated to "false" in the test expression //
	var newWindow = null;
	if (newWindow = window.open( 'blankdoc.htm','GraphicWindow','toolbar=no,width='+imgWidth+', height='+imgHeight ))
	{
		// Create the display string //
		c_line = "<html><head><base href='http://starcraftcustombuilders.com/'><\/head><body background=" + +imgURL + "><\/body><\/html>";
		// Display the image as a background image of the new window //
		newWindow.document.write( c_line );
		// Resize the new window to the width and height specified in the arguments //
		newWindow.resizeBy(imgWidth-newWindow.document.body.clientWidth, imgHeight-newWindow.document.body.clientHeight);
		// Give the new window focus //
		newWindow.focus();
	}
}

// Displays a Google Ad Panel below the Top Panel //
function googleAdPanel(nheight) {
	// Takes arguments //
	if ( nheight == undefined )
	{ 	
		google_ad_height = 280;
	}
	else
	{
		google_ad_height = nheight ;
	}
	// Install Google Add Banner //
	// Define variable used in call to .js file //
	google_ad_client = "pub-1557579244563846";
	google_ad_slot   = "0518129271";
	google_ad_width  = 300; //Formerly 336//
	
	document.write(' <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">');
	document.write(' </script>');
	return ('');
}

function backButton() {
	// Dummy function //
}
	
// Display a blank bar //
function blankBar( c_message ) {
	document.write('<span class="t12" style="background-color:#cccc99; border: solid 1px; display:block; text-align:center">');

	if ( c_message === undefined ) {
		c_message="<br>" ;
	}

	document.write('<br>');
	document.write( c_message );
	document.write('<br><br>');
	document.write('</span>');
	
	return( "" );
}

// Format and Display the standard "Continue to" bar //
function continueBar( c_link, c_title ) {
	if( c_link  === undefined ) return("");
	if( c_title === undefined ) return("" );
	
	document.write('<div id="noprint">');
	document.write('<center>');
	var c_line = "Continue to <a href=" + c_link + ">" + c_title + "</a>";
	// Format the span tag //
	document.write('<span class="t14" style="background-color:#cccc99; border:solid 1px; display:block; width:100%">');
	document.write('<br>');
	document.write(c_line);
	document.write('<br><br>');
	document.write('</span>');
	document.write('</center>');
	document.write('</div>');
	
	return('');
}

// Format and Display the standard "End" bar //
function endBar() {

	var c_line = "End";
	
	document.write('<div id="noprint">');
	document.write('<center>');
	
	// Copyright Notice //
	document.write('<span class="t10">Copyright &copy;');
	document.write(getThisYear());
	document.write(' StarCraft Custom Builders, Lincoln, Nebraska.  All rights under copyright reserved.');
	document.write('</span>');
	
	// End Bar //
	document.write('<span class="t12" style="background-color:#cccc99; border: solid 1px; width:100%">');
	document.write('<br>');
	document.write(c_line);
	document.write('<br><br>');
	document.write('</span>'); // End t12
	
	// "For More Good Reading" notice //
	document.write("<span class='t14'>For more good reading, check out the StarCraft Custom Builders' complete ");
	document.write('<a href="articleslist.htm">articles index</a>.');
	document.write('</center>');
	document.write('</div>'); // noprint
	// Return a blank string //
	return("");
}

// Returns the width of the document body in pixels //
function getBodyWidth() {

	// If this is IE, window.innerWidth will be undefined //
	if( typeof( window.innerWidth ) == 'number' ) 
	{
		// Opera, Firefox, Safari etc //
		return (window.innerWidth );
	} 
	else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) 
	{
    //IE 6+ strick //
    return ( document.documentElement.clientWidth );
  } 
  //Other IE //
  return ( document.body.clientWidth );
}
	
function getCalendarDate() {
	var amonths = new Array(13);
		amonths[0]	= "January";
		amonths[1]	= "February";
		amonths[2]	= "March";
		amonths[3]	= "April";
		amonths[4]	= "May";
		amonths[5]	= "June";
		amonths[6]	= "July";
		amonths[7]	= "August";
		amonths[8]	= "September";
		amonths[9]	= "October";
		amonths[10]	= "November";
		amonths[11]	= "December";
	var xtoday	=	new Date();
	var nmonth  = xtoday.getMonth();
	var cmonth	= amonths[nmonth];
	var cday		= xtoday.getDate() - 1;
	var cyear		= xtoday.getFullYear();
	var cdate		= cmonth + " " + cday +', ' + cyear;
	return cdate;
}

//Returns the current year as a string//
function getThisYear() {
	var xtoday	=	new Date();
	var cyear		= xtoday.getFullYear();
	return cyear;
}

function showHowHelpful( c_subject ) {
	if (c_subject === undefined) return("failed");
	
	var sc_subject = c_subject;
	var sc_nextline = ' Please Rate "' + sc_subject + '"'
	
	// Prevent the How Helpful form from printing // 
	document.write('<div id="noprint">');

	document.write('<br><br>');

	document.write('<center>');
	document.write('<div style="background-color:#cccc99; border:5px solid #6d6360; width: 840px">');
	document.write('<form method=post action="http://us.1.p12.webhosting.yahoo.com/forms?login=jmedgar">');

	document.write('<span class="h3" style="display:block; text-align:center">');
	document.write(sc_nextline);
	document.write('<hr class="hrnormal">');
	document.write('</span>');

	document.write('<table border=0 cellpadding="5" style="background-color:transparent; width:830px">');

	document.write('<tr class="strong" style="text-align:left" valign="top">'); /*  */

	document.write('<td style="width=:260px">');
	document.write('How helpful was this article?<br>');
	document.write('<input type="radio"  name="rating" value="Not Helpful" >			Not Helpful<br>');
	document.write('<input type="radio"  name="rating" value="Somewhat Helpful" > Somewhat Helpful<br>');
	document.write('<input type="radio"  name="rating" value="Helpful" >					Helpful<br>');
	document.write('<input type="radio"  name="rating" value="Very Helpful" >		  Very Helpful<br>');
	document.write('</td>');

	document.write('<td style="width:320px">');
	document.write('Can we make this article better? <br> If so, please tell us how.<br>');
	document.write('<textarea name="comments" rows="6" cols="35"></textarea>');
	document.write('</td>');

	document.write('<td style="width:250px" >');
	document.write('Do you want us to respond to your feedback? If so, please tell us your...<br><br>');
	document.write('<span class="t14" style="vertical-align:middle">'); 
	document.write('&nbsp;*Name: ');
	document.write('<input type="text" name="real_name" value="" width="200px"><br>');
	document.write('*E-mail: ');
	document.write('<input type="text" name="real-mail" value="">');

	document.write('</span>');
	document.write('</td>');

	document.write('<tr>');
	document.write('<td align="center" colspan="3">');
	document.write('<input name="btnSubmit" id="btnSubmit" type="submit" value="Click Here to Send Your Rating">');
	document.write('&nbsp;or <a href="contactus.htm" target="_blank">contact us</a> for more information.');
	document.write('</td>');
	document.write('</tr>');

	document.write('<tr>');
	document.write('<td align="center" colspan="3">');
	document.write('<span class="t14">*We will not give out this information. <a href="privacy.disclosures.htm">Our privacy policy</a></span>.');
	document.write('</tr>');

	document.write('</table>');

	sc_nextline='<input type="hidden" name="subject" value="' + sc_subject +'">';
	document.write(sc_nextline);

	document.write('<input type="hidden" name="next_url" value="http://starcraftcustombuilders.com/contactus3.htm">');
	document.write('</form>');
	document.write('</div>');
	document.write('</center>');
	
	return("");
}

