/*
Uploadify v1.6.2
Copyright (C) 2009 by Ronnie Garcia
Co-developed by Travis Nickels
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
var flashVer = -1;
if (navigator.plugins != null && navigator.plugins.length > 0) {
if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
var descArray = flashDescription.split(" ");
var tempArrayMajor = descArray[2].split(".");
var versionMajor = tempArrayMajor[0];
var versionMinor = tempArrayMajor[1];
var versionRevision = descArray[3];
if (versionRevision == "") {
versionRevision = descArray[4];
}
if (versionRevision[0] == "d") {
versionRevision = versionRevision.substring(1);
} else if (versionRevision[0] == "r") {
ersionRevision = versionRevision.substring(1);
if (versionRevision.indexOf("d") > 0) {
versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
}
}
var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
}
} else if ($.browser.msie) {
var version;
var axo;
var e;
try {
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
version = axo.GetVariable("$version");
} catch (e) {
}
flashVer = version.replace("WIN ", "").replace(",", ".");
}
flashVer = flashVer.split(".")[0];
if (jQuery) (
function($) {
$.extend($.fn, {
fileUpload: function(options) {
if (flashVer >= 9) {
$(this).each(function() {
settings = $.extend({
uploader: 'uploader.swf',
script: 'uploader.php',
folder: '',
height: 30,
width: 110,
cancelImg: 'cancel.png',
wmode: 'opaque',
scriptAccess: 'sameDomain',
fileDataName: 'Filedata',
displayData: 'percentage',
onInit: function() { },
onSelect: function() { },
onCheck: function() { },
onCancel: function() { },
onError: function() { },
onProgress: function() { },
onComplete: function() { }
}, options);
var pagePath = location.pathname;
pagePath = pagePath.split('/');
pagePath.pop();
pagePath = pagePath.join('/') + '/';
var data = '&pagepath=' + pagePath;
if (settings.buttonImg) data += '&buttonImg=' + escape(settings.buttonImg);
if (settings.buttonText) data += '&buttonText=' + escape(settings.buttonText);
if (settings.rollover) data += '&rollover=true';
data += '&script=' + settings.script;
data += '&folder=' + escape(settings.folder);
if (settings.scriptData) {
var scriptDataString = '';
for (var name in settings.scriptData) {
scriptDataString += '&' + name + '=' + settings.scriptData[name];
}
data += '&scriptData=' + escape(scriptDataString);
}
data += '&btnWidth=' + settings.width;
data += '&btnHeight=' + settings.height;
data += '&wmode=' + settings.wmode;
if (settings.hideButton) data += '&hideButton=true';
if (settings.fileDesc) data += '&fileDesc=' + settings.fileDesc + '&fileExt=' + settings.fileExt;
if (settings.multi) data += '&multi=true';
if (settings.auto) data += '&auto=true';
if (settings.sizeLimit) data += '&sizeLimit=' + settings.sizeLimit;
if (settings.simUploadLimit) data += '&simUploadLimit=' + settings.simUploadLimit;
if (settings.checkScript) data += '&checkScript=' + settings.checkScript;
if (settings.fileDataName) data += '&fileDataName=' + settings.fileDataName;
if ($.browser.msie) {
flashElement = '';
} else {
flashElement = '';
}
if (settings.onInit() !== false) {
$(this).css('display', 'none');
if ($.browser.msie) {
$(this).after('