﻿// JScript File

/****************************************************************
 *	name:		Home Page Text Display
 *	date:		21/7/09
 *	author:		Makesh
 *  copyright:	Alamy Images India (P) Ltd.
 *
 *	description: Display Home Page Text
 ***************************************************************
 */
 

var arrRandomNumbers=new Array();
  

    //--Create 5 unique  Random numbers
    function SetRandomNumbers(intMaxNum,intHomeDispCount)
    {
         var intRanNum;
         
         arrRandomNumbers.splice (0,arrRandomNumbers.length);
             while(arrRandomNumbers.length < intHomeDispCount)
             {
               intRanNum= Math.floor(Math.random() * (intMaxNum)); //Random number
                   if(CheckDuplicateRndmNum(intRanNum) != true)       //Check Duplicate 
                       arrRandomNumbers[arrRandomNumbers.length] = intRanNum;
                      
             }
    }

    //--Check Duplicate in random array
    function CheckDuplicateRndmNum(intCheckNum)
    {
        var k = 0;
        
         for(k = 0; k < arrRandomNumbers.length;k++)
         {
           if(arrRandomNumbers[k] == intCheckNum)
                return true;        
           else if(arrRandomNumbers.length == k)
                return false;
         }

    }
    
    
    
    
    //--Sort the Display Name
    function value(a,b) 
    {
         a = a[2];
         b = b[2];
        return a == b ? 0 : (a < b ? -1 : 1)
    }
    
    //------Load OurContributor Image   
    var intImgCount=0;                      
    function LoadImageOurContributor()
    {

      var j=0;
      var strText = "";
      var intImageCount=arrImageContributors.length; //Image Count 
   	  	  		
      SetRandomNumbers(intImageCount,intImageCount);
      
      for(j = 0; j < intImageCount; j++)
      {               
         strText = strText +  '<dl><a href=javascript:ow("../../../../../image-details-popup.asp?ARef='+arrImageContributors[arrRandomNumbers[j]][0]+'") '; 
//         if(j == 0)           // JQuery First image 
//             strText= strText + ' class="show" '
         strText = strText +' >';
                
		 strText = strText +'<img src="../../../../images/cats/flowers/intro_images/'+ arrImageContributors[arrRandomNumbers[j]][0] +'.jpg';
		 strText = strText +'" alt="' + arrImageContributors[arrRandomNumbers[j]][2] +'" width="539" height="350" title="' + arrImageContributors[arrRandomNumbers[j]][1] +'"  rel=""/>';
	     strText = strText + '</a><div class="ph_name"><div id="divPhotoGrpaherName"><a href="../../../../contrib-browse.asp?cid=' +  arrImageContributors[arrRandomNumbers[j]][4] + '&name=' +   arrImageContributors[arrRandomNumbers[j]][3] + '"  title="See stock photography by '+  arrImageContributors[arrRandomNumbers[j]][3] + '" >' +   arrImageContributors[arrRandomNumbers[j]][3] + '</a></div></div></dl>';      
	  }

      return (strText);

    }
