var adNum=0;
var count=0;
var bannerAD=new Array();
var bannerADlink=new Array();
var bannerADALT=new Array();
var topAD = new Array();
var topADlink = new Array();
var topADALT = new Array();
bannerAD[0]="http://www.globalams.com/bannerads/wedding_squ.gif";
bannerADALT[0]="Indian Wedding Cards";	
bannerADlink[0]="http://www.myshadi.com/weddings/indian wedding card catalog 1.htm";
bannerAD[1]="http://www.globalams.com/bannerads/advertiselink.gif";
bannerADALT[1]="Advertise On Myshadi";	
bannerADlink[1]="http://www.myshadi.com/matrimony/reachpeople.htm";
bannerAD[2]="http://www.globalams.com/bannerads/indianmusic.gif";
bannerADALT[2]="Indian Wedding Music";	
bannerADlink[2]="http://www.myshadi.com/weddings/wedmusic.htm";
bannerAD[3]="http://www.globalams.com/bannerads/listbusiness.gif";
bannerADALT[3]="List Your Business";	
bannerADlink[3]="http://www.myshadi.com/contact.htm";
bannerAD[4]="http://www.globalams.com/bannerads/printing.gif";
bannerADALT[4]="Printing Services";	
bannerADlink[4]="http://www.bizprintingusa.com";
bannerAD[5]="http://www.globalams.com/bannerads/webpages.gif";
bannerADALT[5]="Professional Web Design";	
bannerADlink[5]="http://www.globalams.com";

//-------------------Top Banner Link -------------------------------
//topAD[0]="http://www.globalams.com/bannerads/airlink.gif";
//topADALT[0]="Airlink Tours and Travel Inc.";	
//topADlink[0]="http://www.airlinkone.com/";
topAD[0]="http://www.globalams.com/bannerads/bhindi.gif";
topADALT[0]="Bhindi Jewellers";	
topADlink[0]="http://www.bhindi.com/";
topAD[1]="http://www.globalams.com/bannerads/bhindi.gif";
topADALT[1]="Bhindi Jewellers";	
topADlink[1]="http://www.bhindi.com/";

topAD[2]="http://www.globalams.com/bannerads/kuck_banner.jpg";
topADALT[2]="Kuck Immigration Partners LLC";	
topADlink[2]="http://www.immigration.net/";

topAD[3]="http://www.globalams.com/bannerads/weddingcardbanner.gif";
topADALT[3]="Indian Wedding Cards";	
topADlink[3]="http://www.myshadi.com/";

topAD[4]="http://www.globalams.com/bannerads/weddingcardbanner.gif";
topADALT[4]="Indian Wedding Cards";	
topADlink[4]="http://www.myshadi.com/";
	//--------------------
