﻿// JavaScript Document

function NoFrameBU(){
	if(self!=top){top.location.replace(self.location.href);}
}
function NoFrame(){
	function MyDomain(){
		try{if(parent.location.hostname==self.location.hostname){return true;}}
		catch(e){return false;}
	}
	if(self!=top&&!MyDomain()){top.location.replace(self.location.href);}
}
NoFrame();

function IsHTTP(){
	if(self.location.protocol=="http:"){return true;}else{return false;}
}

function IsFile(){
	if(self.location.protocol=="file:"){return true;}else{return false;}
}

function IsMSIE(){
	if(navigator.userAgent.indexOf("MSIE")>-1)
	{return true;}else{return false;}
}

function LocalDocRef(){
	if(document.referrer.indexOf(self.location.hostname)>-1)
	{return true;}else{return false;}
}

function FocusMe(Me){
	try{Me.focus();}catch(e){/*NoOp*/}
}

function RandomInt(UB,LB){
	if(!UB){UB=9;}if(!LB){LB=0;}
	return Math.floor((UB-LB+1)*Math.random()+LB);
}

function bodyFocus(){
	document.body.focus();
}

function kSnd(){
	try{bgSnd.src="";}catch(e){/*NoOp*/}
}

function FormURL(){
	document.writeln('<input type="hidden" name="FormURL" value="'+
	self.location.protocol+'//'+self.location.hostname+
	self.location.pathname.replace("/index.htm","/")+'">');
}

function formMail(){
	document.writeln('<input type="hidden" name="return_link_url" value="'+
		document.referrer+'">');
	document.writeln('<input type="hidden" name="return_link_title" '+
		'value="Please Continue">');
	document.writeln('<input type="hidden" name="FormURL" value="'+
		self.location.href+'">');
	document.writeln('<input type="hidden" name="DocRef" value="'+
		document.referrer+'">');
}

function CacheControl(Days,Validate){
	if(!Validate){Validate=true;}
//	if(!Days){Days=1/24;} // 1 Hour
	if(!Days){Days=0;} // Now
	var DayMs=86400000;
	var ExpireDate = new Date((new Date()).getTime()+(Days*DayMs));
	document.writeln('<head>');
	document.writeln('<META HTTP-EQUIV="expires" CONTENT="'+
		ExpireDate.toUTCString()+'">');
	if(Validate)
	{document.writeln('<META HTTP-EQUIV="cache-control"'+
		' VALUE="must-revalidate">');}
	document.writeln('<\/head>');
}

function AI(link){//Add index.htm
	if(IsFile()&&!(link.href.indexOf("/index.htm")>-1))
	{	var HR=link.href, H=link.hash, S=link.search;
		HR=HR.replace(H,"").replace(S,"");
		if(HR.indexOf("/",HR.length-1)<0){HR+="/";}
		link.href=HR+"index.htm"+H+S;
	}
}

function bodyLoad(){
	document.body.focus();
}

function GoBack2Btn(){
	var xxx='<p class="GoBtns" style="width: 66%"><a class="BtnLink wAll" '+
	'<a class="BtnLink wAll" title="Back Twice" '+
	'href="JavaScript:onClick=history.go(-2);" '+
	'onclick="bodyFocus();">Resume</a></p>'
	document.writeln(xxx);
}

function NoBannerTable(){
	if(self!=top){BannerTbl.style.display="none";}
}

function VAYouTube(vDoc){
var FS=1, REL=0, AP=0, SI=0, Vrsn=''; //FullScreen, Related, AutoPlay, ShowInfo, Vrsn='&version=3'
//	if(IsFile()){AP=0;}
document.writeln('<object class="VAYouTube">'+
	'<param name="movie" value="http://www.youtube.com/v/'+vDoc+'?fs='+FS+'&rel='+REL+'&autoplay='+AP+'&showinfo='+SI+Vrsn+'"></param>'+
	'<param name="allowFullScreen" value="true"></param>'+
	'<param name="allowscriptaccess" value="always"></param>'+
	'<param name="allowNetworking" value="internal"></param>'+
	'<embed class="VAYouTube" src="http://www.youtube.com/v/'+vDoc+'?fs='+FS+'&rel='+REL+'&autoplay='+AP+'&showinfo='+SI+Vrsn+
	'" type="application/x-shockwave-flash" allowscriptaccess="always" allowNetworking="internal" allowfullscreen="true"></embed>'+
	'</object>');
document.writeln('<p class="NoPrint" style="font-size:13px;margin:0;">Look for High Def and/or Full Screen Options - <a href="http://www.wopg.org/" target="_blank" title="Global">Words of Peace</a></p>');
}

