

function Querystring(qs) { // optionally pass a querystring to parse
	this.params = {};
	
	if (qs == null) qs = location.search.substring(1, location.search.length);
	if (qs.length == 0) return;

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ');
	var args = qs.split('&'); // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i = 0; i < args.length; i++) {
		var pair = args[i].split('=');
		var name = decodeURIComponent(pair[0]);
		
		var value = (pair.length==2)
			? decodeURIComponent(pair[1])
			: name;
		
		this.params[name] = value;
	}
}

Querystring.prototype.get = function(key, default_) {
	var value = this.params[key];
	return (value != null) ? value : default_;
}

Querystring.prototype.contains = function(key) {
	var value = this.params[key];
	return (value != null);
}

function frameBust()
{
    var url = window.location.toString();
    
    //get all the parameters
    url.match(/\?(.+)$/);
    var params = RegExp.$1;

    //is the frame at the top?
    if( window == window.top ) {
        var strUrl = "http://www.peugeot.co.uk/finance/offers/retail-offers/"; 
        var qs = new Querystring();
        if(qs.contains("section")) {
            var v1 = qs.get("section");
            
            //get section var
            switch (v1.toLowerCase())
            {
                case "tactical":
                    strUrl = "http://www.peugeot.co.uk/about-peugeot/environment/blue-lion-offers/";
               	case "ni":
                    strUrl = "http://www.peugeot.co.uk/northern-ireland-offers/home/";
                break;
            break
            } 
        }
        
        //redirect with all the parameters     
        location.replace(strUrl + "?" + params);        
    }

}