    function ChangePage1(id)
			 {
					// save the page clicked
					document.getElementById("ctl00_hdnpage").value = id;
//					if(id==1)
//					{
//						//document.form1.PageStart1.value=""; 
//						
//					}
					// call the __doPostBack function to post back the form and execute the PageClick event
					
					__doPostBack('PageClick1','');
			 }
			 
			 function changebtnbg(id)
			 {
			   document.getElementById("button1").style.backgroundImage="url(media/bgbtncat.png)";
			   document.getElementById("button1").style.color="#000000";
			   document.getElementById("button2").style.backgroundImage="url(media/bgbtncat.png)";
			   document.getElementById("button2").style.color="#000000";
			   document.getElementById("button3").style.backgroundImage="url(media/bgbtncat.png)";
			   document.getElementById("button3").style.color="#000000";
			   document.getElementById("button4").style.backgroundImage="url(media/bgbtncat.png)";
			   document.getElementById("button4").style.color="#000000";
			   document.getElementById("button5").style.backgroundImage="url(media/bgbtncat.png)";
			   document.getElementById("button5").style.color="#000000";
			   document.getElementById("button6").style.backgroundImage="url(media/bgbtncat.png)";
			   document.getElementById("button6").style.color="#000000";
			   document.getElementById("button"+id).style.backgroundImage="url(media/bgcat_sel.png)";
			   document.getElementById("button"+id).style.color="#ffffff";
			 }
			 
			

