


function checkinputbox() {

var box=document.getElementById('shrinkurl');

if(box.value=='HTTP://LONG URL') {
box.value='';
}

}


function checkinputboxsai() {

var box=document.getElementById('shrinkurlaudio');

if(box.value=='HTTP://LONG URL - OPTIONAL') {
box.value='';
}

}

function hideflashlayer() {
HideContent('theurlflash');
HideContent('flash1');
HideContent('flash2');

HideContentvis('theurlflash');
HideContentvis('flash1');
HideContentvis('flash2');

document.getElementById('shrinkurl').focus();


document.getElementById('inputadvanced').style.display="block";

}

function countit(what){



formcontent=what.form.charcount.value
what.form.displaycount.value=formcontent.length
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}


function submitenter(myfield,e,layer)
{

//alert('pasted');

if(layer=='undefined') {return false;}

var shrinkurl=document.getElementById(layer);


try {
var shrinkurlchar=document.getElementById(layer).value;
var charcount=shrinkurlchar.length;

//if(charcount==0 || navigator.appName == "Microsoft Internet Explorer") {
//var shrinkurlchar=window.clipboardData.getData('Text');
//var charcount=shrinkurlchar.length
//}

//alert(charcount);

if(charcount>45) {
shrinkurl.style.fontSize="20px";
}
if(charcount>75) {
shrinkurl.style.fontSize="16px";
}
if(charcount>100) {
shrinkurl.style.fontSize="14px";
}
if(charcount>150) {
shrinkurl.style.fontSize="12px";
}
if(charcount>200) {
shrinkurl.style.fontSize="11px";
}
if(charcount>260) {
shrinkurl.style.fontSize="10px";
}
if(charcount<45) {
shrinkurl.style.fontSize="24px";
}

if(myfield!='x') {
setTimeout("submitenter('x','')", 100 );
} else {
shrinkurl.value=trim(shrinkurl.value);
var text=shrinkurl.value;
shrinkurl.value=text.replace(/(\r|\n)/, "");
}


var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   shrinkurl();
   return false;
   }
else
   return true;
   
   
} catch(err) {

}   
   
}

function displayuploadimage() {
document.getElementById('inputadvanced')
}

function cancelupload() {
document.getElementById('theuploadform').style.display="none";
document.getElementById('urlinput').style.display="block";
document.getElementById('shrinkbuttonbig').style.display="block";
}

function shrinkurl_addaudio() {

document.getElementById('shrinkbuttonbig').style.display="none";
document.getElementById('urlinput').style.display="none";
document.getElementById('submitimagebutton').style.display="none";
document.getElementById('liketoaddaudio_url').style.display="block";

}

function shrinkurl_addaudio_yes() {

document.getElementById('shrinkurlaudio').value=document.getElementById('shrinkurl').value;
loadaudioapp();
}


function checksubmitimage() {

if(document.getElementById('loaded').style.display!="block") {
submitimage();
}
}


function submitimage() {

var formlayer=document.getElementById('theuploadform');

if(formlayer.style.display=="none"  || formlayer.style.display=="") {
formlayer.style.display="block";


document.getElementById('cancelupload').style.display="block";

document.getElementById('urlinput').style.display="none";
document.getElementById('shrinkbuttonbig').style.display="none";

document.getElementById('urlinput_inputboxsai').style.display="none";
document.getElementById('shrinkurlaudio').value="HTTP://LONG URL - OPTIONAL";


if(document.getElementById('loaded').style.display=="block" || document.getElementById('shrinkbuttonbigaudio').style.display=="block") {
document.getElementById('submitimagebutton').style.display="none";
document.getElementById('cancelupload').style.display="none";
}


} else {



document.getElementById('submitimagebutton').style.display="none";
document.getElementById('cancelupload').style.display="none";
document.getElementById('liketoaddaudio').style.display="block";


	


}

}

function liketoaddaudio_submitimage() {

    var e = document.getElementById('shrinkjaxoutputLIST'); 
	    e.innerHTML = "<center><p style='margin-top:50px; font-family:arial,helvetica; font-size:16px; font-weight:bold;'>UPLOADING IMAGE...</p><img src='http://ity.im/ityimages/ajaxloading.gif'></center>";
	

document.myForm.submit();



}





function addcategorymenu() {

var formlayer=document.getElementById('categoriesmenu');

if(formlayer.style.display=="none"  || formlayer.style.display=="") {
formlayer.style.display="block";

ajax_categorymenu();

} else {
formlayer.style.display="none";
}

}

