	<script type="text/javascript" src="http://www.google.com/jsapi"></script>
	<script type="text/javascript">/*<![CDATA[*/ google.load("jquery", "1.3.2"); /*]]>*/</script>
	<script type="text/javascript">/*<![CDATA[*/ google.load("jqueryui", "1.7.2"); /*]]>*/</script>
	<script type="text/javascript">
		var $j = jQuery.noConflict();
	</script>
    {literal}
	<style type="text/css">		
    .upload-progress {
        border:1px solid #dfdfdf;
        width:500px;
        height:50px;
        color: #999999;
    }
    
    .upload-progress div.meter {
        width:0px;
        height:15px;
        font-size:1px;
        background-color: #333333;
        margin-left:10px;
        margin-top:1px;
        border:0px solid #dfdfdf;
    }
    
    .upload-progress div.readout {
        padding:5px 0px 0px 12px;
        font-family:"Courier New", Courier, monospace;
        font-size:10px;
        line-height:10px;
    }
    
    .upload-progress div.readout span {
        font-weight:bold;
        color: #666666;
    }
    </style>
    {/literal}
    <script type="text/javascript" src="{$baseurl}/js/jquery.uploadprogress.0.3.js"></script>
    {literal}
    <script type="text/javascript">
    jQuery(function () {
        jQuery('#upload_form').uploadProgress({ 
            progressURL:'{/literal}{$baseurl}/{literal}upload.php',
            displayFields : ['kb_uploaded','kb_average','est_sec'],
            start: function() { 
                jQuery('input[type=submit]',this).val('{/literal}{$lang229}{literal}');
            },
            success: function() { 
                jQuery('input[type=submit]',this).val('{/literal}{$lang230}{literal}');
                jQuery(this).get(0).reset();
                document.getElementById('smsg').style.display="block";
				$j('html, body').animate({ scrollTop: 0 }, 'slow');
            }
        });
    });
    </script>
    <script type="text/javascript">
    function checkuploadForm()
    {
        title = document.getElementById("dtitle").value;
        tags = document.getElementById("tags").value;
        desc = document.getElementById("desc").value;
        category = document.getElementById("category").value;
        doc_file = document.getElementById("doc_file").value;
		thumb = document.getElementById("thumb").value;
        
        if (title == "")
        {
            hideAllErrors();
            document.getElementById("titleError").style.display = "block";
            document.getElementById("dtitle").select();
            document.getElementById("dtitle").focus();
			$j('html, body').animate({ scrollTop: 0 }, 'slow');
            return false;
        } 
        else if (desc == "")
        {
            hideAllErrors();
            document.getElementById("descError").style.display = "block";
            document.getElementById("desc").select();
            document.getElementById("desc").focus();
			$j('html, body').animate({ scrollTop: 0 }, 'slow');
            return false;
        }
        else if (tags == "")
        {
            hideAllErrors();
            document.getElementById("tagsError").style.display = "block";
            document.getElementById("tags").select();
            document.getElementById("tags").focus();
			$j('html, body').animate({ scrollTop: 0 }, 'slow');
            return false;
        }
        else if (category == "0")
        {
            hideAllErrors();
            document.getElementById("categoryError").style.display = "block";
			$j('html, body').animate({ scrollTop: 0 }, 'slow');
            return false;
        }
        else if (doc_file == "")
        {
            hideAllErrors();
            document.getElementById("doc_fileError").style.display = "block";
			$j('html, body').animate({ scrollTop: 0 }, 'slow');
            return false;
        }
        else if (doc_file != "")
        {
            if (LimitAttach("upload_form", doc_file))
            {
                return true;
            }
            else
            return false;
        }
		
        
        return true;
    }
	
	function checkuploadForm2()
    {
		thumb = document.getElementById("thumb").value;
        
		if (thumb != "")
        {
            if (LimitAttach2("upload_form", thumb))
            {
                return true;
            }
            else
            return false;
        }		
        
        return true;
    }
    
    function LimitAttach(form, file)
    {
        extArray = new Array(".pdf", ".doc", ".xls", ".ppt");
        allowSubmit = false;
        if (!file) return;
        while (file.indexOf("\\") != -1)
        file = file.slice(file.indexOf("\\") + 1);
        ext = file.slice(file.lastIndexOf(".")).toLowerCase();
        for (var i = 0; i < extArray.length; i++) {
        if (extArray[i] == ext) { allowSubmit = true; break; }
        }
        if (allowSubmit) return true;
        else
		{
		hideAllErrors();
		document.getElementById("docError").style.display = "block";
		$j('html, body').animate({ scrollTop: 0 }, 'slow');
		}
        return false;
    }
	function LimitAttach2(form, file)
    {
        extArray = new Array(".gif", ".png", ".jpg");
        allowSubmit = false;
        if (!file) return;
        while (file.indexOf("\\") != -1)
        file = file.slice(file.indexOf("\\") + 1);
        ext = file.slice(file.lastIndexOf(".")).toLowerCase();
        for (var i = 0; i < extArray.length; i++) {
        if (extArray[i] == ext) { allowSubmit = true; break; }
        }
        if (allowSubmit) return true;
        else
		{
		hideAllErrors();
		document.getElementById("thumbError").style.display = "block";
		$j('html, body').animate({ scrollTop: 0 }, 'slow');
		}
        return false;
    }
     
    function hideAllErrors() 
    {
        document.getElementById("titleError").style.display = "none";
        document.getElementById("tagsError").style.display = "none";
        document.getElementById("descError").style.display = "none";
        document.getElementById("categoryError").style.display = "none";
        document.getElementById("doc_fileError").style.display = "none";
		document.getElementById("docError").style.display = "none";
		document.getElementById("thumbError").style.display = "none";
        document.getElementById("smsg").style.display = "none";
    }
    
    function uploadPreCheck() 
    {

        if (checkuploadForm() && checkuploadForm2())
        {		
            hideAllErrors();
            jQuery('#upload_form').submit();
        }
        else
        return false;
    }
    </script>
    {/literal}
    <div id="the_body">
        <div class="container_12">
            <div class="grid_12">    
                <div class="grid_12 alpha omega">
                	<div class="description">
                        <h1>{$lang42}</h1>
                   	</div>
                	<div id="content">                        
                        <div class="clear"></div>
                        <div id="smsg" class="success_box" style="display:none"><span>{$lang121}</span></div>
                        <div id="titleError" class="error_box" style="display:none"><span>{$lang459}</span></div>
                        <div id="tagsError" class="error_box" style="display:none"><span>{$lang460}</span></div>
                        <div id="descError" class="error_box" style="display:none"><span>{$lang461}</span></div>
                        <div id="categoryError" class="error_box" style="display:none"><span>{$lang462}</span></div>
                        <div id="doc_fileError" class="error_box" style="display:none"><span>{$lang469}</span></div>
                        <div id="docError" class="error_box" style="display:none"><span>{$lang258}</span></div>
                        <div id="thumbError" class="error_box" style="display:none"><span>{$lang312}</span></div>
						
                        {if $error2 ne "1"}
                        <div id="ck" align=center></div>
                        <div class="uploadkocont">
                            <form name="upload_form" id="upload_form" enctype="multipart/form-data" action="{$baseurl}/upload" method="POST">
                    		<input type="hidden" name="UPLOAD_IDENTIFIER" id="UPLOAD_IDENTIFIER" value="{$upload_id}" />
                            <table style="width: 700px;" class="form" cellpadding="10">
                                <tr>
                                    <td valign="top" style="padding-top: 12px; font-size:16px;">{$lang324}:</td>
                                    <td>
                                        <input type="text" name="dtitle" id="dtitle" value="{$dtitle}">
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top" style="padding-top: 22px; font-size:16px;">{$lang325}:</td>
                                    <td>
                                        <input type="text" name="tags" id="tags" value="{$tags}">
                                    </td>
                                </tr> 
                                <tr>
                                    <td valign="top" style="padding-top: 15px; font-size:16px; vertical-align:top;">{$lang113}:</td>
                                    <td style="padding-top: 15px;">
                                        <textarea name="desc" id="desc" rows="5" style="width:300px;">{$desc}</textarea>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top" style="padding-top: 22px; font-size:16px;">{$lang218}:</td>
                                    <td>
                                        <select id="category" name="category" style="width:45%; font-size:16px; padding:10px;">
                                        <option value="0">{$lang115}</option>
                                        {insert name=get_doc_categories assign=listdoccategories}
                                        {section name=o loop=$listdoccategories}
                                        <option value="{$listdoccategories[o].CATID}">{$listdoccategories[o].name}</option>
                                        {/section}
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top" style="padding-top: 22px; font-size:16px;">{$lang668}:</td>
                                    <td>
                                        <input name="doc_file" id="doc_file" type="file" style="font-size:16px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="padding-top: 22px;" colspan="2" align="center">
                                        {$lang662}: {$lang667}
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top" style="padding-top: 22px; font-size:16px;">{$lang636}:</td>
                                    <td>
                                        <input name="thumb" id="thumb" type="file" style="font-size:16px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="padding-top: 22px;" colspan="2" align="center">
                                        {$lang680}
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top" style="padding-top: 22px; font-size:16px;">{$lang329}:</td>
                                    <td>
                                        <select name="public" style="width:45%; font-size:16px; padding:10px;">
                                            <option value="1" {if $public ne "0"}selected="selected"{/if}>{$lang327}</option>
                                            <option value="0" {if $public eq "0"}selected="selected"{/if}>{$lang328}</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top" style="padding-top: 22px; font-size:16px;">{$lang330}:</td>
                                    <td>
                                        <select name="allowcomments" style="width:45%; font-size:16px; padding:10px;">
                                            <option value="1" {if $allowcomments ne "0"}selected="selected"{/if}>{$lang335}</option>
                                            <option value="0" {if $allowcomments eq "0"}selected="selected"{/if}>{$lang336}</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top" style="padding-top: 22px; font-size:16px;">{$lang331}:</td>
                                    <td>
                                        <select name="allowratings" style="width:45%; font-size:16px; padding:10px;">
                                            <option value="1" {if $allowratings ne "0"}selected="selected"{/if}>{$lang335}</option>
                                            <option value="0" {if $allowratings eq "0"}selected="selected"{/if}>{$lang336}</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top" style="padding-top: 22px; font-size:16px;">{$lang332}:</td>
                                    <td>
                                        <select name="allowembeds" style="width:45%; font-size:16px; padding:10px;">
                                            <option value="1" {if $allowembeds ne "0"}selected="selected"{/if}>{$lang335}</option>
                                            <option value="0" {if $allowembeds eq "0"}selected="selected"{/if}>{$lang336}</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top" style="padding-top: 22px; font-size:16px;">{$lang333}:</td>
                                    <td>
                                        <select name="allowdownloads" style="width:45%; font-size:16px; padding:10px;">
                                            <option value="1" {if $allowdownloads ne "0"}selected="selected"{/if}>{$lang335}</option>
                                            <option value="0" {if $allowdownloads eq "0"}selected="selected"{/if}>{$lang336}</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="padding-top: 22px;" colspan="2" align="center">
                                        <div class="upload-progress">
                                            <div class="readout">
                                                <span class="kb_uploaded">0</span> {$lang118} - <span class="kb_average">0</span> {$lang120} <br/><span class="est_sec">0</span> {$lang119}
                                            </div>
                                            <div class="meter"></div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="padding-top: 22px;" colspan="2" align="center">
                                        <input type="button" name="upload_button" id="upload_button" value="{$lang693}" onClick="uploadPreCheck();" class="btn" /><br />
                                    </td>
                                </tr>
                            </table>
                            <input type="hidden" value="0" name="mature" id="mature">
                            </form>  
                        </div>
                        {elseif $error ne ""}
                        <div class="error_box"><span>{$error}</span></div>
                        {/if} 
                        <div class="clear"></div>
                    </div>
                </div>
            </div>
            
            <div class="clear"></div>
        </div>
    
    </div>