

var ajax = new sack();

function whenLoadingSTF(){
	var e = document.getElementById('sendtofriend'); 
	e.innerHTML = "<p>Loading Data...</p>";
}

function whenLoadedSTF(){
	var e = document.getElementById('sendtofriend'); 
	e.innerHTML = "<p>Data Sent...</p>";
}

function whenInteractiveSTF(){
	var e = document.getElementById('sendtofriend'); 
	e.innerHTML = "<p>getting data...</p>";
}
function whenLoadingRATE(){
	var e = document.getElementById('star-rating'); 
	e.innerHTML = "<span nowrap>Rating Video...</span>";
}

function whenLoadingCOMMENTS(){
	var e = document.getElementById('comments'); 
	e.innerHTML = "<span nowrap>Loading Comments...</span>";
}
function whenLoadingFAVS(){
	var e = document.getElementById('comments'); 
	e.innerHTML = "<span nowrap>Loading Favorites...</span>";
}


function whenCompleted(){
	var e = document.getElementById('sackdata'); 
	if (ajax.responseStatus){
		var string = "<p>Status Code: " + ajax.responseStatus[0] + "</p><p>Status Message: " + ajax.responseStatus[1] + "</p><p>URLString Sent: " + ajax.URLString + "</p>";
	} else {
		var string = "<p>URLString Sent: " + ajax.URLString + "</p>";
	}
	e.innerHTML = string;	
}



function logout() {
window.location.href="http://ity.im/login.php?go=logout";
}
function accountlogindirect() {
window.location.href="http://ity.im/login.php";
}


function diplayloggedout_layers() {

document.getElementById('loginnav').style.display = "block";

}

function diplayloggedin_layers() {

//alert('DISPLAYING LOGGED IN LAYER');

document.getElementById('usernav').style.display = "block";
document.getElementById('loginnav').style.display = "none";



}


function logincheck(closemodal) {
    ajax.setVar("closemodal", closemodal);
    ajax.execute=true;
	ajax.requestFile = "http://ity.im/ajaxoperations/ajaxlogin.php";
    ajax.method = 'POST';
	ajax.runAJAX();

}


function ajaxlogin() {


var ajax = new sack();
ajax.setVar("go", 'login');
ajax.setVar("email", document.loginform.email.value);
ajax.setVar("password", document.loginform.password.value);

	ajax.requestFile = "http://ity.im/ajaxoperations/ajaxlogin.php";
    ajax.method = 'POST';
    ajax.execute=true;
	ajax.runAJAX();


setTimeout('logincheck("login")',1000);


}


function ajaxloginverify(id,verify) {
var ajax = new sack();
ajax.setVar("verify", verify);
ajax.setVar("id", id);

	ajax.requestFile = "http://ity.im/ajaxoperations/ajaxlogin.php";
    ajax.method = 'POST';
	ajax.element = 'accountverify';

	ajax.runAJAX();

ModalPopup('accountverify');



}

function logincloseverify() {
document.getElementById('accountverify').style.display = "none";
ModalPopup('login');
}


function ajaxforgotpass() {
var ajax = new sack();
ajax.setVar("go", 'forgotpass');
ajax.setVar("email", document.loginform.forgotemail.value);

	ajax.requestFile = "http://ity.im/ajaxoperations/ajaxlogin.php";
    ajax.method = 'POST';
	ajax.execute=true;
	

	ajax.runAJAX();




}

function ajaxregister() {

window.scrollTo(0,0);

var ajax = new sack();
ajax.setVar("go", 'register');
ajax.setVar("name", document.registerform.name.value);
ajax.setVar("email", document.registerform.email.value);
ajax.setVar("password1", document.registerform.password1.value);
ajax.setVar("password2", document.registerform.password2.value);
ajax.setVar("turing", document.registerform.turing.value);


//if(document.registerform.newsletter.checked==true) {
//ajax.setVar("newsletter", document.registerform.newsletter.value);
//}


if(document.registerform.terms.checked==true) {
ajax.setVar("terms", document.registerform.terms.value);
}
	ajax.requestFile = "http://ity.im/ajaxoperations/ajaxregister.php";
    ajax.method = 'POST';
	ajax.element = 'registerform_container';

	
    var layerobject=document.getElementById('registerform_container');
	layerobject.innerHTML  = "<div style='width:100%; margin-top:5px;'><center><div style='font-family:arial,helvetica; font-size:16px; font-weight:bold;'>LOADING...</div><Br><div style='font-family:arial,helvetica; font-size:11px; font-weight:bold;'>Your url list will automatically refresh when completed</div><img src='http://ity.im/ityimages/ajaxloading.gif'></center></div>";

	
	ajax.runAJAX();

}


function ajaxregisterverify(id) {

window.scrollTo(0,0);

var ajax = new sack();
ajax.setVar("verify", '1');
ajax.setVar("id", id);
ajax.setVar("vnumber",document.getElementById('vnumber').value);


	ajax.requestFile = "http://ity.im/ajaxoperations/ajaxregister.php";
    ajax.method = 'POST';
	ajax.element = 'registerform_container';
	
	var layerobject=document.getElementById('registerform_container');
	layerobject.innerHTML  = "<div style='width:100%; margin-top:5px;'><center><div style='font-family:arial,helvetica; font-size:16px; font-weight:bold;'>LOADING...</div><Br><div style='font-family:arial,helvetica; font-size:11px; font-weight:bold;'>Your url list will automatically refresh when completed</div><img src='http://ity.im/ityimages/ajaxloading.gif'></center></div>";
	
	
	ajax.runAJAX();

}

function  resendverify(id) {

var ajax = new sack();
ajax.setVar("resend", '1');
ajax.setVar("id", id);

	ajax.requestFile = "http://ity.im/ajaxoperations/ajaxregister.php";
    ajax.method = 'POST';	
    ajax.execute=true;
	
	ajax.runAJAX();

}


function registerfinalstep() {

window.scrollTo(0,0);

		document.getElementById('register').style.display = "none";
		document.getElementById('register').style.visibility = "hidden";
	    document.getElementById('login').style.display = "none";
		document.getElementById('login').style.visibility = "hidden";
		ModalPopup._BackgroundDiv.style.display = "none";
		document.getElementById('_BackgroundDiv').style.display="none";
loadaudioapp();
ajax_populatecats('');
loadlinkslist();


if(document.getElementById('categoriesmenu').style.display=='block') {
ajax_categorymenu();
}



}


function loginfinalstep_facebook() {



		document.getElementById('login').style.display = "none";
		document.getElementById('login').style.visibility = "hidden";
		ModalPopup._BackgroundDiv.style.display = "none";
		document.getElementById('_BackgroundDiv').style.display="none";
loadaudioapp();
ajax_populatecats('');
loadlinkslist();
if(document.getElementById('categoriesmenu').style.display=='block') {
ajax_categorymenu();
}



}



function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}
