


/*
	Copyright David Trewern Design         :: www.dtdesign.com ::
	Unauthorised modification / use is a criminal offence, and
	will be prosecuted to the fullest extent permitted by law.
	All Rights Reserved
*/

NAVarr = new Array("logout", "browse", "next", "submit", "update", "delete", "cancel", "graph", "calculate", "subscribe", "subscribe1", "subscribe2", "upgrade1", "upgrade2", "renew", "renew1", "renew2", "redeem", "donate", "confirm", "modify", "read", "edit", "DeleteLinkButton", "CancelLinkButton", "SaveLinkButton", "EditLinkButton", "ConfirmLinkButton", "saveresp", "change", "print", "close", "reward", "comment", "login", "join", "joinorg", "find", "findgrey", "submitgreen", "earn", "cash", "make", "tour","searchagain","back","taketour","next2", "createsurvey", "view", "save", "activatesample", "takesurvey");
if (document.images) {
	for (var NAVitem in NAVarr) { 
		 for (var NAVicount=0; NAVicount < 2; NAVicount++) { 
				eval("b" + NAVarr[NAVitem] + NAVicount + " = new Image()");
				eval("b" + NAVarr[NAVitem] + NAVicount + ".src = 'assets/swap_" + NAVarr[NAVitem] + "_" + NAVicount + ".gif'");
				
		 } 
	} 
}

function BturnOn(imageName) {
	if (document.images) { document [imageName].src = eval("b" +imageName + "1.src");  }
}

function BturnOff(imageName) {
	if (document.images) { document [imageName].src = eval("b" + imageName + "0.src");  }
}

function BturnOnInput(imageName) {
	if (document.getElementById(imageName)) { document.getElementById(imageName).src = eval("b" +imageName + "1.src");   }
}
function BturnOffInput(imageName) {
	if (document.getElementById(imageName)) { document.getElementById(imageName).src = eval("b" + imageName + "0.src");   }
}


function BturnOnInput1(obj,imageName) {
	if (obj.src) {
		obj.src = eval("b" + imageName + "1.src");
	}
}

function BturnOffInput1(obj,imageName) {
	if (obj.src) {
		obj.src = eval("b" + imageName + "0.src");
	}
}

function  BturnOnInput2(obj,imageName,off) {

	if (obj.firstChild) {
		obj.firstChild.src = "assets/swap_" + imageName + "_" + off + ".gif";
	}
}



function imgPopup(path) {
	if (path) {
		window.open("utils_imagepopup.aspx?path=" + path, "popup", "width=400, height=300, toolbar=no, status=no, scrollbars=yes, resizable=yes");
	}
}

function forgottenPasswordPopup() {
		window.open("forgottenpassword.aspx", "popup", "width=350, height=180, toolbar=no, status=no, scrollbars=yes, resizable=yes");
}

function emailCommentPopup(href) {
		window.open(href, "popup", "width=570, height=420, toolbar=no, status=no, scrollbars=yes, resizable=yes");
}

function bogusCommentPopup(href) {
		window.open(href, "bg", "width=570, height=420, toolbar=no, status=no, scrollbars=no, resizable=yes");
}



function pointsGraphPopup(id) {
		window.open("utils_graphpopup.aspx?id=" + id, "popup", "width=600, height=700, toolbar=no, status=no, scrollbars=yes, resizable=yes");
}



function ddRedirect(dd) {
	if (dd.options[dd.selectedIndex].value != "") self.location = dd.options[dd.selectedIndex].value;
}



function commentSearch() {

		var path = "make-comment.aspx?";
		var qry = "cn=" + escape(document.getElementById("companyName").value);
		qry += "&";
		qry += "st=" + escape(document.getElementById("street").value);
		qry += "&";
		qry += "sb=" + escape(document.getElementById("suburb").value);
		qry += "&";
		qry += "sz=" + escape(document.getElementById("results").value);
		qry += "&p=1";
		
		//alert(qry);
		
		location = path + qry;

}

function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function popupProductImage(url) {
	window.open(url, "graph", "width=500, height=400, toolbar=no, status=no, scrollbars=yes, resizable=yes");
}
function popupGraph(url) {
		window.open(url, "graph", "width=400, height=300, toolbar=no, status=no, scrollbars=yes, resizable=yes");
}

function popupGraphPrint(url) {
		window.open(url, "printgraph", "width=600, height=600, toolbar=no, status=no, scrollbars=yes, resizable=yes");
}

