﻿// JScript File

//for vedio adds on page
    var pageid=-1;
    var Xcor;
    var Ycor;
    var vFromDate;
    var vToDate;
    var vUrl;



// Online Poll,Watch Video,Audio Jungle integrated by Khan17072009
    var PollXcor;
    var PollYcor;
    var vPollFromDate;
    var vPollToDate;
    var Pollpageid=-1;
    var PollUrl;

    var ProfileXcor;
    var ProfileYcor;
    var vProfileFromDate;
    var vProfileToDate;
    var Profilepageid=-1;
    var ProfileUrl;
    
    var ChekVideoReadXML=0;
    var ChekPollReadXML=0;
    var ChekProfileReadXML=0;
    
// End here Online Poll,Watch Video,Audio Jungle integrated by Khan17072009
// Start here Online Poll,Watch Video,Audio Jungle integrated by Khan17072009
 
// NewConfiguration Changes here done by Khan on 14082009
var ImageArrayReplace="";
function ReadXML()
{  

   if(GetConfigVideo!=0)
   {
          pageid=-2;
          if(AjaxUtilsMethods.getSession("UserEmail").value!="expired" && str_GetUserPrefFor2Page[1]!=0)
          {           
             strGetCurrentPageIndex=PgNumberFor2Page[currentpageindex];
          }
          else
          {
            ImageArrayReplace=ImageArray[currentpageindex].replace(".jpg","").split("_");
            strGetCurrentPageIndex=ImageArrayReplace[3];
          }

        var response=AjaxUtilsMethods.Readxml(strGetCurrentPageIndex-1,'1').value;
        var values1 = response.split(",");
        if((values1[0]==null)||(values1[0]==""))
        {
          ChekVideoReadXML="1";
        }
        else
        {
            ChekVideoReadXML="0";
            pageid = values1[0];
            Xcor = values1[1];
            Ycor = values1[2];
            vFromDate = values1[3] ;
            vToDate = values1[4] ;
            vUrl = values1[5] ;
         
        }
   } 
}
 
 function PollXML()
 {
     if(GetConfigPoll!=0)
     {
                  Pollpageid=-2;
                 if(AjaxUtilsMethods.getSession("UserEmail").value!="expired" && str_GetUserPrefFor2Page[1]!=0)
                  {
                     strGetCurrentPageIndex=PgNumberFor2Page[currentpageindex];
                  }
                  else
                  {
                    ImageArrayReplace=ImageArray[currentpageindex].replace(".jpg","").split("_");
                    strGetCurrentPageIndex=ImageArrayReplace[3];
                  }
                var Pollresponse=AjaxUtilsMethods.AdsReadxml(strGetCurrentPageIndex-1,'Poll','1').value;
                var Pollvalues = Pollresponse.split(",");
                if((Pollvalues[0]==null)||(Pollvalues[0]==""))
                {
                   ChekPollReadXML="1";
                }
                else
                {
                     ChekPollReadXML="0";
                     Pollpageid = Pollvalues[0];
                     PollXcor = Pollvalues[1];
                     PollYcor = Pollvalues[2];
                     vPollFromDate = Pollvalues[3] ;
                     vPollToDate = Pollvalues[4] ;
                }
     }
}
 
  function ProfileXML()
 {
 if(GetConfigOnlineForm!=0)
 {
             Profilepageid=-2;
               
              if(AjaxUtilsMethods.getSession("UserEmail").value!="expired" && str_GetUserPrefFor2Page[1]!=0)
              {
                 strGetCurrentPageIndex=PgNumberFor2Page[currentpageindex];
              }
              else
              {
                ImageArrayReplace=ImageArray[currentpageindex].replace(".jpg","").split("_");
                strGetCurrentPageIndex=ImageArrayReplace[3];
                
              }
            var Profileresponse=AjaxUtilsMethods.AdsReadxml(strGetCurrentPageIndex-1,'Profile','1').value;
            var Profilevalues = Profileresponse.split(",");
            if((Profilevalues[0]==null)||(Profilevalues[0]==""))
            {
               ChekProfileReadXML="1";
            }
            else
            {
                 ChekProfileReadXML="0";
                 Profilepageid = Profilevalues[0];
                 ProfileXcor = Profilevalues[1];
                 ProfileYcor = Profilevalues[2];
                 vProfileFromDate = Profilevalues[3] ;
                 vProfileToDate = Profilevalues[4] ;
            }
 }
}
 
 // End here NewConfiguration Changes here done by Khan on 14082009
 // End here Online Poll,Watch Video,Audio Jungle integrated by Khan17072009
 
 
