﻿function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.href);
    if (results == null)
        return "";
    else
        return results[1];
}
var vid = getParameterByName("vid");
var vidseq = getParameterByName("vidseq");
var url = window.location.href;


$(document).ready(function () {
    if (vid != "") {
        $("a[href]").each(function (index, element) {
            if ($(this).attr("href").indexOf('#') == -1) {
                if ($(this).attr("href").indexOf('?') != -1)
                    $(this).attr("href", $(this).attr("href") + "&vid=" + vid + "&vidseq=" + vidseq);
                else
                    $(this).attr("href", $(this).attr("href") + "?vid=" + vid + "&vidseq=" + vidseq);
            }
        });

        $("form[action]").each(function (index, element) {
            if ($(this).attr("action").indexOf('#') == -1) {
                if ($(this).attr("action").indexOf('?') != -1)
                    $(this).attr("action", $(this).attr("action") + "&vid=" + vid + "&vidseq=" + vidseq);
                else
                    $(this).attr("action", $(this).attr("action") + "?vid=" + vid + "&vidseq=" + vidseq);
            }
        });
    }
});
			   		   