var NoPageCount=false;
function ImgCounter(){
	if(self==top&&!NoPageCount){
		document.writeln('<p class="ImgCounter"><img src="/tinc?key=TWLpK9hK"><br />'
		+	'Distinct IP Visitors<br />Since April 19, 2009</p>');
	}
}



var Words=new Array("Acceptance","Acknowledgment","Admiration","Adoration","Affection","Amazement","Appreciation","Aspiration","Authenticity","Awareness","Balance","Beauty","Blessings","Caring","Compassion","Consciousness","Contentment","Dedication","Devotion","Dignity","Distinction","Endearment","Enjoyment","Enlightenment","Excitement","Exhilaration","Experience","Familiarity","Fascination","Feeling","Friendship","Fulfillment","Gentleness","Grace","Gratitude","Growth","Guidance","Happiness","Harmony","Help","Honesty","Hope","Humility","Insight","Inspiration","Integrity","Intelligence","Introspection","Joy","Kindness","Knowing","Knowledge","Lightness","Magnificence","Mercy","Nurturance","Opportunity","Passion","Peace","Perception","Perfection","Reality","Realization","Recognition","Renewal","Respect","Reverence","Sharing","Simplicity","Sincerity","Tenderness","Thanks","Tranquillity","Truth","Understanding","Wisdom");
var Word1,Word2,Word3,Word4=null;
Word1=RandomInt(Words.length-1);
while(Word2==null||Word2==Word1){Word2=RandomInt(Words.length-1);}
while(Word3==null||Word3==Word1||Word3==Word2){Word3=RandomInt(Words.length-1);}
while(Word4==null||Word4==Word1||Word4==Word2||Word4==Word3){Word4=RandomInt(Words.length-1);}
Word1=Words[Word1];Word2=Words[Word2];Word3=Words[Word3];Word4=Words[Word4];

function WordsOfLove(){document.writeln('<p id="WordsOfLove">Words of Love and '+Word1+'</p>');}
function WordsOfLoveRETIRED(){
	if(location.hostname.indexOf('wordsof.net')>-1)
		{document.writeln('<p id="WordsOfLove">Words of Love and '+Word1+'</p>');}
	else if(location.hostname.indexOf('nachio.com')>-1)
		{document.writeln('<p id="WordsOfLove">Words of Love —► Retired</p>');}
}
function WordsOfOther(){document.writeln('<p id="WordsOfOther">Words of Love,<br />'+Word2+', '+Word3+'</p>');}





// FACEBOOK BELOW

function fbVideo(vDoc,H,W){
	if(!W){W=460;}
	document.writeln(
		'<object class="fbVideo" width="'+W+'" height="'+H+'" >'+
		'<param name="allowfullscreen" value="true" />'+
		'<param name="allowscriptaccess" value="always" />'+
		'<param name="movie" value="http://www.facebook.com/v/'+vDoc+'" />'+
		'<embed class="fbVideo" src="http://www.facebook.com/v/'+vDoc+'" type="application/x-shockwave-flash" '+
		'allowscriptaccess="always" allowfullscreen="true" width="'+W+'" height="'+H+'"></embed>'+
		'</object>'
	);
}

function fbShareJS(){
	document.writeln('<p class="FB_Share NoPrint" title="Facebook"><a href="http://www.facebook.com/share.php?u='+encodeURIComponent(location.href)+'" class="fb_share_button" onclick="return fbs_click()" target="_blank" style="text-decoration:none;">Share</a></p>'); //  Or...
}

function fbLikeJS454(W){
/*	CALL	<script type="text/javascript">fbLikeJS454();</script> */
/*
	if(!W){W=454;}
	document.writeln('<iframe class="NoPrint" style="width:'+W+'px;height:63px;border:none;overflow:hidden;margin-top:4px;margin-bottom:1px" src="http://www.facebook.com/plugins/like.php?href='+encodeURIComponent(location.href)+'&layout=standard&show_faces=true&width='+W+'&action=like&colorscheme=light&height=63" scrolling="no" frameborder="0" allowTransparency="true"></iframe>');
*/
}