function fnObeyLink(url) {
            //alert(url);
            window.location = url;
        }
        function clickclear(thisfield, defaulttext) {
            if (thisfield.value == defaulttext) {
                thisfield.value = "";
            }
        }

        function clickrecall(thisfield, defaulttext) {
            if (thisfield.value == "") {
                thisfield.value = defaulttext;
            }
        }

      function searchresult(sitename,domainName){
      //alert(document.frmSearch);
document.frmSearch.action=sitename+'/'+domainName+'/search/1/1/'
document.frmSearch.submit()
return false}	    

        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]; }
        }

               
        function openWindow(catid, itemid, pid, catname, lang, sitename, domainName) {

            var curlink = window.document.location.toString();
                window.open( sitename + "/"+ domainName +  '/Referlink/' + catid + "/" + itemid + "/" + pid + "/" + catname + "/" + lang + "/", 'popupTIPS', 'width=500,height=700,scrollbars=no');
            
        }
        
         function sendmail(catid, itemid, pid, catname, lang, sitename, domainName) {

            var curlink = window.document.location.toString();
                window.open( sitename + "/"+ domainName +  '/sendmail/' + catid + "/" + itemid + "/" + pid + "/" + catname + "/" + lang + "/", 'popupTIPS', 'width=500,height=700,scrollbars=no');
            
        }
        
       function addToFavorite(favTitle)
              { 
                  var title=favTitle; 
                  var url=location.href; 

                  if(window.sidebar){ 
                                      window.sidebar.addPanel(title, url,""); 
                                     }
                  else if( window.opera && window.print )
                                    { 
                                        var mbm = document.createElement('a'); 
                                        mbm.setAttribute('rel','sidebar'); 
                                        mbm.setAttribute('href',url); 
                                        mbm.setAttribute('title',title); 
                                        mbm.click(); 
                                    }
                                    else if(document.all){ 
                                        window.external.AddFavorite( url, unescape(favTitle)); 
                                } 
                  } 
                  
                function setbuttonover(id,img)  
                {
                  document.getElementById(id).src=img;
                }
                
                function setbuttonout(id,img)  
                {
                  document.getElementById(id).src=img;
                }
                  
               function setmouseover(top,mid,bullet,bot,txtid)   
               {
                document.getElementById(top).style.backgroundImage = "url(media/bg_acttop_sel.jpg)";
                document.getElementById(top).style.backgroundPosition="top";
                document.getElementById(top).style.backgroundRepeat ="no-repeat";
                document.getElementById(mid).style.backgroundImage = "url(media/bg_actsel_mid.jpg)";
                document.getElementById(mid).style.backgroundRepeat ="no-repeat";
                document.getElementById(mid).style.backgroundPosition="bottom";
                document.getElementById(mid).style.backgroundColor = "#FBB528" ;
                 document.getElementById(mid).style.borderLeft="0px solid";
                document.getElementById(mid).style.borderRight="0px solid";
                 document.getElementById(mid).style.width="346px";
                document.getElementById(bullet).src="media/bulletact_sel.png";
                document.getElementById(bot).style.backgroundImage = "url(media/bg_actbot_sel.jpg)";
                document.getElementById(bot).style.backgroundRepeat ="no-repeat"
                document.getElementById(bot).style.backgroundPosition="bottom";
                document.getElementById(txtid).style.color="#ffffff";
               }
               
               function setmouseout(top,mid,bullet,bot,txtid)   
               {
                document.getElementById(top).style.backgroundImage = "url(media/bg_acttop.jpg)";
                document.getElementById(top).style.backgroundPosition="top";
                document.getElementById(top).style.backgroundRepeat ="no-repeat";
                document.getElementById(mid).style.backgroundImage = "url(media/bg_actmid.jpg)";
                document.getElementById(mid).style.backgroundRepeat ="repeat-x";
                document.getElementById(mid).style.backgroundPosition="top";
                document.getElementById(mid).style.borderLeft="#DDDDDD 1px solid";
                document.getElementById(mid).style.borderRight="#DDDDDD 1px solid";
                 document.getElementById(mid).style.width="344px";
                document.getElementById(mid).style.backgroundColor = "#ffffff" ;
                document.getElementById(bullet).src="media/actbullet.png";
                document.getElementById(bot).style.backgroundImage = "url(media/bg_actbot.jpg)";
                document.getElementById(bot).style.backgroundRepeat ="no-repeat"
                document.getElementById(bot).style.backgroundPosition="bottom";
                 document.getElementById(txtid).style.color="#000000";
               }
              
              function leftsetmouseover(id,img,bulletid,txtid,topid,botid)
              {
                document.getElementById(id).style.backgroundImage = "url("+ img +")";
                document.getElementById(id).style.backgroundPosition="top";
                document.getElementById(id).style.backgroundRepeat ="no-repeat";
                document.getElementById(id).style.backgroundColor = "#F89E00";
                document.getElementById(id).style.borderLeft = "solid #F89E00 1px";
                document.getElementById(id).style.borderRight = "solid #F89E00 1px";
                document.getElementById(bulletid).src="media/leftmnubullet_sel.png";
                document.getElementById(txtid).style.color="#ffffff";
                 if(document.getElementById(topid)!=null)
                {
                  document.getElementById(topid).style.backgroundImage = "url(media/mnutopbg_sel.png)";
                  document.getElementById(topid).style.backgroundPosition="top";
                  document.getElementById(topid).style.backgroundRepeat ="no-repeat";
                }
                document.getElementById(botid).style.backgroundImage = "url(media/mnubotbg_sel.png)";
                document.getElementById(botid).style.backgroundPosition="bottom";
                document.getElementById(botid).style.backgroundRepeat ="no-repeat";
              }
              
              function leftsetmouseoout(id,img,bulletid,txtid,topid,botid)
              {
               document.getElementById(id).style.backgroundImage = "url("+ img +")";
               document.getElementById(id).style.backgroundPosition="top";
               document.getElementById(id).style.backgroundRepeat ="no-repeat";
               document.getElementById(id).style.backgroundColor = "#ffffff";
               document.getElementById(id).style.borderLeft = "solid #DDDDDD 1px";
               document.getElementById(id).style.borderRight = "solid #DDDDDD 1px";
               document.getElementById(bulletid).src="media/leftmnubullet.png";
               document.getElementById(txtid).style.color="#000000";
                if(document.getElementById(topid)!=null)
                {
                 document.getElementById(topid).style.backgroundImage = "url(media/mnutopbg.png)";
                 document.getElementById(topid).style.backgroundPosition="top";
                 document.getElementById(topid).style.backgroundRepeat ="no-repeat";
               }
               document.getElementById(botid).style.backgroundImage = "url(media/mnubotbg.png)";
               document.getElementById(botid).style.backgroundPosition="bottom";
               document.getElementById(botid).style.backgroundRepeat ="no-repeat";
              }
              
                 function leftsetmouseover1(id,img,bulletid,txtid,topid,botid)
              {
             
               document.getElementById(id).style.backgroundImage = "url("+ img +")";
                document.getElementById(id).style.backgroundPosition="top";
                document.getElementById(id).style.backgroundRepeat ="no-repeat";
                document.getElementById(id).style.backgroundColor = "#ffffff";
                document.getElementById(id).style.borderLeft = "solid #DDDDDD 1px";
                document.getElementById(id).style.borderRight = "solid #DDDDDD 1px";
                document.getElementById(bulletid).src="media/leftmnubullet.png";
                document.getElementById(txtid).style.color = "#000000";

                	
                if(document.getElementById(topid)!=null)
                {
                document.getElementById(topid).style.backgroundImage = "url(media/mnutopbg.png)";
                 document.getElementById(topid).style.backgroundPosition = "bottom";
                document.getElementById(topid).style.backgroundRepeat = "no-repeat";
                }
               document.getElementById(botid).style.backgroundImage = "url(media/mnubotbg.png)";
               document.getElementById(botid).style.backgroundPosition = "bottom";
               document.getElementById(botid).style.backgroundRepeat = "no-repeat";
             }
              
              function leftsetmouseoout1(id,img,bulletid,txtid,topid,botid)
              {
            
               document.getElementById(id).style.backgroundImage = "url("+ img +")";
                document.getElementById(id).style.backgroundPosition="top";
                document.getElementById(id).style.backgroundRepeat ="no-repeat";
                document.getElementById(id).style.backgroundColor = "#F89E00";
                document.getElementById(id).style.borderLeft = "solid #F89E00 1px";
               document.getElementById(id).style.borderRight = "solid #F89E00 1px";
                document.getElementById(bulletid).src="media/leftmnubullet_sel.png";
                 document.getElementById(txtid).style.color="#ffffff";
                 if(document.getElementById(topid)!=null)
                {
                 
                  document.getElementById(topid).style.backgroundImage = "url(media/mnutopbg_sel.png)";
                  document.getElementById(topid).style.backgroundPosition="top";
                  document.getElementById(topid).style.backgroundRepeat ="no-repeat";
                }
                document.getElementById(botid).style.backgroundImage = "url(media/mnubotbg_sel.png)";
                document.getElementById(botid).style.backgroundPosition="bottom";
                document.getElementById(botid).style.backgroundRepeat ="no-repeat";
                }
              
             function disDiv(id)
             {
               if (document.getElementById(id).style.display=="none")
               {
                 document.getElementById(id).style.display="block";
               }
               else
               {
                 document.getElementById(id).style.display="none";
               }
             } 
             
             function showdiv(id)
             {
              if(document.getElementById(id) !=null)
              {
               document.getElementById(id).style.display="block";
               }
             }
             
              function hidediv(id)
             {
               if(document.getElementById(id) !=null)
              {
              document.getElementById(id).style.display="none";
              }
             }
             
             
                  
           function setlesmerOver(id)
           {
               document.getElementById(id).src="media/btn_seedetailmo.jpg";
           }
           
           function setlesmerOut(id)
           {
               document.getElementById(id).src="media/btn_seemore.jpg";
           }
           
              function showselcatcount(leftid,rightid,botid,txtid,countid)
           {
               document.getElementById(leftid).style.backgroundImage = "url(media/bgbtncal_selleft.png)";
               document.getElementById(leftid).style.backgroundPosition="top left";
               document.getElementById(leftid).style.backgroundRepeat ="no-repeat";
               document.getElementById(rightid).style.backgroundImage = "url(media/bgbtncal_selright.png)";
               document.getElementById(rightid).style.backgroundPosition="top right";
               document.getElementById(rightid).style.backgroundRepeat ="repeat-x";
               document.getElementById(botid).style.backgroundImage = "url(media/btncatarrow.png)";
               document.getElementById(botid).style.backgroundPosition="top center";
               document.getElementById(botid).style.backgroundRepeat ="no-repeat";
               document.getElementById(txtid).style.color="#ffffff";
               document.getElementById(countid).style.display="none";
             }
           
           function showcatcount(leftid,rightid,botid,txtid,countid)
           {
           
               //alert(leftid);
               document.getElementById(leftid).style.backgroundImage = "url(media/bgbtncal_selleft.png)";
               document.getElementById(leftid).style.backgroundPosition="top left";
               document.getElementById(leftid).style.backgroundRepeat ="no-repeat";
               document.getElementById(rightid).style.backgroundImage = "url(media/bgbtncal_selright.png)";
               document.getElementById(rightid).style.backgroundPosition="top right";
               document.getElementById(rightid).style.backgroundRepeat ="repeat-x";
               document.getElementById(botid).style.backgroundImage = "url(media/btncatarrow.png)";
               document.getElementById(botid).style.backgroundPosition="top center";
               document.getElementById(botid).style.backgroundRepeat ="no-repeat";
               document.getElementById(txtid).style.color="#ffffff";
               document.getElementById(countid).style.display="block";
             }
           
           function hidecatcount(leftid,rightid,botid,txtid,countid)
           {
               document.getElementById(leftid).style.backgroundImage = "url(media/bgbtncat_left.png)";
               document.getElementById(leftid).style.backgroundPosition="top left";
               document.getElementById(leftid).style.backgroundRepeat ="no-repeat";
               document.getElementById(rightid).style.backgroundImage = "url(media/bgbtncat_right.png)";
               document.getElementById(rightid).style.backgroundPosition="right top";
               document.getElementById(rightid).style.backgroundRepeat ="repeat-x";
               document.getElementById(botid).style.backgroundImage = "none";
               document.getElementById(txtid).style.color="#000000";
               document.getElementById(countid).style.display="none";
             }
           
           function expandDiv(divid,imgid)
           {
             if (document.getElementById(divid).style.display=="none") {
//                 var strprojdetail = document.getElementById('<%=ltprojectviewdet%>').value
//                 alert(strprojdetail);
               document.getElementById(divid).style.display="block";
               document.getElementById(imgid).src = "../media/img_collapse.png";
               //alert(document.getElementById('txtfull').innerHTML);
//               document.getElementById('txtfull').innerHTML = "Minimer prosjekoversikt"
               
             }
             else
             {
               document.getElementById(divid).style.display="none";
               document.getElementById(imgid).src = "../media/imgexpand.png";
               //document.getElementById('txtfull').innerHTML = "Se full prosjektoversikt"
             }
           }
           

