function quantcastURL(){
    var quantcastLabel = document.getElementById('quantcastLabel');
    var quantcastFrame = document.createElement("img");

    quantcastFrame.setAttribute("height","60");
    quantcastFrame.setAttribute("width","160");
    if(document.location.protocol == "https:"){
        quantcastFrame.setAttribute("src", "https://widget.quantcast.com/user/widgetImage?domain=p-fbiS6Ydv_HyB-&widget=8");
        quantcastLabel.appendChild(quantcastFrame);
    } else{
        quantcastFrame.setAttribute("src", "http://widget.quantcast.com/user/widgetImage?domain=p-fbiS6Ydv_HyB-&widget=8");
        quantcastLabel.appendChild(quantcastFrame);
    }
}

// ------------------------
// Dynamic APP Download Begin
// ------------------------

function downloadURL(){
    var pid=urlParameter('pid')!=null?urlParameter('pid'):10502;    
    var downloadLink = document.getElementById('downloadLink');
    exeFile="SendoriSetupx"+pid+".exe";
	// Check whether the file exist on server or not
	$.ajax({
		url:exeFile,
		type:'HEAD',
		error: function()
		{
			downloadLink.href="SendoriSetupx10502.exe";
		},
		success: function()
		{
			downloadLink.href=exeFile;
		}
	});
}

function downloadClick(){
    var pid=urlParameter('pid')!=null?urlParameter('pid'):10502;    
    var eventDesc='Remarketing Page - '+pid;
    _gaq.push(['_trackEvent', 'Sendori App', 'Download', eventDesc]);
}

var urlParameter = (function() {
    var parameters = undefined;
    return function (paramName) {
        if (parameters == undefined) {
            parameters = {};
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for (var i = 0; i < hashes.length; i++) {
                hash = hashes[i].split('=');
                parameters[hash[0]] = hash[1];
            }
        }
        return parameters[paramName];
    }
}());

// ------------------------
// Dynamic APP Download END
// ------------------------


// **************
// ACS Bar BEGIN
// **************
// Allign element center horizontally
/*
jQuery.fn.center = function () {
	//this.css("position","absolute");
	//this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
	this.css("left", ( $(window).width() - 954 ) / 2+$(window).scrollLeft() + "px");
	return this;
}

$(document).ready(function() {
	$('#acsbanner').center();
	 setTimeout(function(){
	$('#acsbar').slideDown();
	}, 1000);
});

// Stays bar at bottom
$(window).scroll(function() {
	$('#acsbanner').center();
	$('#acsbanner').css('top', $(this).scrollTop()+$(this).height()-72 + "px");
});

$(window).resize(function() {
	$('#acsbanner').center();
	$('#acsbanner').css('top', $(this).scrollTop()+$(this).height()-72 + "px");
});
*/
// **************
// ACS Bar END
// **************

