/*
 * JSMin
 * Javascript Compressor
 * http://www.crockford.com/
 * http://www.smallsharptools.com/
*/

(function()
{var kw=window.kw?window.kw:new Object();var xmlProgId=null;if(!kw.components)
kw.components=[];if(!kw.thunk)
kw.thunk=[];kw.get=function(id)
{for(var i=0;i<kw.components.length;i++)
if(kw.components[i].get_Id().toLowerCase()==id.toLowerCase())
return kw.components[i];return null;};var bind=function(source,event,context,handler)
{var wrapper=function(e){var x=handler.call(context,e,source);return x;};if(source.addEventListener)
{source.addEventListener(event,wrapper,false);}
else if(source.attachEvent)
{source.attachEvent("on"+event,wrapper);}
else
{var original=source["on"+event];if(original)
wrapper=function(e){original(e);wrapper(e,source);};source["on"+event]=wrapper;}};var getXmlReq=function()
{if(window.XMLHttpRequest)
{return new XMLHttpRequest();}
else
{if(xmlProgId)
{return new ActiveXObject(xmlProgId);}
else
{var progIds=["Msxml2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];var request=null;for(var i=0;i<progIds.length;i++)
{try
{var request=new ActiveXObject(progIds[i]);xmlProgId=progIds[i];return request;}
catch(ex)
{}}
return null;}}};var callHandlers=function(list,data)
{for(var i=0;i<list.length;i++)
{if(list[i](data)==false)
return false;}};var getFileName=function(fullPath)
{var pos=fullPath.lastIndexOf("\\");if(pos==-1)
pos=fullPath.lastIndexOf("/");return fullPath.substr(pos+1);};var getExtension=function(fileName)
{var pos=fileName.lastIndexOf(".");if(pos==-1)
return"";else
return fileName.substr(pos+1);};var applyEl=function(ids,func)
{if(ids)
{for(var i=0;i<ids.length;i++)
{var el=document.getElementById(ids[i]);if(el)
func(el);}}};var isWebKit=(navigator.userAgent.indexOf('AppleWebKit')!=-1);var hideIFrame=function(iframe)
{if(!isWebKit)
{iframe.style.display="none";}
else
{iframe.style.width=iframe.style.height="1px";iframe.style.position="absolute";iframe.style.top="-10000px";iframe.style.left="-10000px";}};kw.UploadConnector=function(id,uploadId,formId,progressDisplayId,progressUrl,uploadUrl,autoUploadOnSubmit,autoSubmitAfterUpload,hasPostProcessStep,hideDuringUploadElements,showDuringUploadElements,confirmNavigateDuringUploadMessage)
{var context=this;var form=null;var oldAction=null;var target=null;var targetCount=0;var progressDisplay=null;var beforeHandlers=[];var startedHandlers=[];var endedHandlers=[];var fileCompleteHandlers=[];var currentFileIndex=0;var currentFileName=null;var submittedElement=null;var wasCancelled=false;var isUploading=false;this.get_Id=function(){return id;};this.get_IsUploading=function(){return isUploading;};this.add_OnBeforeUpload=function(handler){beforeHandlers.push(handler);};this.add_OnUploadStarted=function(handler){startedHandlers.push(handler);};this.add_OnUploadFileComplete=function(handler){fileCompleteHandlers.push(handler);};this.add_OnUploadEnded=function(handler){endedHandlers.push(handler);};this.submit=function(shouldValidate,isInternal)
{if(shouldValidate!=false)
{if(window.Page_ClientValidate)
if(Page_ClientValidate()==false)
return false;if(callHandlers(beforeHandlers)==false)
return false;}
isUploading=true;wasCancelled=false;var fileCount=0;var firstFile="";var inputs=form.getElementsByTagName("input");for(var i=0;i<inputs.length;i++)
{var value=inputs[i].value;if(inputs[i].type.toLowerCase()=="file"&&value!=null&&value.length>0)
{fileCount++;if(fileCount==1)
firstFile=getFileName(value);}}
progressDisplay.start({state:"Initializing",currentFileName:currentFileName=firstFile,currentFileIndex:currentFileIndex=1,fileCount:fileCount,fileCountText:fileCount+(fileCount==1?" file":" files"),percentComplete:0,percentCompleteText:"0 %"});applyEl(hideDuringUploadElements,function(el){el.style.display="none";});applyEl(showDuringUploadElements,function(el){el.style.display="";});if(!autoUploadOnSubmit)
{retargetForm();form.submit();}
else if(!isInternal)
{form.submit();}
callHandlers(startedHandlers,{fileCount:fileCount});};this.cancel=function()
{if(!wasCancelled)
{isUploading=false;wasCancelled=true;target.src="about:blank";target.parentNode.removeChild(target);if(autoUploadOnSubmit)
retargetForm();}};this.executeAfterUploadPostBack=function()
{var inputs=form.getElementsByTagName("input");for(var i=inputs.length-1;i--;i>=0)
{var el=inputs[i];var v=el.value;if(el.type.toLowerCase()=="file"&&v!=null&&v.length>0)
el.disabled=true;}
var uploadExecution=document.createElement("input");uploadExecution.type="hidden";uploadExecution.id=uploadExecution.name="kw_uploadExecution";uploadExecution.value=(wasCancelled?"Cancelled":"Attempted");form.appendChild(uploadExecution);if(submittedElement==null)
form.submit();else
submittedElement.click();};var onReady=function()
{if(progressDisplayId&&progressDisplayId.length>0)
progressDisplay=kw.get(progressDisplayId);var progressLocation=progressUrl+"?uploadId="+uploadId;if(progressDisplay==null)
progressDisplay=new kw.ProgressDisplay(id+"_progress",formId,progressLocation);else
progressDisplay.set_ProgressUrl(progressLocation);progressDisplay.add_OnProgressUpdate(function(data){onProgressUpdate.call(this,data);});if(autoUploadOnSubmit)
{retargetForm();var originalOnSubmit=form.onsubmit;form.onsubmit=function()
{var ret;if(originalOnSubmit)
ret=originalOnSubmit();if(ret!=false)
{ret=context.submit.call(context,true,true);if(ret==false)
return false;}
else
{return false;}};var inputs=form.getElementsByTagName("input");for(var i=0;i<inputs.length;i++)
{var input=inputs[i];switch(input.type.toLowerCase())
{case"submit":case"image":bind(input,"click",this,onElementSubmitted);break;}}
var buttons=form.getElementsByTagName("button");for(var i=0;i<buttons.length;i++)
{var button=buttons[i];if(button.type.toLowerCase()=="submit")
bind(button,"click",this,onElementSubmitted);}
if(window.__doPostBack&&!(window.Sys&&Sys.Application))
{__doPostBack=function(eventTarget,eventArgument)
{theForm.__EVENTTARGET.value=eventTarget;theForm.__EVENTARGUMENT.value=eventArgument;if(!theForm.onsubmit||(theForm.onsubmit()!=false))
theForm.submit();};}}
if(confirmNavigateDuringUploadMessage!=null&&confirmNavigateDuringUploadMessage.length>0)
{bind(window,"beforeunload",this,onBeforeUnload);}};var onBeforeUnload=function(e)
{if(isUploading&&!progressDisplay.get_IsComplete())
{e.returnValue=confirmNavigateDuringUploadMessage;return confirmNavigateDuringUploadMessage;}};var onElementSubmitted=function(e,source)
{if(!isUploading&&!wasCancelled)
submittedElement=source;};var onProgressUpdate=function(data)
{(function()
{if(data.connectionTimeout||wasCancelled||data.state=="Complete"||data.state=="Terminated")
{applyEl(showDuringUploadElements,function(el){el.style.display="none";});if(!hasPostProcessStep||data.state!="Complete")
{isUploading=false;progressDisplay.set_IsComplete(true);}
else
{progressDisplay.set_IsInSubmit(true);}
callHandlers(fileCompleteHandlers,{fileName:currentFileName});callHandlers(endedHandlers,{fileCount:data.fileCount,isSuccessful:(data.state=="Complete"),wasCancelled:wasCancelled});form.target="_self";form.action=oldAction;if(autoSubmitAfterUpload)
{if(autoUploadOnSubmit)
form.onsubmit=null;this.executeAfterUploadPostBack();}
else
{wasCancelled=false;}}
else if(progressDisplay.get_IsInitializing()&&data.state!="Initializing")
{progressDisplay.set_IsInitializing(false);}
else if(data.state=="PostProcessingComplete"||data.state=="PostProcessingTerminated")
{isUploading=false;progressDisplay.set_IsComplete(true);}
else if(data.state=="ReceivingData")
{if(currentFileIndex!=data.currentFileIndex)
{callHandlers(fileCompleteHandlers,{fileName:currentFileName});}
currentFileIndex=data.currentFileIndex;currentFileName=data.currentFileName;}}).call(context,data);};var retargetForm=function()
{if(oldAction==null)
oldAction=form.action;form.action=uploadUrl+"?handlerType=upload&uploadId="+uploadId;var targetId=formId+"_target"+targetCount++;target=addIFrame(targetId);form.target=targetId;};var addIFrame=function(id)
{var iframe=addIFrameInternal(id,"iframe");if(window.frames[id]==undefined||window.frames[id].name!=id)
{document.body.removeChild(iframe);iframe=addIFrameInternal(id,"<iframe name=\""+id+"\" />");}
return iframe;};var addIFrameInternal=function(id,el)
{var iframe=document.createElement(el);iframe.name=iframe.id=id;hideIFrame(iframe);document.body.appendChild(iframe);return iframe;};form=document.getElementById(formId);form.enctype=form.encoding="multipart/form-data";bind(window,"load",this,onReady);kw.components.push(this);};kw.ProgressDisplay=function(id,progressUrl,interval)
{var req=null;var isInitializing=false;var isComplete=false;var isInSubmit=false;var updateHandlers=[];var fields=[];var retryCount=0;this.get_Id=function(){return id;};this.add_OnProgressUpdate=function(handler){updateHandlers.push(handler);};this.add_Field=function(field){fields.push(field);};this.get_IsInitializing=function(){return isInitializing;};this.set_IsInitializing=function(value){isInitializing=value;};this.get_IsComplete=function(){return isComplete;};this.set_IsComplete=function(value){isComplete=value;};this.get_IsInSubmit=function(){return isInSubmit;};this.set_IsInSubmit=function(value){isInSubmit=value;};this.set_ProgressUrl=function(value){progressUrl=value;};this.start=function(initialData)
{isComplete=false;isInitializing=true;if(initialData!=null)
onProgressUpdate(initialData);var container=document.getElementById(id);if(container&&container.style.display=="none")
container.style.display="";invokeProgressRequest();};var onProgressUpdate=function(data)
{callHandlers(updateHandlers,data);for(var i=0;i<fields.length;i++)
{var f=fields[i];var v=data[f.key];if(v)
{if(f.isProgressBar)
f.el.style.width=v+"%";else
{f.el.innerHTML=v;}}}};var onProgressReceived=function(data)
{if(data)
onProgressUpdate(data);if((data==null||isInitializing)&&retryCount++==10)
{isComplete=true;onProgressUpdate({connectionTimeout:true});}
if(!isComplete)
invokeProgressRequest();};var onProgressRequestReadyStateChange=function()
{if(req.readyState==4)
{var valid=false;try
{valid=(req.status==200&&req.responseText);}
catch(ex)
{valid=false;}
var data=null;if(valid&&req.responseText.length>0)
data=eval("("+req.responseText+")");onProgressReceived(data);}};var invokeProgressRequest=function()
{var context=this;window.setTimeout(function()
{if(isInSubmit&&isWebKit)
{var progressFrameId=id+"_progress";var progressFrame=window.frames[progressFrameId];if(!progressFrame)
{var iframe=document.createElement("iframe");iframe.name=iframe.id=progressFrameId;hideIFrame(iframe);document.body.appendChild(iframe);progressFrame=window.frames[progressFrameId];}
var url=progressUrl+"&format=script";kw.thunk[url]=function(data){onProgressReceived.call(context,data);};progressFrame.location=url;}
else
{req=getXmlReq();req.open("GET",progressUrl);req.onreadystatechange=function(){onProgressRequestReadyStateChange.call(context);};req.send("");}},interval);};if(!(typeof interval=='number'&&isFinite(interval)))
interval=1000;kw.components.push(this);};kw.ProgressDisplayElement=function(id,progressDisplayId,key,isProgressBar)
{var onReady=function()
{kw.get(progressDisplayId).add_Field(this);this.el=document.getElementById(id);};this.id=id;this.key=key;this.isProgressBar=isProgressBar==true;bind(window,"load",this,onReady);};kw.FileSelector=function(id,dlContainerId,ulContainerId,maxFiles)
{var fileAddedHandlers=[];var fileRemovedHandlers=[];var mode="html";var impl;this.get_Id=function(){return id;};this.add_OnFileAdded=function(handler){fileAddedHandlers.push(handler);};this.add_OnFileRemoved=function(handler){fileRemovedHandlers.push(handler);};this.get_Files=function()
{return impl.get_Files();};this.remove_File=function(id)
{return impl.remove_File(id);};this.clear=function()
{return impl.clear();};this.hide_File=function(id)
{impl.hide_File(id);};this.OnFileAdded=function(file)
{callHandlers(fileAddedHandlers,file);};this.OnFileRemoved=function(file)
{callHandlers(fileRemovedHandlers,file);};if(mode=="html")
impl=new htmlFileSelector(this,id,dlContainerId,ulContainerId,maxFiles);kw.components.push(this);};var htmlFileSelector=function(wrapper,id,dlContainerId,ulContainerId,maxFiles)
{var container;var uploadBoxes=[];var uploadBoxIdCounter=0;var changeFired=[];var mode="dl";var ulMode="overlay";var dlTemplateInput;var ulOverlay;this.get_Files=function()
{var files=[];for(var i=0;i<uploadBoxes.length;i++)
{if(uploadBoxes[i].value.length>0)
files.push(getFileFromInput(uploadBoxes[i]));}
return files;};this.remove_File=function(id)
{removeInput(id);if(uploadBoxes[uploadBoxes.length-1].value.length>0&&uploadBoxes.length<maxFiles)
addUploadBox();if(mode=="ul")
{if(ulMode=="overlay")
ulOverlay.style.display="";container.style.display="inline";}};this.clear=function()
{for(var i=uploadBoxes.length-1;i>=0;i--)
removeInput(uploadBoxes[i].id);addUploadBox();};this.hide_File=function(id)
{var el;for(var i=0;i<uploadBoxes.length;i++)
{if(uploadBoxes[i].id==id)
{el=uploadBoxes[i];break;}}
el.style.display="none";};var attachEvents=function(el)
{bind(el,"change",this,onChange);bind(el,"keydown",this,function(){return false;});bind(el,"paste",this,function(){return false;});};var addUploadBox=function()
{var newBox=document.createElement("input");newBox.type="file"
newBox.name=newBox.id=id+"_html_file"+uploadBoxIdCounter++;attachEvents(newBox);if(mode=="dl")
{newBox.className=dlTemplateInput.className;newBox.style.cssText=dlTemplateInput.style.cssText;container.appendChild(newBox,uploadBoxes[0]);}
else if(mode=="ul")
{if(ulMode=="overlay")
{newBox.style.position="absolute";newBox.style.left="-1000px";container.appendChild(newBox,uploadBoxes[0]);}
else if(ulMode=="clip")
{newBox.style.cssText="position:absolute;top:-5px;opacity:.0;filter:alpha(opacity=0);-moz-opacity:.0;";container.appendChild(newBox,uploadBoxes[0]);var maxSize=container.offsetWidth>container.offsetHeight?container.offsetWidth+8:container.offsetHeight+8;newBox.style.fontSize=maxSize+"px";newBox.style.clip="rect(5px, "+(newBox.offsetWidth-5)+"px, "+(container.offsetHeight+10)+"px, "+(newBox.offsetWidth-container.offsetWidth-5)+"px)";newBox.style.left=container.offsetWidth+5-newBox.offsetWidth+"px";}}
uploadBoxes.push(newBox);return newBox;};var getFileFromInput=function(input)
{var fileName=getFileName(input.value);var file={id:input.id,fileName:fileName,extension:getExtension(fileName),input:input};return file;};var removeInput=function(id)
{var removeEl=null;for(var i=0;i<uploadBoxes.length;i++)
{if(uploadBoxes[i].id==id)
{removeEl=uploadBoxes[i];uploadBoxes.splice(i,1);break;}}
wrapper.OnFileRemoved(getFileFromInput(removeEl));container.removeChild(removeEl);};var onChange=function(e,source)
{if(source.value&&source.value.length>0)
{wrapper.OnFileAdded(getFileFromInput(source));if(uploadBoxes[uploadBoxes.length-1].value.length>0&&(maxFiles==-1||uploadBoxes.length<maxFiles))
{addUploadBox();}
else if(mode=="ul")
{ulOverlay.style.display="none";container.style.display="none";}
if(mode=="ul")
source.style.display="none";}};var onOverlayClick=function(e)
{uploadBoxes[uploadBoxes.length-1].click();};if(ulContainerId)
{var ua=navigator.userAgent.toLowerCase();if(/msie\s(\d)/.test(ua))
{var version=0;try
{version=parseInt(RegExp.$1);}
catch(ex)
{version=0;}
if(version>=6)
{mode="ul";ulMode="clip";}
else
{mode="dl";}}
else if(ua.indexOf("gecko/")!=-1)
{mode="ul";ulMode="clip";}
else if(ua.indexOf("chrome")!=-1)
{mode="ul";ulMode="overlay";}
else if(ua.indexOf("applewebkit/")!=-1)
{var version=0;try
{version=parseInt(/version\/(\d+)/.exec(ua)[1]);}
catch(ex)
{version=0;}
if(version>=2)
{mode="ul";ulMode="overlay";}
else
{mode="dl";}}
else
{mode="dl";}}
if(mode=="dl")
{var firstBox=null;var inputs=document.getElementById(id).getElementsByTagName("input");for(var i=0;i<inputs.length;i++)
{if(inputs[i].type.toLowerCase()=="file")
{firstBox=inputs[i];break;}}
dlTemplateInput=firstBox.cloneNode(true);firstBox.name=firstBox.id=id+"_html_file"+uploadBoxIdCounter++;attachEvents(firstBox);uploadBoxes.push(firstBox);container=document.getElementById(dlContainerId);}
else if(mode=="ul")
{document.getElementById(dlContainerId).style.display="none";container=document.getElementById(ulContainerId);container.style.display="inline";if(ulMode=="overlay")
{ulOverlay=document.createElement("div");ulOverlay.style.cssText="position:absolute;top:-3px;left:-3px;cursor:default;opacity:0;filter:alpha(opacity=0);-moz-opacity:0;background-color:#fff;";ulOverlay.style.width=container.offsetWidth+6+"px";ulOverlay.style.height=container.offsetHeight+6+"px";bind(ulOverlay,"click",this,onOverlayClick);container.appendChild(ulOverlay);}
addUploadBox();}};kw.FileList=function(id,fileSelectorId,uploadConnectorId,templateId,validExtensions,invalidExtensionMessage)
{var context=this;var fileSelector=null;var template=null;var files=[];var fileAddedHandlers=[];var fileRemovedHandlers=[];this.get_Id=function(){return id;};this.add_OnFileAdded=function(handler){fileAddedHandlers.push(handler);};this.add_OnFileRemoved=function(handler){fileRemovedHandlers.push(handler);};this.get_Files=function()
{var outputFiles=[];for(var i=0;i<files.length;i++)
outputFiles.push(files[i]);return outputFiles;};this.remove_File=function(id)
{var file;for(var i=0;i<files.length;i++)
{if(files[i].id==id)
{file=files[i];files.splice(i,1);break;}}
fileSelector.remove_File(file.id);file.itemEl.parentNode.removeChild(file.itemEl);};this.clear=function()
{for(var i=0;i<files.length;i++)
files[i].itemEl.parentNode.removeChild(files[i].itemEl);fileSelector.clear();files=[];};var onFileAdded=function(data)
{var newFile=createFile(data,template.cloneNode(true));fileSelector.hide_File(newFile.id);var newItem=newFile.itemEl;newItem.file=newFile;newItem.style.display="";var spans=newItem.getElementsByTagName("span");for(var i=0;i<spans.length;i++)
{if(spans[i].className.indexOf("kw_fileListFileName")!=-1)
{spans[i].innerHTML=newFile.fileName;}
else if(spans[i].className.indexOf("kw_fileListValidationMessage")!=-1)
{if(!newFile.isValidExtension)
{spans[i].innerHTML=invalidExtensionMessage;spans[i].style.display="";}}}
var links=newItem.getElementsByTagName("a");for(var i=0;i<links.length;i++)
if(links[i].className.indexOf("kw_removeLink")!=-1)
bind(links[i],"click",this,onFileRemoveCommand);var all=newItem.getElementsByTagName("*");for(var i=0;i<all.length;i++)
{if(all[i].id)
all[i].id=newFile.id+"_"+all[i].id;if(all[i].name)
all[i].name=newFile.id+"_"+all[i].name;}
var lastFile=(files.length>0?files[files.length-1].itemEl:template);lastFile.parentNode.insertBefore(newItem,lastFile.nextSibling);files.push(newFile);callHandlers(fileAddedHandlers,newFile);};var onFileRemoveCommand=function(e,source)
{(function(source)
{while(!source.file)
source=source.parentNode;this.remove_File(source.file.id);callHandlers(fileRemovedHandlers,source.file);}).call(context,source);};var onBeforeUpload=function()
{for(var i=0;i<files.length;i++)
if(!files[i].isValidExtension)
return false;return true;};var onReady=function()
{fileSelector=kw.get(fileSelectorId);fileSelector.add_OnFileAdded(onFileAdded);if(uploadConnectorId&&validExtensions&&validExtensions.length>0)
kw.get(uploadConnectorId).add_OnBeforeUpload(onBeforeUpload);};var isValidExtension=function(fileName)
{if(!validExtensions||validExtensions.length==0)
{return true;}
else
{for(var i=0;i<validExtensions.length;i++)
{var ext=validExtensions[i];if(fileName.length>ext.length&&fileName.substr(fileName.length-ext.length).toLowerCase()==ext.toLowerCase())
return true;}
return false;}};var createFile=function(data,el)
{var file={id:data.id,fileName:data.fileName,extension:data.extension,isValidExtension:isValidExtension(data.fileName),itemEl:el,getElementById:function(id){return document.getElementById(this.id+"_"+id);}};return file;};template=document.getElementById(templateId);bind(window,"load",this,onReady);kw.components.push(this);};kw.SlickUpload=function(id,fileSelectorId,fileListId,progressDisplayId,uploadConnectorId)
{this.get_Id=function(){return id;};this.add_OnFileAdded=function(handler){getFileObject().add_OnFileAdded(handler);};this.add_OnFileRemoved=function(handler){getFileObject().add_OnFileRemoved(handler);};this.get_Files=function(){return getFileObject().get_Files();};this.remove_File=function(id){getFileObject().remove_File(id);};this.clear=function(){getFileObject().clear();};this.add_OnProgressUpdate=function(handler){kw.get(progressDisplayId).add_OnProgressUpdate(handler);};this.add_OnBeforeUpload=function(handler){kw.get(uploadConnectorId).add_OnBeforeUpload(handler);};this.add_OnUploadStarted=function(handler){kw.get(uploadConnectorId).add_OnUploadStarted(handler);};this.add_OnUploadFileComplete=function(handler){kw.get(uploadConnectorId).add_OnUploadFileComplete(handler);};this.add_OnUploadEnded=function(handler){kw.get(uploadConnectorId).add_OnUploadEnded(handler);};this.submit=function(shouldValidate){return kw.get(uploadConnectorId).submit(shouldValidate);};this.cancel=function(){kw.get(uploadConnectorId).cancel();};this.executeAfterUploadPostBack=function(){kw.get(uploadConnectorId).executeAfterUploadPostBack();};var getFileObject=function()
{if(fileListId)
return kw.get(fileListId);else
return kw.get(fileSelectorId);};kw.components.push(this);};window.kw=kw;})();