//---------------------------------------------------------Gallary -------------------------------------------------------//


var currentImgCount = 0;
var nextImgCunt = 1;
var prevImgCunt = -1;
var prevnumb = 0;
var i = 0;
var m = 0;
var timeDelay;
var IsSlideShow = 0;
var htmlresult2;
var ingHtml2 = "<div id='ingressDiv' style='visibility: hidden;'><div id='ctl00_middleSection_ctl00_Image_Ingress2' class='btmIngree2' runat='server' ></div></div>"

function FetchMediumImage2(img_name, imgextn, imgcount, imgdescr, obj, txtid) // onclick Thumb rotator img
{
   
    var p_para = img_name + imgextn;

   
    nextImgCunt = imgcount + 1;
    currentImgCount = imgcount;
    prevImgCunt = imgcount - 1;

    IsSlideShow = 0;
    i = currentImgCount;
    var tid = "txt_" + currentImgCount;
   

    document.getElementById("txt_" + prevnumb).style.textDecoration = "none";

    document.getElementById("txt_" + currentImgCount).style.textDecoration = "underline";

    prevnumb = currentImgCount
    var str_GalleryImg = "";

    var prevGal = "";


    for (var i = 0; i <= imgcount - 1; i++) {
        prevGal += " " + limage[i];

    }



    for (var i = imgcount + 1; i < limage.length; i++) {
        str_GalleryImg += " " + limage[i];

       
    }
    
    for (var i = 0; i < imgstr.length; i++)
    {
      document.getElementById("bullet_" + i).src="media/imgdot.png";
    }


document.getElementById("bullet_"+currentImgCount).src="media/imgdot_sel.png";

    var currentHtml = imgstr[currentImgCount].replace(',', '');

    htmlresult2 = prevGal + imgstr[currentImgCount] + str_GalleryImg;

    var hashValue = "#deta";
    window.location.hash = hashValue;
    


    if (document.getElementById("Image_Container_2") != null) {
        jQuery(document).ready(function ($) {
            if (eff == "fade") {
               $('#Image_Container_2 a img').fadeOut('2000');
                $('#photo1' + currentImgCount).fadeIn('80');
                 document.getElementById("Image_Container_2").style.width=width[currentImgCount].replace(";","")+"px";
                 document.getElementById("Image_Container_2").style.height=height[currentImgCount].replace(";","")+"px";
            }
            else {
                $("#Image_Container_2").html(htmlresult2);
            }
            fadeTargetId = 'photo1' + currentImgCount;
            f1(currentImgCount);
        });
    }


      if (document.getElementById("ctl00_middleSection_ctl00_Image_Ingress") != null)
	      {
	          document.getElementById("ctl00_middleSection_ctl00_Image_Ingress").innerHTML = decodeURI(encodeURI(imageIngress[currentImgCount]));
	          //       alert(imageIngress[currentImgCount]);
	         
	      }
	      else
	      {
	        
	        if (imageIngress[currentImgCount] != "") {
	             document.getElementById("ctl00_middleSection_ctl00_Image_Ingress").innerHTML = decodeURI(encodeURI(imageIngress[currentImgCount]));
                 document.getElementById("Image_Ingress").style.display = "";
	          }
	          else {
   if (document.getElementById("ctl00_middleSection_ctl00_Image_Ingress") != null)
	      {
	              document.getElementById("ctl00_middleSection_ctl00_Image_Ingress").style.display = "none";
	              }
	          }

	      }

	      
	       if (document.getElementById("ctl00_middleSection_ctl00_imgTitle") !=null)
	      {
	      
	       if (imagetitle[currentImgCount] !="")
	       {
	        document.getElementById("ctl00_middleSection_ctl00_imgTitle").innerHTML=imagetitle[currentImgCount];
	        document.getElementById("ctl00_middleSection_ctl00_imgTitle").style.display="block";
	       }
	        else
	      {
	         document.getElementById("ctl00_middleSection_ctl00_imgTitle").style.display="none";
	      }
	      }

    
      if (currentImgCount==0)
        {
          document.getElementById("galprev").style.display="none";
         }
         else{document.getElementById("galprev").style.display="block";}
         
      if (currentImgCount == imagepath.length-1)   
      {
         document.getElementById("galnext").style.display="none";
      }
      else{document.getElementById("galnext").style.display="block";}
    jQuery(document).ready(function ($) {
     $('#Image_Container_2 a img').load(function () {
     $('#Image_Container_2').width($('#Image_Container_2 a img').width());
     $('#Image_Container_2').height($('#Image_Container_2 a img').height());
  
        $('.btmIngree2').width($('#Image_Container_2 a img').width() - 32);
        $('.btmIngree2').css({ top: ($('#Image_Container_2 a img').height() - ($('#ingressDiv div').height() + 32)) });
        $('#ingressDiv').css('visibility', 'visible');
    });
    });
}


