function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
  alert('Query Variable ' + variable + ' not found');
}



	var f = 0;
	var originalColour;
	var cycle;
	
		function UpdateHelpActive(text)
		{
			var div = document.getElementById('TopBar1_HelpBox');
			div.innerHTML = GetTextById(text);
			div.scrollTop = 0;
			javascript:scroll(0,0);
			f = 7;
			
			cycle = 0;
			
			AnimateHelp();
		}
		
		function UpdateHelpPassive(text)
		{
			var div = document.getElementById('TopBar1_HelpBox');
			div.innerHTML = text;
		}
		
		function GetTextById(id){
		
			switch (id){
				case '1': //Bulk Entries
					return '<b>Bulk Entries</b><hr>You can make more than one entry at a time by clicking the button to the right of the text box. When the text box expands, type the name of each additional object on a new line. You cannot save more than 30 entries in this manner.';
				case '2': //Restricted content checkbox
					return '<b>Restricted Content</b><hr>If the item you are saving contains material that could be offensive to another user, you must make sure you tick the appropriate check box. Failure to do so could result in your account being suspended.';
				case '3': //Privacy
					return '<b>Privacy</b><hr>Throughout this site, you will have the option of setting items to different privacy levels. A privacy level of <b>Public</b> means that any user will be able to view the item. A privacy level of <b>Private</b> means only you will ever be able to view the item. A privacy level <b>Contacts Only</b> means that only users who are on your Contacts List will be able to view the item. For more information on maintaining your Contacts List, please click <a href="javascript: UpdateHelpActive(\'4\');">here</a>';
				case '4': //Contacts List
					return '<b>Contacts List</b><hr>You can add people to your contacts list by viewing their profile and clicking the <b>Add To My Contacts List</b> button at the bottom their profile screen. You can view all the people on your contacts list by clicking the <b>My Contacts</b> button in the navigation menu. You can also view all users that have added you to their contact lists on this page.<br>For information on viewing user profiles, click <a href="javascript: UpdateHelpActive(\'5\');">here</a>. To understand more about the importance of your <b>Contacts List</b> please click <a href="javascript: UpdateHelpActive(\'3\');">here</a>';
				case '5': //User Profiles
					return '<b>User Profiles</b><hr>A user profile can display information about a user\'s location, age, gender, name, personal web site address as well as a personal introduction. From the profile page you can also view a person\'s photos. How much you see depends on what they have chosen to display. You can edit your profile display settings by clicking on the <b>My Profile</b> link in the navigation bar. You can search through profiles by clicking the <b>User Search</b> button in the navigation bar. For more information on editing your profile, please click <a href="javascript: UpdateHelpActive(\'6\');">here</a>';
				case '6': //Edit Profile
					return '<b>Editing Your Profile</b><hr>The <b>My Profile</b> page allows you to enter a personal website address and a personal introduction. You can also choose what information about yourself you want others to be able to see (such as your gender, age etc.). The button at the bottom of the screen will allow you to add images of yourself to your profile. When you are satisfied with your profile, click the <b>View My Public Profile</b> link to view the profile that others will be able to see.';
				case '7': //Mail
					return '<b>Your Mail</b><hr>The mail page allows you to sort and view any message you have received or sent. To sort your mail, simply click the appropriate column header. To read a message, click the message subject line. You will then be taken to a screen where you can read the contents of the message and reply to it. To delete messages, click the check box next to each message you want to delete and then press the delete button. Messages can be marked as unread in the same way.';
				case '8': //icon definitions
					return '<b>Icon Definitions</b><hr><img src="images/iconPrivate.gif"> <b>Private</b><br>Only the creator can view this.<br><br><img src="images/iconContactsOnly.gif"> <b>Contacts Only</b><br>Only people on the creator\'s <a href="javascript: UpdateHelpActive(\'4\');">contacts list</a> can view this.<br><br><img src="images/iconRestricted.gif"> <b>Restricted</b><br>This item contains restricted content.<br><br><img src="images/iconViews.gif"> <b>Views</b><br>The number of times this item has been viewed.<br><br><img src="images/iconKeyViews.gif"> <b>Key Views</b><br>The number of times an item is viewed under special circumstances. When an item gains a key view, the owner of the item gains <a href="javascript: UpdateHelpActive(\'9\');">credits</a>.';
				case '9': //credits
					return '<b>Credits</b><hr>Credits can be used to increase your privileges with Data Puddle. They can be swapped for more space in your library, the ability to upload larger images etc. For a full list of upgrades, click on the <b>My Credits</b> button when you are logged on.<br><br>There are many ways you can increase the number of credits you have:<ol><li>When your images or catalogue entries are viewed you will gain some credits.</li><li>When you write a review for Data Puddle you will gain a large chunk of credits.</li><li>If you refer a friend by clicking on the <b>Refer A Friend</b> button and that friend joins Data Puddle through the email that was sent to them, you will gain a <i>very</i> large chunk of credits.</li></ol>To see a list of the actual amount of credits you earn for these tasks, click on the <b>My Credits</b> button when you are logged in.';
				case '10': //refer a friend
					return '<b>Refer a Friend</b><hr>If you refer a friend through the refer a friend page, your friend will be sent an email inviting them to join Data Puddle. When a user joins the site using one of the links in the email, you will automatically be added to each others <a href="javascript: UpdateHelpActive(\'4\');">contacts list</a>. At this point, the user who referred the friend will also gain <a href="javascript: UpdateHelpActive(\'9\');">credits</a>. Any friend you refer will be given your first name, last name and email address. They will also be given some high level statistics about the number of entries in your library and Data Puddle as a whole.';
				case '11': //advertising
					return '<b>Advertising</b><hr>If you don\'t want to swap credits for increased privileges on Data Puddle, you can spend them on advertising. You will need to prepare two images for your ad and they must meet specific requirements. These requirements will be given to you when you choose to create a new ad. Simply supply us a name for your ad, a url that they will be directed to when the click the ad and the number of times you would like the ad to be served. You can then choose to either show the ad to anyone and everyone who visits the site or target a specific audience. If you target only logged in users, you will have the option of only targeting people within a certain country, city, age range, and gender. If your ad contains restricted content, then it will only be served to logged in users that have said they don\'t mind seeing restricted content. Once you have saved your ad, you will need to wait until an administrator approves it. After that happens, you will need to wait until your ad reaches the front of the queue before it starts being served. Once an ad has completed its run, you will be sent a message giving you instructions on how you can view statistics about the effectiveness of your advertisement. If your ad is not approved, you will be refunded the credits you spent on it. Please allow up to 1 week for your ad to be approved.'; 
				case '12': //response rates
					return '<b>Response Rates</b><hr>When an ad has completed its run, you can view the response rates. By analysing the response rates you can make your next advertisement more effective.'; 
				case '13': //search
					return '<b>Search</b><hr>When searching Data Puddle, you can choose to filter by any of the fields you see on the screen. If you don\'t want to filter your results by a particular field, then leave it blank or untouched. When you choose to limit your results to a specific catalogue, you will have the option of advanced searching. When you make an advanced search, you can filter your results by any of the fields contained within the catalogue you are searching. When the search results are displayed, you can sort by a particular column by clicking the column heading. This function is not available for all columns.'; 
				case '14': //filter by country
					return '<b>Location Filter</b><hr>When you choose to filter by location, you are limiting your search to only those catalogue entries that are created by someone living in the selected area.'; 
				case '15': //toggle advance/simple
					return '<b>Advanced/Simple Searching</b><hr>When you choose to filter your results by a specific catalogue, you can choose to do an advanced or simple search. An advanced search will allow you to filter your results by any of the fields contained within the catalogue. A simple search will not filter by any of the catalogue attributes.'; 
				case '16': //order by
					return '<b>Ordered Searches</b><hr>You can choose to order your search results by selecting a field from the Order By drop down list. When you order your search, the field that you are ordering by will be displayed in the search results table.'; 
				case '17': //user search
					return '<b>User Search</b><hr>The user search page allows you to search through the users of Data Puddle. When the search results grid is displayed, you can choose to either view the person\'s profile or search their personal library on Data Puddle.'; 
				case '18': //your library
					return '<b>Your Library</b><hr>The library page displays a list of all the catalogues currently in your library. The library always contains default catalogues such as personals and reviews. These catalogues cannot be removed. If none of the catalogues match a collection that you want to add to Data Puddle, then you can search for an existing catalogue to add to your library. You will be able to search through any catalogue that a user has made publicly available. If you still can\'t find a suitable catalogue, you can create your own. If you would like to make your catalogue publicly available so that other users can add entries to it you can do so once the catalogue has reached a certain size.'; 
				case '19': //create a new catalogue
					return '<b>Create A Catalogue</b><hr>Before creating a new catalgue, we strongly urge you to search for an existing catalogue to add to your library. Someone else may already have gone through the trouble of creating the catalogue. Remember... even if you use someone else\'s catalogue and it isn\'t exactly what you need, you can modify it by adding additional attributes or attribute values'; 
				case '20': //catalogue search
					return '<b>Catalogue Search</b><hr>You can search Data Puddle for catalogues that users have made publicly available. Once you add a public catalogue to your library, you can add entries in it by clicking the Add To My Library button.'; 
				case '21': //catalogue attributes
					return '<b>Catalogue Attributes</b><hr>A catalogue is made up of attributes. An attribute is anything that describes a certain element of the catalogue. For example, a movie has a genre, director and running time. Genre, director and running time are all attributes of a Movie catalogue. They all tell you something about the movie. If you are editing the attributes of a public or default catalogue, you can\'t delete or edit any of the existing attributes but you can always add more.'; 
				case '22': //Attribute values
					return '<b>Attribute Values</b><hr>Attributes that are displayed as drop down lists and check boxes can have attribute values added to them. An attribute value is simply an option in the check box or drop down list. An example of attribute values would be Comedy, Action, Adventure and Thriller. These attribute values would all belong to a Genre attribute of a Movies catalogue.'; 
				case '23': //Publish Catalogue
					return '<b>Publish Catalogue</b><hr>Once a catalogue has a certain number of attribute values then a user can choose to publish that catalogue. When a catalogue is published, all of the attributes and attribute values within it are locked. This means that they can no longer be edited or deleted. However, additional attributes and attribute values can be added. When a catalogue is published, other users can search for it and add it to their own library. They can then add their own entries to the catalogue.'; 
				case '24': //Help Example
					return '<b>Help Icons</b><hr>You\'ll find these icons scattered throughout Data Puddle. If you\'re ever unsure about the function you\'re perfoming or want to know about the page you are on, just click on the image to learn more.'; 
				default:
					return 'Default';
			}
			return 'hello';
		}
		
		function AnimateHelp(){
			
			var div = document.getElementById('TopBar1_HelpBox');
			if(cycle == 1)
				div.className = 'HelpBox';
			else
				div.className = 'HelpBoxAlternate';
			
			cycle++;
			
			if(cycle > 1)
				cycle = 0;
	
			f--;
			if(f > 0)
				setTimeout("AnimateHelp();",100);
			else{
				div.style.color = originalColour;
				div.className = 'HelpBox';
				}
		}
		
		function Is() {
			agent = navigator.userAgent.toLowerCase();
			this.major = parseInt(navigator.appVersion);
			this.minor = parseFloat(navigator.appVersion);
			this.ns = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
			this.ns4 = (this.ns && (this.major == 4));
			this.ns6 = (this.ns && (this.major >= 5));
			this.ie = (agent.indexOf("msie") != -1);
			this.ie3 = (this.ie && (this.major < 4));
			this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") == -1));
			this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") != -1));
			this.ie55 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5") != -1));
			this.ie6 = (this.ie && (agent.indexOf("msie 6.0")!=-1) );
		}