//--- for hitec india -----
topAD[5]="http://www.globalams.com/bannerads/reacheng.jpg";
topADALT[5]="Reach Engineers";	
topADlink[5]="http://www.pcbdesignandfab.com/submit.htm";
topAD[6]="http://www.globalams.com/bannerads/prototype.jpg";
topADALT[6]="Proto Type Boards";	
topADlink[6]="http://www.pcbdesignandfab.com/quotation.htm";
topAD[7]="http://www.globalams.com/bannerads/pcbdesignala10.jpg";
topADALT[7]="PCB ALA 0.10";	
topADlink[7]="http://www.pcbdesignandfab.com/quotes.htm";
topAD[8]="http://www.globalams.com/bannerads/dataentry.gif";
topADALT[8]="Low Cost Data Entry";	
topADlink[8]="http://www.lowcostdataentry.com";
topAD[9]="http://www.globalams.com/bannerads/webdesign.gif";
topADALT[9]="web design";	
topADlink[9]="http://www.globalams.com";
//-------------------pcbdesignandfab-----------
topAD[10]="http://www.globalams.com/bannerads/s_board.gif";
topADALT[10]="Single Board Computer";	
topADlink[10]="http://www.advancedmsinc.com";
topAD[11]="http://www.globalams.com/bannerads/prototype2.jpg";
topADALT[11]="Reach Engineers";	
topADlink[11]="http://www.pcbdesignandfab.com/submit.htm";
topAD[12]="http://www.globalams.com/bannerads/prototype4.jpg";
topADALT[12]="PCB ALA 0.10";	
topADlink[12]="http://www.pcbdesignandfab.com/submit.htm";
topAD[13]="http://www.globalams.com/bannerads/prototype1.jpg";
topADALT[13]="Proto Type Boards";	
topADlink[13]="http://www.pcbdesignandfab.com/quotation.htm";
//----------------------------------------------------------------------
topAD[14]="http://www.globalams.com/bannerads/comp_service.gif";
topADALT[14]="Computer Network";	
topADlink[14]="http://www.advancedmsinc.com";
topAD[15]="http://www.globalams.com/bannerads/yellowpages.gif";
topADALT[15]="Premium Listing";	
topADlink[15]="http://www.yellowpagesofsouthflorida.com";
topAD[16]="http://www.globalams.com/bannerads/yellowpages.gif";
topADALT[16]="Premium Listing";	
topADlink[16]="http://www.yellowpagesofsouthflorida.com";
topAD[17]="http://www.globalams.com/bannerads/printing_ban.gif";
topADALT[17]="Printing and Design";	
topADlink[17]="http://www.bizprintingusa.com";
topAD[18]="http://www.globalams.com/bannerads/cus_website.gif";
topADALT[18]="Professional Web Design";	
topADlink[18]="http://www.globalams.com";
topAD[19]="http://www.globalams.com/bannerads/web_banner.gif";
topADALT[19]="High Speed Web Hosting";	
topADlink[19]="http://www.globalams.com";
topAD[20]="http://www.globalams.com/bannerads/activepool.gif";
topADALT[20]="Active Pool";	
topADlink[20]="http://www.activepool.com";
topAD[21]="http://www.globalams.com/bannerads/activepool.gif";
topADALT[21]="Active Pool";	
topADlink[21]="http://www.activepool.com";
topAD[22]="http://www.globalams.com/bannerads/goldcoast.gif";
topADALT[22]="GoldCoast DSL";	
topADlink[22]="http://www.goldcoastdsl.com";
//--------------------------
function bannerRotate()
{
  while(true)
  { 
   adNum=Math.round(Math.random()*100);
   if (adNum <= 24){
	break;	}
  }
  while(true)
  { 
	   sideadNum=Math.round(Math.random()*10);
	   if (sideadNum <= 5 )
	   {
		break;	
	    }
  }
//---------------- for myshadi ----------------------
	if(toplink.name == 1)
	{
		while(true)
		{ 
		   adNum=Math.round(Math.random()*10);
		   if (adNum < 6)
		   {
			break;	
		   }
		   else
		   {
			count++;
		   }		
		   if( count == 2)
		   {
			adNum=0; break;
		   }		
		}		
		/*if(adNum > 0 && adNum < 6)
		{ adNum=adNum; } 
		else
		{adNum=0; }*/	
		if(sideadNum > 0 && sideadNum < 4)
		{ sideadNum=sideadNum; } 
		else
		{sideadNum=0; }	
		nextAd(adNum,sideadNum);
	}	
	if(toplink.name == 9)
	{
		while(true)
		{ 
		   adNum=Math.round(Math.random()*10);
		   if (adNum < 5)
		   {
			break;	
		   }
		   else
		   {
			count++;
		   }		
		   if( count == 2)
		   {
			adNum=0; break;
		   }		
		}		
		nextAd(adNum,sideadNum);
	}	
//--------------------------------------------------------
//---------------- for deshvidesh and indinweddingevents reachindianes 
	if(toplink.name == 3 || toplink.name ==4 || toplink.name ==5)
	{
		while(true)
		{ 
		   adNum=Math.round(Math.random()*10);
		   if (adNum < 4)
		   {
			break;	
		   }
		   else
		   {
			count++;
		   }		
		   if( count == 3)
		   {
			adNum=0; break;
		   }		
		}		
		/*while(true)
		{ 
		   adNum=Math.round(Math.random()*10);
		   if (adNum < 6){
			break;	}
		}*/	
		/*if(adNum >=1 && adNum <=5)
		{ adNum=adNum;	} 
		else
		{ adNum=5; }	*/
		if(sideadNum > 0 && sideadNum < 4)
		{ sideadNum=sideadNum; } 
		else
		{sideadNum=0; }	
			nextAd(adNum,sideadNum);
	}	
//--------------------------------------------------------
//----------------traveltohome
	if(toplink.name == 6 )
	{
		if(adNum >=1 && adNum <=6)
		{ adNum=adNum; }
		else
		{adNum=6;}	
		if(sideadNum > 0 && sideadNum < 4)
		{ sideadNum=sideadNum; } 
		else
		{sideadNum=0; }	
		nextAd(adNum,sideadNum);			
	}	
//--------------------------------------------------------
//---------------- for hitecindia ----------------------
	if(toplink.name == 2)
	{
		if(adNum >=7 && adNum <= 17)
		{
			nextAd(adNum,sideadNum);			
		} 
		else
		{
			adNum=7;
			nextAd(adNum,sideadNum);
		}	
	}	
//--------------------------------------------------------
//----------------pcbdesignandhome
	if(toplink.name == 7 )
	{
		if(adNum >=12 && adNum <=15)
		{ adNum=adNum;	}
		else
		{ adNum=12;}	
		nextAd(adNum,sideadNum);			
	}	
//--------------------------------------------------------
//----------------ypsf
	if(toplink.name == 8 )
	{
		while(true)
		{
		   adNum=Math.round(Math.random()*100);
		   if (adNum>=16 && adNum <= 24)
		   {
			break;
		   }
		   else
		   {
			count++;
		   }
		   if( count == 3)
		   {
			adNum=24; break;
		   }		
		}		
		/*if(adNum >=16 && adNum <=24)
		{ adNum=adNum; }
		else
		{ adNum=24; }	
		*/
		//on ypsf this two banner are compulsory so there is no need of implementing this bannerad
		/*if(sideadNum ==4  || sideadNum == 5)
		{ sideadNum=sideadNum; } 
		else
		{sideadNum=4; }	*/
			nextAd(adNum,sideadNum);			
	}	
//--------------------------------------------------------
}
function nextAd(adNum,sideadNum)
{
	if(toplink.name == 2 ||toplink.name == 9 || toplink.name == 3 || toplink.name == 7 || toplink.name == 8)
	{
	
		document.images.banner.src = topAD[adNum];
		document.images.banner.alt = topADALT[adNum];
		toplink.href = topADlink[adNum];
//		alert(adNum);
	}
	else
	{
		document.images.bannerADrotator.src=bannerAD[sideadNum];
		document.images.bannerADrotator.alt=bannerADALT[sideadNum];	
		mylink.href=bannerADlink[sideadNum];
	
		document.images.banner.src = topAD[adNum];
		document.images.banner.alt = topADALT[adNum];
		toplink.href = topADlink[adNum];
	}
}