function GetNextImage2()     //Function To Show Next Image
{
    if (nextImgCunt < imagepath.length) {
        
        //if (currentImgCount < imagepath.length) {
        //alert(imagepath.length);
        //alert("next" + currentImgCount);
        //GetMediumImage.GetImage_Next(currentImgCount,imagepath,imageIngress,OnWSRequestComplete, OnWSRequestFailed);

        nextImgCunt += 1;
      // alert(currentImgCount);
//         if(currentImgCount==imagepath.length)
//         {
//          currentImgCount=1;
//         }
//         else if(currentImgCount+1==imagepath.length)
//         {
//            currentImgCount=0;
//         }
//         else
//         {
           currentImgCount += 1;
//          }
      
        prevImgCunt += 1;
        
        IsSlideShow = 0;
        i = currentImgCount;
        
        
      //  alert(currentImgCount);
      
        var str_GalleryImg = "";
        var prevGal = "";

        for (var i = 0; i <= currentImgCount - 1; i++) {
            prevGal += " " + limage[i];
            //alert(prevGal[i]);sde
        }

        //alert(limage.length);

        for (var i = currentImgCount + 1; i < limage.length; i++) {
            str_GalleryImg += " " + limage[i];

            //alert(str_GalleryImg[i]);
        }



        for (var i = 0; i < imgstr.length; i++) {
            
            document.getElementById("bullet_" + i).src = "media/imgdot.png";
        }

        
//        if (currentImgCount < imagepath.length) {
            
            document.getElementById("bullet_" + currentImgCount).src = "media/imgdot_sel.png";
//        }
//        else {
//            alert("test else");
//            var last = currentImgCount - 1;
//            document.getElementById("bullet_" + last).src = "media/imgdot_sel.png";
//        }
        htmlresult2 = prevGal + imgstr[currentImgCount] + str_GalleryImg
        var hashValue = "#deta";
        window.location.hash = hashValue;
//        if (document.getElementById("Image_Container_2") != null) {
//            document.getElementById("Image_Container_2").innerHTML = htmlresult2;
//            fadeTargetId = 'photo1' + currentImgCount;
//            var temp = currentImgCount;
//            f1(currentImgCount);
//          }

        if (document.getElementById("Image_Container_2") != null) {
            jQuery(document).ready(function ($) {
                if (eff == "fade") {
                   // $('#photo1' + currentImgCount).css("left", (($('#Image_Container_2').width()) - ($('#photo1' + currentImgCount).width())) / 2);
                    $('#Image_Container_2 a img').fadeOut('2000');
                    $('#photo1' + currentImgCount).fadeIn('80');
                    document.getElementById("Image_Container_2").style.width=width[currentImgCount].replace(";","")+"px";
                    document.getElementById("Image_Container_2").style.height=height[currentImgCount].replace(";","")+"px";
                }
                else {
                    $("#Image_Container_2").html(htmlresult2);
                }
                fadeTargetId = 'photo1' + currentImgCount;
                f1(currentImgCount);
            });
        }

        if (document.getElementById("ctl00_middleSection_ctl00_Image_Ingress") != null)
	      {
	          document.getElementById("ctl00_middleSection_ctl00_Image_Ingress").innerHTML = decodeURI(encodeURI(imageIngress[currentImgCount]));
	          //       alert(imageIngress[currentImgCount]);
	         
	      }
	      else
	      {
	        
	        if (imageIngress[currentImgCount] != "") {
	             document.getElementById("ctl00_middleSection_ctl00_Image_Ingress").innerHTML = decodeURI(encodeURI(imageIngress[currentImgCount]));
                 document.getElementById("Image_Ingress").style.display = "";
	          }
	          else {
   if (document.getElementById("ctl00_middleSection_ctl00_Image_Ingress") != null)
	      {
	              document.getElementById("ctl00_middleSection_ctl00_Image_Ingress").style.display = "none";
	              }
	          }

	      }


    if (document.getElementById("ctl00_middleSection_ctl00_imgTitle") !=null)
	      {
	      
	       if (imagetitle[currentImgCount] !="")
	       {
	        document.getElementById("ctl00_middleSection_ctl00_imgTitle").innerHTML=imagetitle[currentImgCount];
	        document.getElementById("ctl00_middleSection_ctl00_imgTitle").style.display="block";
	       }
	        else
	      {
	         document.getElementById("ctl00_middleSection_ctl00_imgTitle").style.display="none";
	      }
	      }

        
        if (currentImgCount > 0)
        {
         document.getElementById("galprev").style.display="block";
        }
        
           if(currentImgCount==imagepath.length-1)
         {
           document.getElementById("galnext").style.display="none";
         }
         else{document.getElementById("galnext").style.display="block";}



        //          if (document.getElementById("ctl00_ctl10_Image_Ingress") !=null)
        //	      {
        //	        document.getElementById("ctl00_ctl10_Image_Ingress").innerHTML=imageIngress[currentImgCount];
        //	      }
        //	      else
        //	      {
        //	        document.getElementById("ctl00_ctl10_Image_Ingress").innerHTML=imageIngress[currentImgCount];
        //	      }

        //           var temp = new String(imageIngress[currentImgCount]);  
        // alert(temp);  
        // temp = temp.replace(/[^a-zA-Z 0-9]+/g,'<br>');  
        // alert(temp);    
        //              
        //  alert(imageIngress[currentImgCount]);
        //        if (document.getElementById("ctl00_ctl10_Image_Ingress1") != null) {
        //            document.getElementById("ctl00_ctl10_Image_Ingress1").innerHTML = ingHtml2 + imageIngress[currentImgCount];

        //        }
        //        else {

        //            if (imageIngress[currentImgCount] != "") {

        //                document.getElementById("ctl00_middleSection_ctl00_Image_Ingress2").innerHTML = imageIngress[currentImgCount];
        //                //document.getElementById("thumbbotContainer").style.display = "";

        //            }
        //            else {
        //                document.getElementById("ctl00_middleSection_ctl00_Image_Ingress2").style.display = "none";
        //                //document.getElementById("thumbbotContainer").style.display = "none";
        //            }
        //        }



        //        if (document.getElementById("ctl00_middleSection_ctl00_imgTitle") != null) {
        //            //document.getElementById("ctl00_middleSection_ctl00_imgTitle").innerHTML = imagetitle[currentImgCount];
        //        }

   // }
//    else {
//        //alert("test");
//        i = 0;
//        currentImgCount = 0
//        clearTimeout(timeDelay);
////        timeDelay = setTimeout("SlideShow(0)", 4000);
//        //alert(timeDelay);
//        //alert("next" + currentImgCount);
//         SlideShow();
//        
}
    
    jQuery(document).ready(function ($) {
        $('#Image_Container_2 a img').load(function () {
            $('#Image_Container_2').width($('#Image_Container_2 a img').width());
            $('#Image_Container_2').height($('#Image_Container_2 a img').height() );

        $('.btmIngree2').width($('#Image_Container_2 a img').width() - 32);
        
        $('.btmIngree2').css({ top: ($('#Image_Container_2 a img').height() - ($('#ingressDiv div').height() + 32)) });
        $('#ingressDiv').css('visibility', 'visible');
    });
});

}

