function resize_iframe()
{var height=window.innerWidth;if(document.body.clientHeight&&document.body.clientWidth)
{height=document.body.clientHeight;width=document.body.clientWidth;}
document.getElementById("ie_hack").style.height=parseInt(height-document.getElementById("ie_hack").offsetTop-0)+"px";document.getElementById("ie_hack").style.width=parseInt(width-document.getElementById("ie_hack").offsetTop-0)+"px";}
function savevalidation()
{var imgcaptcha="";var errorLength=0;var captchacode="";var ajax_result="";imgcaptcha=document.getElementById('captcha_text');captchacode=document.getElementById('img_captcha_code');if(imgcaptcha.value!=""&imgcaptcha.value.length>0)
{fnHiddenDiv('errorCaptcha');}
else
{fnShowDiv('errorCaptcha');if(errorLength==0)
imgcaptcha.focus();errorLength++;}
if(errorLength>0)
{return false;}
else
{return true;}}
function signupformvalidation()
{var errorLength=0;var username="";var email="";var password="";var conf_password="";var terms="";var first_name="";var last_name="";username=document.getElementById('user_username');email=document.getElementById('user_email');password=document.getElementById('user_password');conf_password=document.getElementById('user_password_confirmation');terms=document.getElementById('user_terms_of_service');first_name=document.getElementById('user_first_name');last_name=document.getElementById('user_last_name');if(username.value!=""&username.value.length>0)
{fnHiddenDiv('username_error');}
else
{fnShowDiv('username_error');if(errorLength==0)
username.focus();errorLength++;}
if(first_name.value!=""&first_name.value.length>0)
{fnHiddenDiv('first_name_error');}
else
{fnShowDiv('first_name_error');if(errorLength==0)
first_name.focus();errorLength++;}
if(last_name.value!=""&last_name.value.length>0)
{fnHiddenDiv('last_name_error');}
else
{fnShowDiv('last_name_error');if(errorLength==0)
last_name.focus();errorLength++;}
if(email.value!=""&email.value.length>0)
{fnHiddenDiv('email_error');if(!validateEmail(email.value)){fnShowDiv('email_invalid_error');errorLength++;}}
else
{fnShowDiv('email_error');if(errorLength==0)
username.focus();errorLength++;}
if(password.length==0){fnShowDiv('password_error');errorLength++;}else{fnHiddenDiv('password_error');if(password.value.length<5){fnShowDiv('password_length_error');errorLength++;}else if(password.value!=conf_password.value){fnShowDiv('password_match_error');errorLength++;}}
if(conf_password.length==0){fnShowDiv('repassword_error');errorLength++;}else{fnHiddenDiv('repassword_error');}
if(terms.checked){fnHiddenDiv('tems_error');}else{fnShowDiv('tems_error');terms.focus();errorLength++;}
if(errorLength>0)
{return false;}
else
{return true;}}
function commentformvalidation()
{var errorLength=0;var username="";var subject="";var comments="";username=document.getElementById('short_url_comment_name');subject=document.getElementById('short_url_comment_subject');comments=document.getElementById('short_url_comment_comments');if(username.value!=""&username.value.length>0)
{fnHiddenDiv('name_error');}
else
{fnShowDiv('name_error');if(errorLength==0)
errorLength++;}
if(subject.value!=""&subject.value.length>0)
{fnHiddenDiv('subject_error');}
else
{fnShowDiv('subject_error');if(errorLength==0)
errorLength++;}
if(comments.value!=""&comments.value.length>0)
{fnHiddenDiv('comments_error');}
else
{fnShowDiv('comments_error');if(errorLength==0)
errorLength++;}
if(errorLength>0)
{return false;}
else
{return true;}}
function commentreplyformvalidation(id)
{var errorLength=0;var subject="";var comments="";subject=document.getElementById('short_url_comment_replies_subject'+id);comments=document.getElementById('short_url_comment_replies_comments'+id);if(subject.value!=""&subject.value.length>0)
{fnHiddenDiv('subject_error'+id);}
else
{fnShowDiv('subject_error'+id);if(errorLength==0)
errorLength++;}
if(comments.value!=""&comments.value.length>0)
{fnHiddenDiv('comments_error'+id);}
else
{fnShowDiv('comments_error'+id);if(errorLength==0)
errorLength++;}
if(errorLength>0)
{return false;}
else
{return true;}}
function emailvalidation(){var errorLength=0;var email="";email=document.getElementById('email');if(email.value!=""&email.value.length>0)
{fnHiddenDiv('email_error');if(!validateEmail(email.value)){fnShowDiv('email_invalid_error');errorLength++;}}
else
{fnShowDiv('email_error');if(errorLength==0)
email.focus();errorLength++;}
if(errorLength>0)
{return false;}
else
{return true;}}
function passwordvalidation(){var errorLength=0;var password="";var conf_password="";var current_password="";password=document.getElementById('password');conf_password=document.getElementById('repassword');current_password=document.getElementById('current_password');if(current_password.value.length==0){fnShowDiv('current_password_error');errorLength++;}else{fnHiddenDiv('current_password_error');}
if(password.value.length==0){fnShowDiv('password_error');errorLength++;}else{fnHiddenDiv('password_error');if(password.value!=conf_password.value){fnShowDiv('password_match_error');errorLength++;}}
if(conf_password.value.length==0){fnShowDiv('repassword_error');errorLength++;}else{fnHiddenDiv('repassword_error');}
if(errorLength>0)
{return false;}
else
{return true;}}
function twittervalidation(){var errorLength=0;var email="";var password="";email=document.getElementById('twitter_email');password=document.getElementById('twitter_password');if(email.value!=""&email.value.length>0)
{fnHiddenDiv('twitter_email_error');}
else
{fnShowDiv('twitter_email_error');if(errorLength==0)
email.focus();errorLength++;}
if(password.value.length==0){fnShowDiv('twitter_password_error');errorLength++;}else{fnHiddenDiv('twitter_password_error');}
if(errorLength>0)
{return false;}
else
{return true;}}
function requestpasswordvalidation(){var errorLength=0;var email="";var message="";message=document.getElementById('message');email=document.getElementById('from');if(email.value!=""&email.value.length>0)
{fnHiddenDiv('email_error');if(!validateEmail(email.value)){fnShowDiv('email_invalid_error');errorLength++;}}
else
{fnShowDiv('email_error');if(errorLength==0)
email.focus();errorLength++;}
if(message.value.length==0){fnShowDiv('message_error');errorLength++;}else{fnHiddenDiv('message_error');}
if(errorLength>0)
{return false;}
else
{return true;}}
function requestpassworddmvalidation(){var errorLength=0;var message="";message=document.getElementById('dm_message');if(message.value.length==0){fnShowDiv('dm_message_error');errorLength++;}else{fnHiddenDiv('dm_message_error');}
if(errorLength>0)
{return false;}
else
{return true;}}
function validateEmail(email){var reg=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;if(reg.test(email)==false){return false;}else{return true;}}
function fnShowDiv(id)
{document.getElementById(id).style.display="block";}
function fnHiddenDiv(id)
{document.getElementById(id).style.display="none";}
function fnLoadAjaxverifycaptha(domain,code_value)
{var actionUrl="";var queryString="";domain=escape(domain);queryString="captcha_text="+domain+"&captcha_code="+code_value;actionUrl="/shortening/verify_captcha"
actionUrl+="?"+queryString;var xmlHttp;try
{xmlHttp=new XMLHttpRequest();}
catch(e)
{try
{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{try
{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e)
{alert("Your browser does not support AJAX!");return false;}}}
xmlHttp.onreadystatechange=function()
{if(xmlHttp.readyState==4)
{alert("Response"+xmlHttp.responseText);return true;}}
var url=actionUrl;xmlHttp.open("GET",url,true);xmlHttp.send(null);}

function createpasswordvalidation()
{
var errorLength=0;
var password="";
var conf_password="";

password=document.getElementById('password');
conf_password=document.getElementById('repassword');

if(password.value.length==0)
{
fnShowDiv('password_error');
errorLength++;
}
else
{
fnHiddenDiv('password_error');
if(password.value!=conf_password.value)
{
fnShowDiv('password_match_error');
errorLength++;
}
}
if(conf_password.value.length==0)
{
fnShowDiv('repassword_error');
errorLength++;
}
else
{
fnHiddenDiv('repassword_error');
}
if(errorLength>0)
{
return false;
}
else
{
return true;
}
}