

//when document was ready then moveToRight()
$(document).ready(
	function(){
		moveToRight();
	}
);

//Resize functions
function resizeWaterCaller(iFrameId) { 
	
	contentWidth=$('#'+iFrameId).contents().width();
	contentHeight=$('#'+iFrameId).contents().height();
	setTimeout(function(){
		resizeWaterIframe(iFrameId , contentWidth , contentHeight);
	},100);
	
	
//	setTimeout(resizeWaterIframe(iFrameId , contentWidth , contentHeight),100 ); 
}

function resizeWaterIframe(iFrameId, iFrameW, iFrameH) {
	$('#' + iFrameId).height(iFrameH);
	$('#' + iFrameId).width(iFrameW);
}



//Move watermark iframe to right position
function moveToRight() {
    var scrollTop, scrollBottom, offsetSize;
    
	scrollTop=$('#scroll').position().top;
	scrollBottom=$(document).scrollTop();
	
    var nextTime = 500; 
    
    if (scrollTop != scrollBottom) {
        offsetSize = Math.ceil(Math.abs(scrollBottom - scrollTop) / 20);
        offsetSize = (scrollBottom > scrollTop) ? offsetSize : -offsetSize;
        
		$('#scroll').css({top:$('#scroll').position().top+offsetSize });
		
        nextTime = 10;
    }

    setTimeout("moveToRight()", nextTime);
}

 
//function anchor() {
//	if($('#anchor').length>0)
//	{
//		$('#anchor').focus();
//	}
//}