function GetPrevImage2()    //Function To Show Previous Image
{
   if (prevImgCunt != -1) {
        //GetMediumImage.GetImage_Previous(currentImgCount,imagepath,imageIngress,OnWSRequestComplete, OnWSRequestFailed);
      
        nextImgCunt -= 1;
        prevImgCunt -= 1;
        currentImgCount -= 1;
        IsSlideShow = 0;
        i = currentImgCount;

        var str_GalleryImg = "";

        var prevGal = "";
        //alert(currentImgCount);


        for (var i = 0; i <= currentImgCount - 1; i++) {
            prevGal += " " + limage[i];
            //alert(prevGal[i]);
        }

        //alert(limage.length);

        for (var i = currentImgCount + 1; i < limage.length; i++) {
            str_GalleryImg += " " + limage[i];

            //alert(str_GalleryImg[i]);
        }

        for (var i = 0; i < imgstr.length; i++)
        {
            document.getElementById("bullet_" + i).src="media/imgdot.png";
        }
//        alert("prev"+currentImgCount);
        document.getElementById("bullet_"+currentImgCount).src="media/imgdot_sel.png";

        htmlresult2 = prevGal + imgstr[currentImgCount] + str_GalleryImg
        var hashValue = "#deta";
        window.location.hash = hashValue;

        //alert(htmlresult2);
//        if (document.getElementById("Image_Container_2") != null) 
//        {
//           document.getElementById("Image_Container_2").innerHTML = htmlresult2;
//           fadeTargetId = 'photo1' + currentImgCount;
//           f1(currentImgCount);
//        }


        if (document.getElementById("Image_Container_2") != null) {
            jQuery(document).ready(function ($) {
                if (eff == "fade") {
                   // $('#photo1' + currentImgCount).css("left", (($('#Image_Container_2').width()) - ($('#photo1' + currentImgCount).width())) / 2);
                    $('#Image_Container_2 a img').fadeOut('2000');
                    $('#photo1' + currentImgCount).fadeIn('80');
                     document.getElementById("Image_Container_2").style.width=width[currentImgCount].replace(";","")+"px";
                          document.getElementById("Image_Container_2").style.height=height[currentImgCount].replace(";","")+"px";
                }
                else {
                    $("#Image_Container_2").html(htmlresult2);
                }
                fadeTargetId = 'photo1' + currentImgCount;
                f1(currentImgCount);
            });
        }



    if (document.getElementById("ctl00_middleSection_ctl00_Image_Ingress") != null)
	      {
	          document.getElementById("ctl00_middleSection_ctl00_Image_Ingress").innerHTML = decodeURI(encodeURI(imageIngress[currentImgCount]));
	          //       alert(imageIngress[currentImgCount]);
	         
	      }
	      else
	      {
	        
	        if (imageIngress[currentImgCount] != "") {
	             document.getElementById("ctl00_middleSection_ctl00_Image_Ingress").innerHTML = decodeURI(encodeURI(imageIngress[currentImgCount]));
                 document.getElementById("Image_Ingress").style.display = "";
	          }
	          else {
   if (document.getElementById("ctl00_middleSection_ctl00_Image_Ingress") != null)
	      {
	              document.getElementById("ctl00_middleSection_ctl00_Image_Ingress").style.display = "none";
	              }
	          }

	      }
	      
	       if (document.getElementById("ctl00_middleSection_ctl00_imgTitle") !=null)
	      {
	      
	       if (imagetitle[currentImgCount] !="")
	       {
	        document.getElementById("ctl00_middleSection_ctl00_imgTitle").innerHTML=imagetitle[currentImgCount];
	        document.getElementById("ctl00_middleSection_ctl00_imgTitle").style.display="block";
	       }
	        else
	      {
	         document.getElementById("ctl00_middleSection_ctl00_imgTitle").style.display="none";
	      }
	      }

        
        if (currentImgCount==0)
        {
          document.getElementById("galprev").style.display="none";
          document.getElementById("galnext").style.display="block";
        }
        else{document.getElementById("galprev").style.display="block";document.getElementById("galnext").style.display="block";}

// if (currentImgCount==0)
//       {
//         // alert(imagepath.length);
//          currentImgCount=imagepath.length;
//      }


        //	        if (document.getElementById("ctl00_ctl10_Image_Ingress") !=null)
        //	      {
        //	        document.getElementById("ctl00_ctl10_Image_Ingress").innerHTML=imageIngress[currentImgCount];
        //	      }
        //	      else
        //	      {
        //	        document.getElementById("ctl00_ctl10_Image_Ingress").innerHTML=imageIngress[currentImgCount];
        //	      }
//        if (document.getElementById("ctl00_ctl10_Image_Ingress1") != null) {
//            document.getElementById("ctl00_ctl10_Image_Ingress1").innerHTML = ingHtml2 + imageIngress[currentImgCount];
//        }
//        else {

//            if (imageIngress[currentImgCount] != "") {

//                document.getElementById("ctl00_middleSection_ctl00_Image_Ingress2").innerHTML = imageIngress[currentImgCount];
//                //document.getElementById("thumbbotContainer").style.display = "";

//            }
//            else {
//                document.getElementById("ctl00_middleSection_ctl00_Image_Ingress2").style.display = "none";
//                //document.getElementById("thumbbotContainer").style.display = "none";
//            }

//        }

//        if (document.getElementById("ctl00_middleSection_ctl00_imgTitle") != null) {
//            //document.getElementById("ctl00_middleSection_ctl00_imgTitle").innerHTML = imagetitle[currentImgCount];
//        }
   }
   
    jQuery(document).ready(function ($) {
        $('#Image_Container_2 a img').load(function () {
            $('#Image_Container_2').width($('#Image_Container_2 a img').width());
            $('#Image_Container_2').height($('#Image_Container_2 a img').height() );
        $('.btmIngree2').width($('#Image_Container_2 a img').width() - 32);
        
        $('.btmIngree2').css({ top: ($('#Image_Container_2 a img').height() - ($('#ingressDiv div').height() + 32)) });
        $('#ingressDiv').css('visibility', 'visible');
    });
});
}

  m = 1;

  function SlideShow(para)      //Function To Show Slideshow
{
//alert(para);
 //alert(speed);
 
// debugger;
 

  
    if (para == "undefined") {
       IsSlideShow = (IsSlideShow == 0) ? 1 : 0;
    }

    if (IsSlideShow == 1) {

        var str_GalleryImg = "";

        var prevGal = "";

        for (var j = 0; j <= currentImgCount; j++) {
            prevGal += " " + limage[j];
            //alert(currentImgCount);
        }

        //alert(limage.length);

        for (var k = currentImgCount + 2; k < limage.length; k++) {
            str_GalleryImg += " " + limage[k];
            //alert(k);
        }


        if (m <= imagepath.length - 1) {
            //GetMediumImage.GetImage_slideshow(i,imagepath,imageIngress, OnWSRequestComplete,OnWSRequestFailed);
            currentImgCount = m;
            prevImgCunt = m - 1;
            nextImgCunt = m + 1;
            m++;
           
            for (var n = 0; n < imgstr.length; n++) {
                document.getElementById("bullet_" + n).src = "media/imgdot.png";
            }
            //alert("currentImgCount " + currentImgCount);
            document.getElementById("bullet_" + currentImgCount).src = "media/imgdot_sel.png";

            //prevGal1[i]=limage[i];

            //str_GalleryImg1[i]=limage[i];
            //alert(i);

            htmlresult2 = prevGal + imgstr[currentImgCount] + str_GalleryImg

            var hashValue = "#deta";
            window.location.hash = hashValue;
            //alert(htmlresult);
//            if (document.getElementById("Image_Container_2") != null) {
//                document.getElementById("Image_Container_2").innerHTML = htmlresult;
//                fadeTargetId = 'photo1' + currentImgCount;
//                f1(currentImgCount);
//             }


            if (document.getElementById("Image_Container_2") != null) {
                jQuery(document).ready(function ($) {
                    if (eff == "fade") {
                        //$('#photo1' + currentImgCount).css("left", (($('#Image_Container_2').width()) - ($('#photo1' + currentImgCount).width())) / 2);
                        //alert(m);
                        $('#Image_Container_2 a img').fadeOut('2000');
                        $('#photo1' + currentImgCount).fadeIn('80');
                        document.getElementById("Image_Container_2").style.width=width[currentImgCount].replace(";","")+"px";
                        document.getElementById("Image_Container_2").style.height=height[currentImgCount].replace(";","")+"px";
                     //document.getElementById("Image_Container_2").style.height="auto";
                           //document.getElementById("Image_Container_2").style.width=width[currentImgCount].replace(";","")+"px";
                       // alert(width[currentImgCount]);
                        //$('#Image_Container_2').width($('#Image_Container_2 a img').width());
                    }
                    else {
                        $("#Image_Container_2").html(htmlresult2);
                    }
                    fadeTargetId = 'photo1' + currentImgCount;
                    f1(currentImgCount);
                });
            }
            
            //alert(document.getElementById("ctl00_middleSection_ctl00_Image_Ingress"));
            
             if (document.getElementById("ctl00_middleSection_ctl00_Image_Ingress") != null)
	      {
	          document.getElementById("ctl00_middleSection_ctl00_Image_Ingress").innerHTML = decodeURI(encodeURI(imageIngress[currentImgCount]));
	          //       alert(imageIngress[currentImgCount]);
	         
	      }
	      else
	      {
	        
	        if (imageIngress[currentImgCount] != "") {
	             document.getElementById("ctl00_middleSection_ctl00_Image_Ingress").innerHTML = decodeURI(encodeURI(imageIngress[currentImgCount]));
                 document.getElementById("Image_Ingress").style.display = "";
	          }
	          else {
   if (document.getElementById("ctl00_middleSection_ctl00_Image_Ingress") != null)
	      {
	              document.getElementById("ctl00_middleSection_ctl00_Image_Ingress").style.display = "none";
	              }
	          }

	      }
	      
	       if (document.getElementById("ctl00_middleSection_ctl00_imgTitle") !=null)
	      {
	      
	       if (imagetitle[currentImgCount] !="")
	       {
	        document.getElementById("ctl00_middleSection_ctl00_imgTitle").innerHTML=imagetitle[currentImgCount];
	        document.getElementById("ctl00_middleSection_ctl00_imgTitle").style.display="block";
	       }
	        else
	      {
	         document.getElementById("ctl00_middleSection_ctl00_imgTitle").style.display="none";
	      }
	      }


    if (currentImgCount==0)
        {
          document.getElementById("galprev").style.display="none";
          document.getElementById("galnext").style.display="block";
        }
        else{document.getElementById("galprev").style.display="block";document.getElementById("galnext").style.display="block";}
        
           if(currentImgCount==imagepath.length-1)
         {
           document.getElementById("galnext").style.display="none";
         }
         else{document.getElementById("galnext").style.display="block";}
         timeDelay = setTimeout("SlideShow(0)",strspeed);
      }

    if (m == imagepath.length) {
            m = 0;
            currentImgCount = 0;
            clearTimeout(timeDelay);
            timeDelay = setTimeout("SlideShow(0)",strspeed);
            
        }
     }
    else {
        IsSlideShow = 0;
        clearTimeout(timeDelay);
    }

//alert('test');
    jQuery(document).ready(function ($) {
   // alert('test1');
        $('#Image_Container_2 a img').load(function () {
        //alert('test2');
            $('#Image_Container_2').width($('#Image_Container_2 a img').width());
            $('#Image_Container_2').height($('#Image_Container_2 a img').height() );
            $('.btmIngree2').width($('#Image_Container_2 a img').width() - 32);

            $('.btmIngree2').css({ top: ($('#Image_Container_2 a img').height() - ($('#ingressDiv div').height() + 32)) });
            $('#ingressDiv').css('visibility', 'visible');
        });
    });

    
}
