/******************************************/
/* Coded with: Macromedia Dreamweaver 8   */
/* File Name: MiscFunctions.js            */
/* Created By: PricelessSurveys.com       */
/* Created: Jan. 30, 2006                 */
/* Last Modified: Mar. 1, 2006            */
/* Comment: this is only for free-surveys */
/*          section                       */
/******************************************/


// set global variables for the following functions
//var domain_name = "http://www.PricelessSurveys.com/";
var domain_name = "http://localhost/PricelessSurveys.com/";

/*************************************************************/
/**  POPUP WINDOWS (FRIEND, COUNTRIES, TYPES, INCENTIVE)    **/
/*************************************************************/
// Popup function for region page
function regionPopup()
{
	var winW = 300;	
	var winH = 480;
	window.open(domain_name+'help/region.html', 'regionPopup', 'left=0, top=0, width='+winW+', height='+winH+', directories=0, location=0, status=0, toolbar=0, menubar=0, resizable=no, scrollbars=no ,xscreen=0, yscreen=0');
}

// Popup function for types of activities page
function typesPopup()
{
	var winW = 300;	
	var winH = 380;
	window.open(domain_name+'help/types.html', 'typesPopup', 'left=0, top=0, width='+winW+', height='+winH+', directories=0, location=0, status=0, toolbar=0, menubar=0, resizable=no, scrollbars=no ,xscreen=0, yscreen=0');
}

// Popup function for incentive page
function incentivePopup()
{
	var winW = 450;	
	var winH = 450;
	window.open(domain_name+'help/incentive.html', 'incentivePopup', 'left=0, top=0, width='+winW+', height='+winH+', directories=0, location=0, status=0, toolbar=0, menubar=0, resizable=no, scrollbars=no ,xscreen=0, yscreen=0');
}


/*************************************************************/
/**  ADD BOOKMARK and MAILTO                                **/
/*************************************************************/
// function to bookmark page (version #1)
function addBookmark()
{
	var url=document.location.href;
	var title=document.title;
	if (window.sidebar)
	{ // firefox
		window.sidebar.addPanel(title, url,"");
	}
	else if (window.external)
	{ //MSIE
		window.external.AddFavorite( url, title);
	}
	else
	{
		alert("Sorry, your browser doesn't support this!\nOpera users: press Ctrl/Cmd + T to Bookmark.\nNetscape users: press Ctrl/Cmd + D to Bookmark.");
	}
}

// Function to handle email links (to prevent spambots from finding our email addresses)
// send address, subject, and the text we want person to see (if no subject, use "" instead)
function mailto(address,subject,linktext)
{
	var first = 'ma';
	var second = 'il';
	var third = 'to:';
	var domain = 'PricelessSurveys';
	var ext = 'com';
	document.write('<a href="');
	document.write(first+second+third);
	document.write(address);
	document.write('&#64;');
	document.write(domain);
	document.write('.');
	document.write(ext);
	if (subject == "")
	{
		// no subject so write nothing here
	}
	else
	{
		// write subject
		document.write('?subject=');
		document.write(subject);
	}
	document.write('">');
	document.write(linktext);
	document.write('</a>');
}


// close window function
function closeWindow()
{
	window.close();
}

// This is from common db page (for opening new window mainly for mysql error message)
function open_window(url)
{
	// size of new browser window
	var new_win_width = 600;
	var new_win_height = 400;
	var NEW_WIN = null;
	NEW_WIN = window.open ("", "RecordViewer", "toolbar=no,width="+new_win_width+",height="+new_win_height+",directories=no,status=no"+",scrollbars=yes,resize=no,menubar=no");
	NEW_WIN.location.href = url;
}
