$(document).ready(function(){$('#link').focus(function(){if(this.value==this.defaultValue){this.select();}});$('#tlink').focus(function(){if(this.value==this.defaultValue){this.select();}});$('#link').focus();$('#submit').click(function(){setShortenedURL();});$('#link').keydown(function(e){var code=(e.keyCode?e.keyCode:e.which);switch(code){case 13:setShortenedURL();break;default:break;}});if(!$.browser.msie){$('#copyButton').flash({swf:'js/copy2clipboard.swf',width:'110',height:'42',wmode:'transparent',flashvars:{externalFunction:'copyToClipboard'}})
$('#copyButtonMini').flash({swf:'js/copy2clipboard.swf',width:'95',height:'30',wmode:'transparent',flashvars:{externalFunction:'copyToClipboard'}})}});function copyToClipboard(){if($.browser.msie){$('#msg').text('Tiny URL copied!');window.clipboardData.setData("Text",$('#tlink').attr('value'));}else{$('#msg').text('Tiny URL copied!');return $('#tlink').attr('value');}}
function setShortenedURL(){var link=$('#link').attr('value');$.get("api.php?link="+encodeURIComponent(link),function(data){$('#tlink').attr('value','');$('#inputType_result').slideUp('fast');$('#inputType_result').slideDown('fast',function(){$('#tlink').attr('value',data);$('#msg').text('Here is the Tiny URL below:');});if(data!='Error')
{$('#tlink').focus();$('#tlink').select();}
else
{$('#link').focus();$('#link').select();}});}