function getposOffset(overlay, offsettype){
	var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
	var parentEl=overlay.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}

function overlay(curobj, subobjstr, opt_position){
	document.getElementById('ClearMsg').innerHTML = "";	
	if (document.getElementById){
		//alert(opt_position.indexOf("bottom"))
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		//alert(XPOS+" - "+YPOS);
		xpos=xpos-XPOS;
		ypos=ypos+YPOS;
		//alert(xpos+" = "+ypos)
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
		return true
}

// This Function used for Send To Phone //
function phoneoverlay(curobj, subobjstr, opt_position){ 
		//document.getElementById('ClearMsg').innerHTML = "";	
		if (document.getElementById){
		//alert(opt_position.indexOf("bottom"))
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		xpos=xpos-205
		ypos=ypos+19
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
		return true
}
// End //
function eventsoverlay(curobj, subobjstr, opt_position){ 
	if (document.getElementById){
		//alert(opt_position.indexOf("bottom"))
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		if(navigator.appName == 'Netscape') {
			xpos=xpos-500;
			ypos=ypos-260;
		}
		else {
			xpos=xpos-500;
			ypos=ypos-500;
		}
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
		return true
}

function eventsoverlayYear(curobj, subobjstr, opt_position){ 
	if (document.getElementById){
		//alert(opt_position.indexOf("bottom"))
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		if(navigator.appName == 'Netscape') {
			xpos=xpos-250;
			ypos=ypos-600;
		}
		else {
			xpos=xpos-250;
			ypos=ypos-900;
		}
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"		
		//subobj.style.zIndex=1;
		return false
	}
	else
		return true
}

function eventsoverlayWeek(curobj, subobjstr, opt_position,xpos1,ypos1){ 
	if (document.getElementById){
		//alert(opt_position.indexOf("bottom"))
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		
		if(navigator.appName == 'Netscape') {
			xpos=xpos-500;
			ypos=ypos-250;
		}
		else {
			xpos=xpos-250;
			ypos=ypos-500;
		}
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
		return true
}


// This Function used for Share It //
function shareitoverlay(curobj, subobjstr, opt_position){
	if (document.getElementById){
		//alert(opt_position.indexOf("bottom"))
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		xpos=xpos-300
		ypos=ypos+19
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
		return true
}
// End //

// This Function used for RateIt (Reviews) //
function reviewoverlay(curobj, subobjstr, opt_position,XPOS,YPOS){ 
	if (document.getElementById){
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		xpos=xpos-XPOS
		ypos=ypos+YPOS
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
		return true
}

// End //

function peoplecontactmeoverlay1(curobj, subobjstr,XPOS,YPOS, opt_position){
	if (document.getElementById){
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none";
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		xpos=xpos-XPOS
		ypos=ypos+YPOS
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
		return true
}

/*function peoplecontactmeoverlay(curobj,subobjstr,XPOS,YPOS,opt_position){
	if (document.getElementById){
		//var subobj=document.getElementById(subobjstr)
		document.getElementById(subobjstr).style.display=(document.getElementById(subobjstr).style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(document.getElementById(subobjstr).offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		xpos=xpos-XPOS
		ypos=ypos+YPOS
		document.getElementById(subobjstr).style.left=xpos+"px"
		alert(document.getElementById(subobjstr).style.left+" - "+xpos+" - "+ypos); return false;
		document.getElementById(subobjstr).style.top=ypos+"px"
		return false
	}
	else
		return true
}*/

function gusetbookoverlay(curobj, subobjstr, opt_position,XPOS,YPOS){ 
	if (document.getElementById){
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		xpos=xpos-XPOS
		ypos=ypos+YPOS
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
		return true
}

// This Function used for Bit Noe in Auction (Reviews) //
function bidnowlay(curobj, subobjstr, opt_position,XPOS,YPOS){ 
	if (document.getElementById){
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		xpos=xpos-XPOS
		ypos=ypos+YPOS
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
	
		return true
}


function overlayclose(subobj){
	
	document.getElementById(subobj).style.display="none"
}

function closealloverlay(overlay1,overlay2){
	document.getElementById(overlay1).style.display="none"
	document.getElementById(overlay2).style.display="none"
}
// function used for change email address
function changeEmailAddressoverlay(curobj, subobjstr, opt_position){ 
	if (document.getElementById){
		//alert(opt_position.indexOf("bottom"))
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		xpos=xpos-15
		ypos=ypos+19
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
		return true
}

function showInterstoverlay(curobj, subobjstr, opt_position,XPOS,YPOS){
	if (document.getElementById){
		//alert(opt_position.indexOf("bottom"))
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		xpos=xpos-200
		ypos=ypos+20
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
		return true
}
function sendemailoverlay(curobj, subobjstr, opt_position,XPOS,YPOS){
	if (document.getElementById){
		//alert(opt_position.indexOf("bottom"))
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
			xpos=xpos-200;
			ypos=ypos+20;
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
		return true
}