function display(id) {

var layer=document.getElementById(id);

if(layer.style.display=="none"  || layer.style.display=="") {
layer.style.display="block";

} else {
layer.style.display="none";
}


}

function cancelrecording() {

document.getElementById("audiojava").style.visibility="hidden";
document.getElementById('liketoaddaudio_url').style.display="none";
document.getElementById('shrinkbuttonbigaudio').style.display="none";


//document.getElementById('urlinputarea').style.display="none";


  //document.getElementById("urlinputarea").style.zIndex="-1";
  //document.getElementById("audioappcontainer").style.zIndex="-1";
  

 //document.getElementById("audiojava").style.height="0px";
 //document.getElementById("audiojava").style.width="0px";

document.getElementById('cancelrecording').style.display="none";
document.getElementById('loaded').style.display="none";
document.getElementById('theuploadform').style.display="none";
document.getElementById('cancelupload').style.display="none";
document.getElementById('liketoaddaudio').style.display="none";

document.getElementById('longurlinput').style.display="none";

document.getElementById('imageurltype').value='';
document.getElementById('imagefile').value='';
document.getElementById('disable_inter').checked=false;



var button='<a href="javascript:loadaudioapp();"><img id="loadingappimage" src="'+DOMAIN+'/ityimgv2/startrecording.png" style="margin-left:5px; margin-top:5px;" border=0></a>';
writit(button,'loadappbutton');
document.getElementById('shrinkbuttonbig').style.display="block";
document.getElementById('urlinput').style.display="block";
document.getElementById('sai_intro_txt').style.display="block";
document.getElementById('loadappbutton').style.display="block";
document.getElementById('submitimagebutton').style.display="block";

var text='<img border=0 src="ityimgv2/addvouceplus.png"> ADD Voice and Audio to Any of Your Shortened Urls & Uploaded Images!';
writit(text,'audioplayer_message');


}

function displayerror(error) {

    var e = document.getElementById('shrinkjaxoutputLIST'); 
	    e.innerHTML = "<center><p style='margin-top:50px; font-family:arial,helvetica; font-size:16px; font-weight:bold;'>The following error has occurred:<br><font color=red>"+error+"</font></p><img src='http://ity.im/ityimages/errorimagebig.gif'></center>";
	
}


function ajax_switchtologin(afterlogin_do) {
	    document.getElementById('register').style.display = "none";
		document.getElementById('register').style.visibility = "hidden";
		ModalPopup._BackgroundDiv.style.display = "none";
		document.getElementById('_BackgroundDiv').style.display="none";
        document.getElementById('afterlogin_do').value=afterlogin_do;
ModalPopup('login');
}


function audioreplycontinue() {
ModalPopup.Close('audioreply_message');
loadaudioapp();
}


function closeIt()
{

  //var element = document.getElementById('audiojava');
  //element.parentNode.removeChild(element);
  //alert('destroyed applet');

  
}



function showintrovideos(set) {

var cookieset=readCookie('introvideo');
if(cookieset!=1 || set==1) {

ModalPopup('introvideos');

    var params = { allowScriptAccess: "always" };
    var atts = { id: "thevideo" };
    swfobject.embedSWF("http://www.youtube.com/v/HM-bH1Npqso?enablejsapi=1&playerapiid=ytplayer","ytapiplayer", "425", "344", "8", null, null, params, atts);
}
}
function playpubintro() {


    var params = { allowScriptAccess: "always" };
    var atts = { id: "thevideo" };
    swfobject.embedSWF("http://www.youtube.com/v/7ffM3dWllrw?enablejsapi=1&playerapiid=ytplayer","thevideo", "425", "344", "8", null, null, params, atts);

writit('<b><font color=green>NOW PLAYING:</font> ITY.IM PUBLISHER VIDEO</b>','nowplaying');
}

function playadvertintro() {

    var params = { allowScriptAccess: "always" };
    var atts = { id: "thevideo" };
    swfobject.embedSWF("http://www.youtube.com/v/0vvPwDo7RXA?enablejsapi=1&playerapiid=ytplayer","thevideo", "425", "344", "8", null, null, params, atts);
writit('<b><font color=green>NOW PLAYING:</font> ITY.IM ADVERTISER VIDEO</b>','nowplaying');
}

function skipintro() {
ModalPopup.Close('introvideos');
}
function disableintro() {
Set_CookieDay('introvideo',1,99999999);
ModalPopup.Close('introvideos');

}




function bottom_top(anchor_name) {

    parent.location = '#' +anchor_name;
}