function popUpTour(url){
		window.open(url, "tour", "width=778, height=550, toolbar=no, status=no, scrollbars=yes, resizable=yes");	
}
function popUpScreenshot(url){
		window.open(url, "screenshot", "width=778, height=715, toolbar=no, status=no, scrollbars=yes, resizable=yes");	
}

function Search(sort) {
	var qry = "status=" + document.forms[0]["status"].value;
	qry = qry + "&period=" + document.forms[0]["period"].value;
	qry = qry + "&category=" + document.forms[0]["category"].value;
	qry = qry + "&busnm=" + document.forms[0]["BusinessSelect"].value;
	qry = qry + "&q=" + document.forms[0]["q"].value;
	
	if (sort != "") {
		qry = qry + "&sort=" + sort;
	}
	
	location ="my-corporate-account.aspx?" + qry;
}

function MySearch(sort) {
	var qry = "status=" + document.forms[0]["status"].value;
	qry = qry + "&period=" + document.forms[0]["period"].value;
	qry = qry + "&q=" + document.forms[0]["q"].value;
	
	if (sort != "") {
		qry = qry + "&sort=" + sort;
	}
	
	location ="my-account.aspx?" + qry;
}

function showControl(id) {
	
	if (document.getElementById(id).style.visibility == null || document.getElementById(id).style.visibility != "visible")
	{
		document.getElementById(id).style.visibility = "visible";
	}
	else
	{
		document.getElementById(id).style.visibility = "hidden";
	}
	
}

function printCommentPopup(href) {
		window.open(href, "popup", "width=600, height=500, toolbar=yes, status=no, scrollbars=yes, resizable=yes");
}

function printoutComment() {
	printPage();
	window.close();
}

function printPage() {
  
  if(window.print) {
   	window.print();
   } else {
	if(agt.indexOf("mac") != -1) {
		alert("To print this page press Command-P.");
	} else {
		alert("To print this page press Control-P.");
	}
   }
   
}

//Make a Comment page

var str;
												
function show(listitem)
{
	toggleTab(listitem);
	
	if(document.getElementById("comment") != null)
	{
	
		document.getElementById("comment").value = getStr(listitem);
		document.getElementById("comment").focus();
	
	}
}

function getStr(listitem)
{
	if (listitem == "listitem1")
	{
		str = "";
	}
	if (listitem == "listitem2")
	{
		str = 'Situation: Include basic facts (where relevant) such as date, location, time of day, name of the person you dealt with, etc.\r\n\r\n' +
					'What made you think of this comment?\r\n\r\n' + 
					'What would you suggest the business do?\r\n\r\n'+ 
					'Anything further?';
	}
	if (listitem == 'listitem3')
	{
		str = 'Situation: Include basic facts (where relevant) such as date, location, time of day, name of the person you dealt with, etc.\r\n' +
					'I was in your Bridge Road Richmond store on Tuesday morning this week.\r\n\r\n' +
					'What made you think of this comment?\r\n' +
					'One staff member, Julie, was really friendly, but she also knew a great deal about the shoes that I was looking for and in the end helped me choose a pair that I am very happy with (ACME brand).\r\n\r\n' +
					'What would you suggest the business do?\r\n' +
					'I have to add that I went to your Bourke Street, Melbourne store last week looking for the same shoes and while the staff were very friendly,' + " they didn't" + ' know anything about these shoes - I knew more about them from an article I read in "Inside Hiking" this month.  May I suggest you have an "In The News" noticeboard in your staff room that has any articles about the goods you stock posted?  Suppliers or automatic internet searches could be used to keep you up to date.';
	}
	return str;
}

// Set tab

function toggleTab(listitem)
{

	//alert(document.getElementById(listitem) != null);

	if(document.getElementById(listitem) != null)
	{
	document.getElementById('listitem1').className = "";
	document.getElementById('listitem2').className = "";
	document.getElementById('listitem3').className = "";
	document.getElementById(listitem).className = "selected";
	}
}



function readmore(step,obj)
{
	
	

	if (document.getElementById(step).style.display == "none")
	{
		
		obj.innerHTML = "Hide";
		document.getElementById(step).style.display = "block";
	}
	else
	{
		
		document.getElementById(step).style.display = "none";

		obj.innerHTML = "Read more";
	}
	
}

