var error=null;var unsupportedFileType="This file type is not supported yet!";var lastOutputFileType=null;var presets=new Array();presets.DeviceApple=[{value:"mp4-apple_iphone",text:"iPhone MPEG-4 Video (.mp4)",formattype:"VideoMP4"},{value:"mp4-apple_ipad",text:"iPad MPEG-4 Video (.mp4)",formattype:"VideoMP4"},{value:"mp4-apple_ipod_touch",text:"iPod Touch MPEG-4 Video (.mp4)",formattype:"VideoMP4"},{value:"mp4-apple_ipod",text:"iPod MPEG-4 Video (.mp4)",formattype:"VideoMP4"},{value:"m4v-apple_tv",text:"TV MPEG-4 Video (.m4v)",formattype:"VideoM4V"}];presets.DeviceHtc=[{value:"mp4-htc_touch_mpeg",text:"HTC Touch/Desire MPEG-4 (.mp4)",formattype:"VideoMP4"},{value:"mp4-htc_touch_h264",text:"HTC Touch/Desire H.264 (.mp4)",formattype:"VideoMP4"},{value:"mp4-htc_hero_mpeg",text:"HTC Hero/Dream MPEG-4 (.mp4)",formattype:"VideoMP4"},{value:"mp4-htc_hero_h264",text:"HTC Hero/Dream H.264 (.mp4)",formattype:"VideoMP4"}];presets.DeviceBlackberry=[{value:"mp4-blackberry_8s",text:"Pearl/Curve Movie (.mp4)",formattype:"VideoMP4"},{value:"mp4-blackberry_9s",text:"Bold/Storm Movie (.mp4)",formattype:"VideoMP4"}];presets.DeviceMobile=[{value:"3gp-mobile",text:"Mobile Phone 3GP Movie (.3gp)",formattype:"Video3GP"},{value:"mp4-mobile_nokia_e",text:"Nokia E-Series Mpeg-4 Movies (.mp4)",formattype:"VideoMP4"},{value:"mp4-mobile_nokia_n",text:"Nokia N-Series Mpeg-4 Movies (.mp4)",formattype:"VideoMP4"}];presets.DeviceSony=[{value:"mp4-sony_psp",text:"Sony Portable PlayStation (.mp4)",formattype:"VideoMP4"},{value:"mp4-sony_ps3",text:"Sony PlayStation 3 (.mp4)",formattype:"VideoMP4"},{value:"mp4-sony_walkman",text:"Sony WalkMan MPEG-4 Video (.mp4)",formattype:"VideoMP4"},{value:"wmv-sony_walkman",text:"Sony WalkMan WMV Video (.wmv)",formattype:"VideoWMV"}];presets.DeviceXbox=[{value:"mp4-xbox360",text:"XBox MPEG-4 Movie (.mp4)",formattype:"VideoMP4"},{value:"avi-xbox360",text:"XBox AVI Movie (.avi)",formattype:"VideoAVI"},{value:"wmv-xbox360",text:"XBox WMV Movie (.wmv)",formattype:"VideoWMV"}];presets.DeviceZune=[{value:"mp4-zune",text:"Zune MPEG-4 Movie (*.mp4)",formattype:"VideoMP4"},{value:"wmv-zune",text:"Zune WMV Movie (*.wmv)",formattype:"VideoWMV"}];presets.ImageICO=[{value:"image-ico-16x16",text:"Icon sizes up to 16x16",formattype:"ImageICO"},{value:"image-ico-24x24",text:"Icon sizes up to 24x24",formattype:"ImageICO"},{value:"image-ico-32x32",text:"Icon sizes up to 32x32",formattype:"ImageICO"},{value:"image-ico-48x48",text:"Icon sizes up to 48x48",formattype:"ImageICO"},{value:"image-ico-64x64",text:"Icon sizes up to 64x64",formattype:"ImageICO"},{value:"image-ico-128x128",text:"Icon sizes up to 128x128",formattype:"ImageICO"},{value:"image-ico-favicon-16",text:"Favicon 16x16 for website",formattype:"ImageICO"},{value:"image-ico-windows-xp",text:"Icon sizes for Windows XP",formattype:"ImageICO"}];function inArray(b,c){for(var a=0;a<c.length;a++){if(c[a]===b){return a+1}}return 0}function showError(){alert(error)}function setFilesType(e,b){if(!(e&&e.value&&e.value.length>0)){return false}var f=checkFileType(e,b);if(!f){e.value=null;showError();return false}if(b){if(typeof MF!="undefined"&&MF!=null){var g=MF.getSuffix();var a=$("#"+g);if(a.length>0){var d=a.find(".select-file-format");$(d.get(0)).val(f).attr("disabled","disabled").addClass("disabled");repopulateOutputFormat(f,d[1]);var c=$(d[1]);if(IsTemporaryUnavailable(f,lastOutputFileType)){AppendUnsupportedType(a.find(".dest-format-container"))}c.find("option").each(function(h,i){if(i.value===lastOutputFileType){i.setAttribute("selected","selected")}})}}}else{$("#originalFormat-input").val(f)}return true}function AppendUnsupportedType(b){var a='<div class="temp-unavailable">This type of conversion is temporary unavailable. Please choose another conversion type.</div>';var c=$(b);if(c.find(".temp-unavailable").length==0){c.append(a)}}function RemoveUnsupportedType(a){var b=$(a);b.find(".temp-unavailable").remove()}function IsTemporaryUnavailable(b,a){if(typeof tempUnavailable!="undefined"&&typeof tempUnavailable[b]!="undefined"&&inArray(a,tempUnavailable[b])){return true}return false}function ShowElement(a){if(a.nodeType){a.style.display="block"}else{if(typeof a==="string"){document.getElementById(a).style.display="block"}}}function ShowParentElement(a){if(a.nodeType){a.parentNode.style.display="block"}else{if(typeof a=="string"){document.getElementById(a).parentNode.style.display="block"}}}function HideElem(a){if(a.nodeType){a.style.display="none"}else{if(typeof a==="string"){document.getElementById(a).style.display="none"}}}function checkFileType(b,a){if(!(b&&b.value&&b.value.length>0)){return null}var c=getFileTypeByName(new String(b.value));if(a!==true&&typeof c=="string"&&!(c.indexOf("Image")>=0||c.indexOf("Document")>=0)){c=null;error=unsupportedFileType}return c}function getFileTypeByName(b){var a=null;var d=getExtension(b);if(d.length>0){try{var c=inArray(d,supportedFileExt);if(c==0||(c>0&&inArray(d,unsupportedInputExt))){a=null;submitFileExt(d)}else{a=fileTypeByExtention[d]}}catch(e){}}else{a=null}if(!a){error=unsupportedFileType}return a}function getExtension(b){b=b.toLowerCase();var a="";var c=b.lastIndexOf(".");if(c>=0){a=b.substring(c+1);if(a=="gz"&&c>=0){c=b.lastIndexOf(".tar.gz");if(c>=0){a=b.substring(c+1)}}}return a}function repopulateOutputFormat(d,b){if(inArray(d,unsupportedOriginalType)){error=unsupportedFileType;return}if(!b){return}var k=false;b.innerHTML="";var l;var j=new Object();var e=false;for(var g=0;g<destinationType[d].length;g++){var n=destinationType[d][g];var c,a;for(c in filetypeOptions){if(typeof filetypeOptions[c][n]!="undefined"||filetypeOptions[c][n]!=null){a=filetypeOptions[c][n];if(typeof j[c]=="undefined"||j[c]==null){j[c]=new Array()}k=IsTemporaryUnavailable(d,a.value);e=false;if(typeof defaultOutputType!="undefined"&&typeof defaultOutputType[d]!="undefined"&&defaultOutputType[d]==a.value){e=true}l=document.createElement("option");if(k){l.setAttribute("class","unavailable")}try{if(e){l.setAttribute("selected","selected")}}catch(f){}l.innerHTML=(a.ext&&a.ext.length>0?a.ext+" - ":"")+(a.text&&a.text.length>0?a.text:"");l.value=a.value;j[c].push(l)}}}if(d=="All"){l=document.createElement("option");l.innerHTML="- - - Supported Formats - - -";l.value="All";b.appendChild(l)}for(c in j){var m=document.createElement("optgroup");m.label=c;for(var h in j[c]){m.appendChild(j[c][h])}b.appendChild(m)}if(lastOutputFileType==null){lastOutputFileType=b.options[b.selectedIndex].value}}function submitFileExt(a){$.getJSON("./submitFileName.php?name="+a)};
