/****************************************************************************************
// More.js -- Used to show More Overlays - Kumar @ Unosoft Technologies
// All Rights Reserved
/****************************************************************************************/
// ---------------------------------------------------------------------------------------
//call back function to calculate position fo the form field
// ---------------------------------------------------------------------------------------
function setMoreCoordinates(idname) {
	var spanField = document.getElementById(idname);
	var fieldCoords = findMorePos(spanField);
	
	// Now set the div object
	var divObject = document.getElementById("moreDiv");
	moreDivHeight = $("#moreDiv").height();
	divObject.style.top = (fieldCoords[1] - moreDivHeight) + "px";
	divObject.style.left = fieldCoords[0] -300 + 2 + "px";
}

// ---------------------------------------------------------------------------------------
//call back function to calculate position fo the form field
// ---------------------------------------------------------------------------------------
 function findMorePos(obj) {
        var curleft = curtop = curheight = 0;
        if (obj.offsetParent) {
                curleft = obj.offsetLeft
                curtop = obj.offsetTop
                while (obj = obj.offsetParent) {
                        curleft += obj.offsetLeft
                        curtop += obj.offsetTop
                }
        }

        return [curleft,curtop];
}

// -----------------------------------------------------------------------------------------------
//hide div tag when the page gets load
// -----------------------------------------------------------------------------------------------

$(function() {
   $("#moreDiv").hide();
});

// ----------------------------------------------------------------------------------------------
//call this function when the more link click and pass particulat div tag id to get left and right 
// -----------------------------------------------------------------------------------------------
//commmented by Nandish @ unosofttech.com
function overlayDiv(objDiv) {
switch (objDiv) {
  case "homeNotes":
  				$("#moreContent").html("<p>Peer-to-peer (P2P) textbook rental is quite different than the business-to-peer (B2P) model that is currently being used by other major college textbook rental companies.  Instead of renting textbooks from Silibi, you will be renting directly from other users around the country.  By doing this, we are able to cut out the middleman and provide an opportunity for users to make more money than ever before from their textbooks.  No longer will students be limited to making a one-time fee from selling their textbooks.  Students can now have the luxury of lending their textbooks to others around the country, making money every single semester.</p><p>We are able to offer the lowest textbook rental prices on the web by giving users the freedom to set the rental fee.s.  We encourage you (and each of your friends) to list all of your textbooks to create the most price competitive environment possible and drive the rental prices even lower.   For example, if a user were to list a .Calculus 101. textbook on the website at a certain rental price, the next user to list the same book would likely try and undercut the first users rental price to increase the chances of their book being rented.  The prices will continue to get driven lower and lower as more and more options are available.</p><p>If you have any of the following items, feel free to list them on our website to begin making money:  college textbooks, used textbooks, new textbooks, course notes, class notes, course outlines, class outlines, attack outlines, homework, exams, finals, study guides, or review material.</p>");
				break;
  case "testimonial1":
  				$("#moreContent").html("This is the first I had ever heard about a peer to peer textbook rental service. What a great idea!");
				break;
   case "testimonial2":
			   	$("#moreContent").html("I've listed all of my old textbooks at Silibi. I can't wait to start making some money!.");
				break;
    default:
	alert(objDiv);
}

$(function(){
       setMoreCoordinates(objDiv);
       $("#moreDiv").show("slow");
    });
}



function overlayShow(mesg,obj) {
	$("#moreContent").html("").html(mesg);

    $(function(){
       var offset = $("#" + obj.id).offset();
       $("#moreDiv").css({"left":offset.left - 300,"top":offset.top}).show("slow");
    });
}


// ---------------------------------------------------------------------------------------
//close the morediv tag
// ---------------------------------------------------------------------------------------

$(function() {
	$("span#close").click(function() {
		$("#moreDiv").hide("slow");
	});
});
 
// ---------------------------------------------------------------------------------------
//provide cursor effect for close span based on browser type
// ---------------------------------------------------------------------------------------

$(function() {
$("span#close").mouseover(function() {
   ($.browser.msie) ? $(this).css({"cursor":"hand"}) : $(this).css({"cursor":"pointer"});
});
});
// ---------------------------------------------------------------------------------------

$(function() {
	$("#move").bind("click",function() {
		$(this).prev("div").prev("div").hide("slow").end().end().prev("div").show("slow");
	});
});