function LoadAllAds(Sno)
{

// Start here  Online Poll,Watch Video,Audio Jungle integrated by Khan17072009  
    var str_FlashAdContent="";
    var str_DivContent="";
    var Chk_FlashAd="0";

    document.getElementById("soundeffect").src="";
    var objLoadingSeoshinAds = document.getElementById("div_SeoshinAds");

    objLoadingSeoshinAds.innerHTML="";
    objLoadingSeoshinAds.style.display="none";
    objLoadingSeoshinAds.style.visibility="hidden";

    document.getElementById("div_AudioPlayOthers").innerHTML="";
    document.getElementById("div_AudioPlayOthers").style.display="none";

    // End here  Online Poll,Watch Video,Audio Jungle integrated by Khan17072009  






// Seoshin Ads Display here
         
         // NewConfiguration Changes here done by Khan on 14082009
           if(AjaxUtilsMethods.getSession("UserEmail").value=="expired")
          {
            PreferenceData="Fail_0";
          }
         
          
          GetUserPrefFor2Page = PreferenceData;
          str_GetUserPrefFor2Page=GetUserPrefFor2Page.split("_");
          strGetCurrentPageIndex=0;
          if((GetUserPrefFor2Page!="Fail")&&(str_GetUserPrefFor2Page[1]!="0"))
          {
            currentpageFor2Page="";
            PgNumberFor2Page=str_GetUserPrefFor2Page[1].split(",");
            strGetCurrentPageIndex=PgNumberFor2Page[currentpageindex];
          }
          else
          {
            var ImageArrayReplace=ImageArray[currentpageindex].replace(".jpg","").split("_");
            strGetCurrentPageIndex=ImageArrayReplace[3];
          }
          var Audioresponse="";
          var valAudioresponse="";
          var Audiopageid="";
          if(GetConfigAudio!=0)
          {
             Audioresponse=AjaxUtilsMethods.AdsReadxml(strGetCurrentPageIndex-1,'Audio','1').value;
             valAudioresponse = Audioresponse.split(",");
             Audiopageid = valAudioresponse[0];
          } 
          // End here NewConfiguration 14082009
         
         // var Audioresponse=AjaxUtilsMethods.AdsReadxml(currentpageindex,'Audio').value;//AjaxUtilsMethods.AudioReadxml(currentpageindex).value;
         
        // var valAudioresponse = Audioresponse.split(",");
        // var Audiopageid = valAudioresponse[0];
        
         var AdvType="";
         var FlashAdresponse="";
         var valFlashAdresponse="";
         var Flashpageid="";
         
//         if(Audiopageid=="")
//         {
//             if(GetConfigSeoshinAds!=0)
//             {
//                 FlashAdresponse=AjaxUtilsMethods.AdsReadxml(strGetCurrentPageIndex-1,'SeoshinAds','1').value;
//                  valFlashAdresponse = FlashAdresponse.split(",");
//                  Flashpageid = valFlashAdresponse[0];
//                 AdvType="Flash";
//             }
//              
//         }
//         else
//         {
//              if(GetConfigSeoshinAds!=0)
//              {
//                FlashAdresponse=AjaxUtilsMethods.AdsReadxml(strGetCurrentPageIndex-1,'SeoshinAds','1').value;
//                alert(FlashAdresponse);
//                 valFlashAdresponse = FlashAdresponse.split(",");
//                 Flashpageid = valFlashAdresponse[0];
//                 if(Flashpageid!=null || Flashpageid!="")
//                 {
//                   AdvType="Flash";
//                 }
//              }
//            
//         }
             AdvType="";
             if(GetConfigSeoshinAds!=0)
             {
                 FlashAdresponse=AjaxUtilsMethods.AdsReadxml(strGetCurrentPageIndex-1,'SeoshinAds','1').value;
                  valFlashAdresponse = FlashAdresponse.split(",");
                  Flashpageid = valFlashAdresponse[0];
                  if(Flashpageid!=null || Flashpageid!="")
                  {
                   AdvType="Flash";
                  }
             }
             else
             {
             Chk_FlashAd="0";
             }
              
    
                         var PageNum=Sno+1;
                         var Browser=window.navigator.appName;
                         
                         // NewConfiguration Changes here done by Khan on 14082009
                        
                         if(AjaxUtilsMethods.getSession("UserEmail").value=="expired")
                          {
                            strGetCurrentPageIndex=strGetCurrentPageIndex-1
                          }
                          else
                          {
                             strGetCurrentPageIndex=parseInt(strGetCurrentPageIndex);
                          }

                          var strCurrentPageIndex="";
                          strCurrentPageIndex=strGetCurrentPageIndex;
                          if(strCurrentPageIndex.length=="1")
                          {
                            strCurrentPageIndex="00"+strGetCurrentPageIndex;
                          }
                          else if(strCurrentPageIndex.length=="2")
                          {
                            strCurrentPageIndex="0"+strGetCurrentPageIndex;
                          }
                          else
                          {
                            strCurrentPageIndex=strGetCurrentPageIndex;
                          }
                         
                          if(AjaxUtilsMethods.getSession("UserEmail").value=="expired")
                          {
                            strCurrentPageIndex=strCurrentPageIndex+1;
                          }
                          else
                          {
                            strCurrentPageIndex=strCurrentPageIndex;
                          }
                         // End here newConfiguration on 14082009
                         
                         
                         // if((AdvType=="Flash")&&(Flashpageid==PageNum))
                         if((AdvType=="Flash")&&(Flashpageid==strCurrentPageIndex))
                          {
                          
                                if(GetConfigSeoshinAds!=0)
                                   {
                                        var xmlFrom =valFlashAdresponse[3].split('/');
                                        var xmlTo = valFlashAdresponse[4].split('/');
                                        var xmlFrom1 =new Date(xmlFrom[1]+"/"+xmlFrom[2]+"/"+xmlFrom[0]);
                                        var xmlTo1 =new Date(xmlTo[1]+"/"+xmlTo[2]+"/"+xmlTo[0]);
                                        var Edate = selectedDate.split('/'); 
                                        var Edate1 =new Date(Edate[1]+"/"+Edate[2]+"/"+Edate[0]);
                                        if(Edate1>=xmlFrom1 && Edate1<=xmlTo1)
                                        {
                                             Chk_FlashAd="1";
                                             str_DivContent="<div id='flash_box' style='text-align:center;'>";
                                             str_DivContent=str_DivContent+"<div style='position: absolute; text-align: right; float: right; font-family: arial; font-size: 14px; font-weight: bold; color: rgb(0, 0, 0); width: 298px; top: 3px; left: 0px;'><a style='text-decoration: none; font-family: arial; font-size: 14px; font-weight: bold; color: rgb(0, 0, 0);' href='javascript:FlashDivClose()'>CLOSE</a></div>";
                                             str_FlashAdContent="<object id='FlashID' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='303'  height='252'>";
                                             // str_FlashAdContent=str_FlashAdContent+"<param name='movie' value='SeoshinAds/321.swf' />";
                                              str_FlashAdContent=str_FlashAdContent+"<param name='movie' value='../../../../../ads/SeoshinAds/" + valFlashAdresponse[5] + "' />";
                                             
                                             str_FlashAdContent=str_FlashAdContent+"<param name='quality' value='high' />";
                                             str_FlashAdContent=str_FlashAdContent+"<param name='wmode' value='transparent' />";
                                             str_FlashAdContent=str_FlashAdContent+"<param name='swfversion' value='6.0.65.0' />";
                                             str_FlashAdContent=str_FlashAdContent+"<param name='expressinstall' value='../../../../../SeoshinScripts/expressInstall.swf' />";
                                             str_FlashAdContent=str_FlashAdContent+"<object type='application/x-shockwave-flash' data='../../../../../ads/SeoshinAds/" + valFlashAdresponse[5] + "' width='303'  height='252'>";
                                             str_FlashAdContent=str_FlashAdContent+ "<param name='quality' value='high' />";
                                             str_FlashAdContent=str_FlashAdContent+ "<param name='wmode' value='transparent' />";
                                             str_FlashAdContent=str_FlashAdContent+ "<param name='swfversion' value='6.0.65.0' />";
                                             str_FlashAdContent=str_FlashAdContent+ "<param name='expressinstall' value='../../../../../SeoshinScripts/expressInstall.swf' />";
                                             str_FlashAdContent=str_FlashAdContent+"<div><h4>Content on this page requires a newer version of Adobe Flash Player.</h4><p>";
                                             str_FlashAdContent=str_FlashAdContent+"<a href='http://www.adobe.com/go/getflashplayer'><img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif'  alt='Get Adobe Flash player' /></a></p>";
                                             str_FlashAdContent=str_FlashAdContent+"</div></object></object>";
                                       }
                                   
                                   
                                   }
                           }
                         
                               // Code for Audio file Running.
                                
                                if(GetConfigAudio!=0)
                                {
                                     if(Audiopageid!="")
                                     {
                                         // NewConfiguration Changes here done by Khan on 14082009
                                         
                                          if(AjaxUtilsMethods.getSession("UserEmail").value=="expired")
                                          {
                                             strGetCurrentPageIndex=strGetCurrentPageIndex+1
                                          }
                                          else
                                          {
                                             strGetCurrentPageIndex=strGetCurrentPageIndex;
                                          }
                                     
                                          // if((Audiopageid==PageNum))
                                           if((Audiopageid==strGetCurrentPageIndex))
                                           {
                                                 
                                                var xmlFrom =valAudioresponse[3].split('/');
                                                var xmlTo = valAudioresponse[4].split('/');
                                                var xmlFrom1 =new Date(xmlFrom[1]+"/"+xmlFrom[2]+"/"+xmlFrom[0]);
                                                var xmlTo1 =new Date(xmlTo[1]+"/"+xmlTo[2]+"/"+xmlTo[0]);
                                                var Edate = selectedDate.split('/'); 
                                                var Edate1 =new Date(Edate[1]+"/"+Edate[2]+"/"+Edate[0]);
                                                if(Edate1>=xmlFrom1 && Edate1<=xmlTo1)
                                                {    
                                                
                                               
                                                            // var soundfile="podcast/music.mp3" //path to sound file, or pass in filename directly into playsound()
                                                            var soundfile="../../../../../ads/Audio/" + valAudioresponse[5] + ""
                                                            if(Browser=="Microsoft Internet Explorer")    
                                                            {
                                                              if (document.all && document.getElementById)
                                                                {
                                                                    document.getElementById("soundeffect").src="" //reset first in case of problems
                                                                    document.getElementById("soundeffect").src=soundfile
                                                                }
                                                            }
                                                            else
                                                            {
                                                                if(Browser!="Microsoft Internet Explorer")
                                                                {
                                                                   var str_PlayContent="<embed src='"+soundfile+"' style='height:0' MASTERSOUND  autostart='true' height='45' width='170' type='application/x-mplayer2' loop='0' volume='100%'></embed>";
                                                                   document.getElementById("div_AudioPlayOthers").innerHTML=str_PlayContent;
                                                                   document.getElementById("div_AudioPlayOthers").style.clear;
                                                                   document.getElementById("div_AudioPlayOthers").style.display="inline";
                                                                }
                                                            }
                                                            var objLoadSeoshinAdsDisable = document.getElementById("div_SeoshinAds");
                                                            objLoadSeoshinAdsDisable.innerHTML="";
                                                            objLoadSeoshinAdsDisable.style.display="none";
                                                            objLoadSeoshinAdsDisable.style.visibility="hidden";
                                                   }         
                                            }
                                     }
                                }
                               
                                
                          // }Configuration ends here
  // End here audio and seoshin ads display
  
  
  //  Start here Online Poll,Watch Video,Audio Jungle integrated by Khan17072009
	    if(Chk_FlashAd=="1")
	    {
	     var objLoadSeoshinAds = document.getElementById("div_SeoshinAds");
         objLoadSeoshinAds.style.display="block";
         objLoadSeoshinAds.style.visibility="visible";
         objLoadSeoshinAds.innerHTML=str_DivContent+str_FlashAdContent+"</div>";
	    
	    }
   //  End here Online Poll,Watch Video,Audio Jungle integrated by Khan17072009
	    
  
  
}