﻿/*******
flashTransfer by Gary.
*******/
function flashTransfer() {
	//extend logic object
	this.excuteFunc = null;
	//page refer
	this.refer = "";
	//page current
	this.currentUrl = "";
	//excute logic object
	this.excute = function() {
		this.currentUrl = document.location.href;
		if (this.currentUrl != this.refer) {
			if (typeof this.excuteFunc == "function") {
				this.excuteFunc(this.currentUrl);
				//set refer for next interval transfer don't execute.
				this.refer = this.currentUrl;
			}
		}
	}
	
	//Interval 0.5s transfer 
	this.urlInterval = function(ft) {
		setInterval(function() { ft.excute(); }, 500);
	}
	
	//parameter is change url tag sting.
	this.changeUrl = function(changeArgs) {
		var newUrl;
		if (this.currentUrl.indexOf("#") != -1) {
			newUrl = this.currentUrl.substr(0, this.currentUrl.indexOf("#") + 1) + changeArgs;
		}
		else
			newUrl = this.currentUrl + "#" + changeArgs;

		this.setCurrentAndReferUrl(newUrl);
		//change brower Url
		document.location.href = newUrl;
	}

	this.setCurrentAndReferUrl = function(newUrl) {
		this.currentUrl = newUrl;
		this.refer = document.location.href;
	}
}

function setPageTitle(title) {
	document.title = title;
}

  




