﻿// JScript File

var timeout         = 500;
var closetimer		= 0;
var ddmenuitem      = 0;
var country			= 0;
var size            = 0;

// open hidden layer
function mopen(id)
{	
	document.getElementById('two').className = 'cntrynav_box2';
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';
	
}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	document.getElementById('two').className = 'cntrynav_box';


}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 



function search()
{ 

    //var url="http://www.google.com/search?q=" + Text1.value + "&sitesearch=go2southasia.org";
    //window.open( url,'MySearchWindow','scrollbars=yes, resizable,status=yes,toolbar=yes,width=700,height=600,left=0,top=0');
      //window.location = url;
      //window.location = "http://www.google.com/search?q=" + Text1.value + "&sitesearch=go2southasia.org";
      //window.location = "sitesearch.aspx?ID=" + Text1.value; 
      //window.location = "sitesearch.aspx?ID=" + Text1.value;
     //window.location = "newsearch.html?item=" + Text1.value;
    var myString = Text1.value;
    //location.href = "newsearch.html" + '?' + myString;
        //location.href = "Search_site.aspx" + '?' + myString;
        location.href = "Search_site.aspx" + '?textfield1=' + myString + '@';

}


function insertAd()
{ 

var img_width = "160";
var img_height = "274";
var img_title = "South Asia Ad";


var ad=new Array()
//insert here your images src
ad[0]='http://www.go2southasia.org/images/ads/going/ad_EotE_defined.jpg';
ad[1]='http://www.go2southasia.org/images/ads/going/ad_explore_engage.jpg';
ad[2]='http://www.go2southasia.org/images/ads/going/ad_orality.jpg';
ad[3]='http://www.go2southasia.org/images/ads/going/ad_sa101.jpg';
ad[4]='http://www.go2southasia.org/images/ads/going/ad_theedge.jpg';

var links=new Array()
//insert here your links
links[0]='http://www.go2southasia.org/ends_of_earth.html';
links[1]='http://www.go2southasia.org/i_long_ee.html';
links[2]='http://www.go2southasia.org/orality.html';
links[3]='http://www.go2southasia.org/sa101.html';
links[4]='http://www.go2southasia.org/theedge.html';

var xy=Math.floor(Math.random()*ad.length);
document.getElementById("ad1").innerHTML = '<a href="'+links[xy]+'" target="_top"><img src="'+ad[xy]+'" style="border-style: none" width="'+img_width+'" height="'+img_height+'" alt="'+img_title+'"></a>';
}

function insertVolAd()
{ 

var img_width = "160";
var img_height = "274";
var img_title = "South Asia Volunteer Ads";

var ad=new Array()   
//insert here your images src
ad[0]='http://www.go2southasia.org/images/ads/prayer/ad_comission_stories.jpg';
ad[1]='http://www.go2southasia.org/images/ads/learn/ad_what.jpg';
ad[2]='http://www.go2southasia.org/images/ads/learn/ad_voices_faithful.jpg';
ad[3]='http://www.go2southasia.org/images/ads/going/ad_sa101.jpg';
ad[4]='http://www.go2southasia.org/images/ads/resources/ad_sapulse.jpg';
ad[5]='http://www.go2southasia.org/images/ads/resources/ad_printables.jpg';
ad[6]='http://www.go2southasia.org/images/ads/resources/ad_free_materials.jpg';
ad[7]='http://www.go2southasia.org/images/ads/partner/ad_get_body_involved.jpg';
ad[8]='http://www.go2southasia.org/images/ads/prayer/ad_prayerguides.jpg';


var links=new Array()
//insert here your links
links[0]='http://www.commissionstories.com';
links[1]='http://www.go2southasia.org/what.html';
links[2]='http://www.voicesofthefaithful.com';
links[3]='http://www.go2southasia.org/sa101.html';
links[4]='http://www.go2southasia.org/sapulse.aspx';
links[5]='http://www.go2southasia.org/printables.html';
links[6]='http://imbresources.org/index.cfm/fa/store.prodlist/CatID/30/DeptID/1.cfm';
links[7]='http://www.go2southasia.org/downloads/get_your_whole_body_involved.pdf';
links[8]='http://www.go2southasia.org/prayer_t.html';

var xy=Math.floor(Math.random()*ad.length);
document.getElementById("ad3").innerHTML = '<a href="'+links[xy]+'" target="_top"><img src="'+ad[xy]+'" style="border-style: none" width="'+img_width+'" height="'+img_height+'" alt="'+img_title+'"></a>';
}

function insertSA101Ad()
{ 

var img_width = "300";
var img_height = "350";
var img_title = "Click for the South Asia Region home page";


var ad=new Array()
//insert here your images src
ad[0]='/images/sa101/1.jpg';
ad[1]='/images/sa101/2.jpg';
ad[2]='/images/sa101/3.jpg';
ad[3]='/images/sa101/4.jpg';
ad[4]='/images/sa101/5.jpg';
ad[5]='/images/sa101/6.jpg';

var links=new Array()
//insert here your links
links[0]='http://www.go2southasia.org';
links[1]='http://www.go2southasia.org';
links[2]='http://www.go2southasia.org';
links[3]='http://www.go2southasia.org';
links[4]='http://www.go2southasia.org';
links[5]='http://www.go2southasia.org';

var xy=Math.floor(Math.random()*ad.length);
document.getElementById("ad2").innerHTML = '<a href="'+links[xy]+'" target="_top"><img src="'+ad[xy]+'" style="border-style: none" width="'+img_width+'" height="'+img_height+'" alt="'+img_title+'"></a>';
}

function MM_preloadImages() { //v3.0
              var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
                var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
                if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
            }

            function MM_swapImgRestore() { //v3.0
              var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
            }
            
            function MM_findObj(n, d) { //v4.01
              var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
                d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
              if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
              for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
              if(!x && d.getElementById) x=d.getElementById(n); return x;
            }
            
            function MM_swapImage() { //v3.0
              var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
               if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
            