function checkForm(){var url;url=document.getElementById('url').value;if(url==''){document.getElementById('url').focus();alert('Fill your URL.');return false;}if(document.getElementById('use_captcha').value=='1'&&document.getElementById('captcha').value==''){document.getElementById('captcha').focus();alert('Fill verification image.');return false;}return true;};copyTimer=false;copyTimer2=false;copyTimer2Count=0;function copyField(field,type,id){var urlSwf='./others/clipboard.swf';window.status='Copied text to clipboard';var flashcopier='flashcopier';var divholder=document.createElement('div');divholder.id=flashcopier;document.body.appendChild(divholder);divholder.innerHTML='';var divinfo='<embed src="'+urlSwf+'" FlashVars="clipboard='+escape(field.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';divholder.innerHTML=divinfo;copyTimer2Count=0;if(copyTimer!=false){clearTimeout(copyTimer);}if(copyTimer2!=false){clearTimeout(copyTimer2);}var idList,i,j;idList=document.getElementById('id-list').value;idList=idList.split(',');idListMax=idList.length-1;for(i=0;i<idListMax;i++){for(j=1;j<=3;j++){document.getElementById('link-box-'+j+'-'+idList[i]).style.backgroundColor='rgb(255, 255, 255)';document.getElementById('note-'+j+'-'+idList[i]).innerHTML='';};};document.getElementById('link-box-'+type+'-'+id).style.backgroundColor='rgb(255, 0, 0)';document.getElementById('note-'+type+'-'+id).innerHTML=document.getElementById('copied-message').innerHTML;copyTimer=window.setTimeout('copyFieldTimer("'+id+'");',1800);copyTimer2=window.setTimeout('copyFieldTimer2('+type+',"'+id+'");',1);return false;};function copyFieldTimer(id){document.getElementById('note-1-'+id).innerHTML='';document.getElementById('note-2-'+id).innerHTML='';document.getElementById('note-3-'+id).innerHTML='';clearTimeout(copyTimer);copyTimer=false;};function copyFieldTimer2(type,id){if(copyTimer2Count<255){document.getElementById('link-box-'+type+'-'+id).style.backgroundColor='rgb(255, '+copyTimer2Count+', '+copyTimer2Count+')';copyTimer2Count+=4;if(copyTimer2Count>255){copyTimer2Count=255;}copyTimer2=window.setTimeout('copyFieldTimer2('+type+',"'+id+'");',2);}else{document.getElementById('link-box-1-'+id).style.backgroundColor='rgb(255, 255, 255)';document.getElementById('link-box-2-'+id).style.backgroundColor='rgb(255, 255, 255)';document.getElementById('link-box-3-'+id).style.backgroundColor='rgb(255, 255, 255)';clearTimeout(copyTimer2);copyTimer2=false;copyTimer2Count=0;}};function highlighturlFieldOff(obj){obj.className='urlfield';};function highlighturlFieldOn(obj){obj.className='urlfield-highlight';};function highlightFieldOff(obj){obj.className='field';};function highlightFieldOn(obj){obj.className='field-highlight';};function myRefresh(url){document.location=url;};function refCaptcha(){document.getElementById('captcha-image').src='rewrite-captcha.gif?'+Math.random();};isBulk=0;function switchBulk(){var objUrl,tempUrl;objUrl=document.getElementById('div-url');tempUrl=document.getElementById('url').value;if(isBulk==0){objUrl.innerHTML='Your URLs <span style="font-size:0.8em">( Max '+document.getElementById('max-bulk').value+' URLs )</span><br /><textarea name="url" id="url" value="" rows="10" cols="86" class="field" title="Enter your URL here" onmouseout="highlightFieldOff(this)" onmouseover="highlightFieldOn(this)" wrap="off"></textarea><br /><br />';document.getElementById('a-bulk').innerHTML='Single URL';document.getElementById('bulk').value=1;isBulk=1;}else{objUrl.innerHTML='Your URL<br /><input type="text" name="url" id="url" value="http://" maxlength="1000" size="40" class="urlfield" title="Enter your URL here" onmouseout="highlighturlFieldOff(this)" onmouseover="highlighturlFieldOn(this)" /><br /><br />';document.getElementById('a-bulk').innerHTML='Multiple URL Mode';document.getElementById('bulk').value=0;isBulk=0;}document.getElementById('url').value=tempUrl;};function ajax_init(){xmlHttp1=getXmlHttpRequest();if(xmlHttp1==null){return;}else{if(document.getElementById('div-action')){document.getElementById('div-action').innerHTML='<input type="button" value="Short ME" class="button" id="btn-go" onclick="ajax_go()" />';}}};function ajax_go(){var _advOpt,_checkForm,_useCaptcha;_checkForm=checkForm();if(_checkForm==false){return false;}_advOpt=document.getElementById('advanced-opt').value;_useCaptcha=document.getElementById('use_captcha').value;document.getElementById('url').disabled=true;if(_useCaptcha==1){document.getElementById('captcha').disabled=true;}document.getElementById('btn-go').disabled=true;url='./ajax/ajax_short.php?';url=url+"sid="+Math.random();post_data='go=1';post_data=post_data+'&url='+escape(document.getElementById('url').value);if(_useCaptcha==1){post_data=post_data+'&captcha='+escape(document.getElementById('captcha').value);}if(_advOpt==1){post_data=post_data+'&maxage='+escape(document.getElementById('maxage').value);post_data=post_data+'&maxage_opt='+escape(document.getElementById('maxage_opt').value);post_data=post_data+'&maxage_switch='+((document.getElementById('maxage_switch').checked)?1:0);post_data=post_data+'&maxvisits='+escape(document.getElementById('maxvisits').value);post_data=post_data+'&maxvisits_switch='+((document.getElementById('maxvisits_switch').checked)?1:0);}xmlHttp1.open('POST',url,true);xmlHttp1.setRequestHeader('Content-type','application/x-www-form-urlencoded');xmlHttp1.setRequestHeader('Cookie','PHPSESSID='+document.getElementById('sessid').value);xmlHttp1.onreadystatechange=function(){if(xmlHttp1.readyState==4&&xmlHttp1.status==200){document.getElementById('url').disabled=false;if(_useCaptcha==1){document.getElementById('captcha').disabled=false;}document.getElementById('btn-go').disabled=false;document.getElementById('ajax-result').innerHTML=xmlHttp1.responseText;}else if(xmlHttp1.readyState>0&&xmlHttp1.readyState<4){document.getElementById('ajax-result').innerHTML='Please wait...';}};xmlHttp1.send(post_data);};function getXmlHttpRequest(){var xmlHttp=null;try{xmlHttp=new XMLHttpRequest();}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(E){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}return xmlHttp;}