﻿/// <reference path="jquery-vsdoc.js" />
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); };

function goToPage(toPage)
{
	var targetPage = toPage;
	
	//if (targetPage.indexOf("?") > -1)
	//	targetPage = targetPage.substring(0, targetPage.indexOf("?"));
	
	if (targetPage.toLowerCase() !== getCurrentPageName().toLowerCase())
		window.location = toPage.replace("^^^", "'");
		
	//return false;
}

function goToNewWindow(toPage)
{
	var targetPage = toPage;
	if (targetPage.toLowerCase() !== getCurrentPageName().toLowerCase())
//		window.location = toPage.replace("^^^", "'");
		window.open(toPage.replace("^^^", "'"), '_blank', ''); 
}

function getCurrentPageName()
{
    return document.getElementById("ctl00_pageName").value.toString();
	/*
	if (window.location.href.indexOf(".aspx") === -1)
		return "default.aspx";
	var strings = window.location.href.toLowerCase().split('/');
	var i = -1;
	while (strings[++i].indexOf(".aspx") === -1);
	if (i < strings.length)
		return strings[i];
	else
		return "";
	*/
}