//	http://www.new.facebook.com/share_partners.php  Added: left=50,top=50,
function fbs_click(){
u=location.href;t=document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436,left=50,top=50');
return false;
}
function fb_share_button(){
	document.writeln('<a href="http://www.facebook.com/share.php?u='+encodeURIComponent(location.href)+'" class="fb_share_button" onclick="return fbs_click()" target="_blank" style="text-decoration:none;">Share</a>');
}

var MaxPIW=568; // Max PlugIn Width
function PagePlugInFB(Page,W,H){
	//	http://www.facebook.com/pages/Words-of-Peace-Global/108949858060
	var PageURL='';
	var ThisSite='';
	var Hash='';
	var HashUrl='this';
	switch(Page)
	{	
		case 'WOPG': PageURL='wordsofpeaceglobal'; Hash='wopg'; break; // 108949858060
		case 'TPRF': PageURL='PremRawatFoundation'; Hash='prf'; break; // 205572516994
		case 'WOL': PageURL='WordsOfLovePage'; Hash='wol'; break; // 215735051779708
		case 'Ashram': PageURL='LoveAshram'; Hash='love-ashram'; break; // 225648110783531
	}
	if(PageURL){
		if(!W){W=460;} if(W>MaxPIW){W=MaxPIW;}
		if(!H){H=555;} // 400 if show_faces=false
/*
		if(location.pathname!=='/va/fb/')
			{HashUrl='<a style="text-decoration:none" href="/va/fb/#~'+Hash+'">this</a>';}
*/
		if(Page=='WOL' || Page=='Ashram'){ThisSite='▼ A <strong>Words of Love</strong> Facebook Page ▼<br />';}
		document.writeln('<p class="NoPrint" id="~'+Page.toLowerCase()+
			'" style="margin-top:3em;margin-bottom:2px;font-size:13px;line-height:130%">'+
			ThisSite+'▼ Like ▼ to Subscribe to '+HashUrl+' Facebook Page for new posts.</p>');
		if(W>460){document.writeln('<center>');}
		document.writeln('<iframe class="NoPrint" style="margin:0 0 2em 0; border:none; overflow:hidden; width:'+W+'px; height:'+H+'px" src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2F'+PageURL+'&width='+W+'&colorscheme=light&show_faces=true&stream=true&header=false&height='+H+'" scrolling="no" frameborder="0" allowTransparency="true"></iframe>');
		if(W>460){document.writeln('</center>');}
	}
}

function RFBA(W,H){ // Recent Activity: http://developers.facebook.com/docs/reference/plugins/activity/
//	document.writeln('<hr />');
/*
	if(location.hostname.indexOf('wordsof.net')>-1)
	{
		if(!W){W=460;} if(W>MaxPIW){W=MaxPIW;}
		if(!H){H=500;}
		if(W>460){document.writeln('<center>');}
		document.writeln('<iframe class="NoPrint" src="http://www.facebook.com/plugins/activity.php?site='+location.hostname+'&width='+W+'&height='+H+'&header=true&colorscheme=light&font=verdana&border_color=008080&recommendations=true" scrolling="no" frameborder="0" style="margin-top:2em;border:none;overflow:hidden;width:'+W+'px;height:'+H+'px;" allowTransparency="true"></iframe>');
		if(W>460){document.writeln('</center>');}
	}
*/
}

function PagePlugInFB4(Width){
	PagePlugInFB("WOL",Width);
	PagePlugInFB("WOPG",Width);
	RFBA(Width);
	PagePlugInFB("TPRF",Width);
	PagePlugInFB("Ashram",Width);
}

function MenuTblFacebook(FB,CP,Share){ // true to deny
/*	if(!FB){document.writeln('<tr><th>Facebook</th></tr>');}
	if(!CP){document.writeln('<tr id="FB"><td><a href="/va/fb/">Causes, Pages</a></td></tr>');}
	if(!Share){document.writeln('<tr title="Share This Page"><td><script type="text/javascript">fb_share_button();</script></td></tr>');}
*/
}







