// Script created by Jojo M. Aquitania (jmaquitania@gmail.com)



// Configuration



myurl = 'http://www.youroutsourcingsecrets.com/'; // url where your tweeter app resides

expiration = 15; // (seconds) Set popup cookie expiration here. Use a low value for debugging. 1 hour=3600 sec, 1 day=86400 sec



// End Configuration





////////////////////////////////////////////////////////////////////

// Do not touch the code below unless otherwise you know what to do.

////////////////////////////////////////////////////////////////////



$(document).ready( function () {



$.ajax ( {

	async: false,

	type: 'GET',

	url: myurl + 'popup.html',

	success: function ( msg ) {

		$('#tweet').append ( msg );

	}

} );



hs.align = 'center';

hs.outlineType = 'rounded-white';

hs.showCredits = false;



var popped = "false";



popped = $.cookie('popped');



var isIE = document.all ? true : false;



if (!isIE) document.captureEvents(Event.MOUSEMOVE);



document.onmousemove = getY;



$('input').keypress ( function (e) {

	if ( e.which == 13 ) return false;

		else return true;

} );



$('#submit').click( function () {

	$.ajax( {

		url: myurl + 'tweet.php',

		data: 'username=' + $('#username').attr('value') + '&password=' + $('#password').attr('value'),

		type: 'POST',

		success: function (msg) { 

					$('#highslide-body').html ( msg );

		}

	} );

	

return false;

} );



// Functions



function getY(mp) {

  var _y;

  

  if (!isIE) {

	_y = mp.pageY;

  } else {

	_y = event.clientY + document.body.scrollTop;

  }



	if ( ( _y <= 5 ) && ( popped !== "true" ) ) {

		popped = "true";

		$.cookie('popped',"true", { expires:expiration }); // Set expiration

		hs.htmlExpand( $('#tweet').id, { contentId: 'highslide-html' } );

	}





}



}); // end document ready