// PF Azure Frameworks
// version 0.1
// Permission
// By Anthony Muscat


var pfAzureURL = "http://travelodge.permission.com.au/";
var pfAzureIframeCode = "";

function getQueryString(ji) {
    hu = window.location.search.substring(1);
    gy = hu.split("&");
    for (i = 0; i < gy.length; i++) {
        ft = gy[i].split("=");
        if (ft[0] == ji) {
            return ft[1];
        }
    }
}

function ActivateIframe() {
    if (getQueryString("guid") == undefined)
    {
         pfAzureIframeCode = '<iframe src="' + pfAzureURL +'default.aspx?action=activate" width="100%" height="530" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"> </iframe>';
    }
    else
    {
        pfAzureIframeCode = '<iframe src="' + pfAzureURL +'default.aspx?action=activate&guid=' + getQueryString("guid") + '"  width="100%" height="530" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"> </iframe>';
    }
}

function updateIframe() {
    if (getQueryString("guid") == undefined)
    {
        pfAzureIframeCode = '<iframe src="' + pfAzureURL + 'default.aspx?action=update" width="100%" height="530" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"> </iframe>';
    }
    else
    {
        pfAzureIframeCode = '<iframe src="' + pfAzureURL + 'default.aspx?action=update&guid=' + getQueryString("guid") + '"  width="100%" height="530" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"> </iframe>';
    }
}

function unsubIframe() {
    if (getQueryString("email") == undefined) {
        pfAzureIframeCode = '<iframe src="' + pfAzureURL + 'default.aspx?action=unsubscribe" width="100%" height="550" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"> </iframe>';
    }
    else {
        pfAzureIframeCode = '<iframe src="' + pfAzureURL + 'default.aspx?action=unsubscribe&email=' + getQueryString("email") + '"  width="100%" height="550" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"> </iframe>';
    }
}

function subscribeIframe() {
    if (getQueryString("email") == undefined) {
        pfAzureIframeCode = '<iframe src="' + pfAzureURL + 'default.aspx?action=subscribe" width="100%" height="400" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"> </iframe>';
    }
    else {
        pfAzureIframeCode = '<iframe src="' + pfAzureURL + 'default.aspx?action=subscribe&email=' + getQueryString("email") + '"  width="100%" height="400" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"> </iframe>';
    }
}

function updateEmailIframe() {
        pfAzureIframeCode = '<iframe src="' + pfAzureURL + 'default.aspx?action=updateemail" width="100%" height="540" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"> </iframe>';
}



