﻿
	
	            	

// JScript File
var showbtns=false; // for showing the showgallery and showvideo buttons in tpl
var checkVideoGallery = true;
var checkMap=true;




function movedown(divid)
{
														
	var val = navigator.userAgent; 
	//if(val.indexOf("Firefox") != -1)
    //{										        
    //var t = document.getElementById(divid).style.top
    //alert(t + "value in movedown")
	//t= t.replace("px","")
	//t  = (eval(t) + eval(13)) + "px";
	//document.getElementById(divid).style.top = t;
	//}
}

function moveup(divid)
{
	var val = navigator.userAgent; 

//	if(val.indexOf("Firefox") != -1)
//		{  										                
//		   alert(t + "value in moveup")
//	var t = document.getElementById(divid).style.top
//	t= t.replace("px","")
//	t  = (eval(t) - eval(13)) + "px";
//	document.getElementById(divid).style.top = t;
//		 } 
	}



function addValue(dropdown,txtbox)
    {
        drpValue = document.getElementById(dropdown).value
        txt = document.getElementById(txtbox)
        if (txt.value != "") {
            txt.value= txt.value + "," + drpValue}
        else{
            txt.value = drpValue}
    }
    function addValueMaster(dropdown,txtbox,master)
    {
        
        mdrpvalue = document.getElementById(master).value;
        drpValue = document.getElementById(dropdown).value;
        txt = document.getElementById(txtbox);
        
        if (txt.value != "") 
        {
            if (document.getElementById(master).style.display=="")
                txt.value= txt.value + "," + mdrpvalue + "." + drpValue;
            else
                txt.value= txt.value + "," + drpValue;
                
        }
        else
        {
            if (document.getElementById(master).style.display=="")
                txt.value = mdrpvalue + "." + drpValue;
            else
                txt.value= drpValue;
        }
    }

function confirmDelete(cId,delId)
    {
        var x=window.confirm("Are you sure")
        if (x)
        {
        window.location.href="showPage.aspx?contentid=" + cId + "&delid=" + delId
        }
   }
   
function showDiv(typ)
   {
    displaynone()
    
    if (typ=="cat")
    {
    displayNoneDestination()
    //document.getElementById("imgCat").style.display="block";
    //document.getElementById("CatDesDiv").style.display="block";
    //document.getElementById("categorynote").style.display="block";
    }
    
    if (typ=="tc")
    {
    document.getElementById("imgTc").style.display="block";
    document.getElementById("tcMapDiv").style.display="block";
    document.getElementById("trailsnote").style.display="block";
    document.getElementById("imgtcMap").src="images/explore_dest_gujaratmap.gif";// + imgSrc +"_map.jpg";
    }
    
    if (typ=="des")
    {
        displayShowDestination()
        document.getElementById("imgDes").style.display="block";
        //document.getElementById("CatDesDiv").style.display="block";
        document.getElementById("destinationNote").style.display="block";
    }
    
   }
   
function displaynone()
{
     
     //document.getElementById("imgCat").style.display="none";
     //document.getElementById("imgDes").style.display="none";
     //document.getElementById("imgTc").style.display="none";
     //document.getElementById("categoryDiv").style.display="none";
     //document.getElementById("tcDiv").style.display="none";
     //document.getElementById("tcMapDiv").style.display="none";
     //document.getElementById("CatDesDiv").style.display="none";
     document.getElementById("categoryResultDiv").style.display="none";
     //document.getElementById("tcResultDiv").style.display="none";
     document.getElementById("destinationNote").style.display="none";
     //document.getElementById("trailsnote").style.display="none";
     //document.getElementById("categorynote").style.display="none";

}

function displayNoneDestination()
{
 
   /* var destination = ["Palitana-Shatrunjaya","MarineNationalPark","Bhuj","Dholavira","Champaner-Pavagadh","Jamnagar","GirNationalPark","Ahmedabad","Vadodara","Patan","ModheraSunTemple","Surat","Rajkot","Lothal","Junagadh","Shamlaji","TarangaHills","Somnath","Ambaji","Dwarka","Dakor","VeravadarblackbuckNationalPark","WildAssSanctuary-LittleRann","NorthwestKutch","MandviBeach","VansdaNationalPark","PoloMonumentandVijaynagarForest","Vadnagar","NarmadaRiver","SaputaraHillStation"];
    for(i=0;i<=destination.length-1;i++)
	{
	    document.getElementById(destination[i]).style.display="none";
	}
	*/
}

function displayShowDestination()
{
 
    /*var destination = ["Palitana-Shatrunjaya","MarineNationalPark","Bhuj","Dholavira","Champaner-Pavagadh","Jamnagar","GirNationalPark","Ahmedabad","Vadodara","Patan","ModheraSunTemple","Surat","Rajkot","Lothal","Junagadh","Shamlaji","TarangaHills","Somnath","Ambaji","Dwarka","Dakor","VeravadarblackbuckNationalPark","WildAssSanctuary-LittleRann","NorthwestKutch","MandviBeach","VansdaNationalPark","PoloMonumentandVijaynagarForest","Vadnagar","NarmadaRiver","SaputaraHillStation"];
    for(i=0;i<=destination.length-1;i++)
	{
	     document.getElementById(destination[i]).style.display="block";
	}
	*/
}
   
   
   /*
how to use
http://localhost:3379/tcglcms/showpage.aspx?contentid=555&type=guide&location=137
window.gQueryString = new QueryString();
gQueryString.Read();
gQueryString.GetValue("type");
*/
function QueryString() {
	var data = [];
	this.Read = function() 
	{
		var aPairs, aTmp;
		var queryString = new String(window.location.search);
		queryString = queryString.substr(1, queryString.length); //remove "?"
		aPairs = queryString.split("&");	
		
		for (var i=0 ; i<aPairs.length; i++)
		{
			aTmp = aPairs[i].split("=");
			data[aTmp[0]] = aTmp[1];
		}
	}
	
	this.GetValue = function( key )
	{
		return data[key];
	}
	this.SetValue = function( key, value )
	{
		if (value == null)
			delete data[key];
		else 
			data[key] = value;
	}
	this.ToString = function()
	{
		var queryString = new String(""); 
		
		for (var key in data)
		{	
			if (queryString != "")
				queryString += "&"
			if (data[key])
				queryString += key + "=" + data[key];		
		}
		if (queryString.length > 0)
			return "?" + queryString;
		else
			return queryString;
	}
	this.Clear = function()
	{
		delete data;
		data = [];
	}
}

function rand(){
	var tem = Math.round(100000000000 - (50000000000 * Math.random(1)));
	return tem;	
}

function zoomimage(imagename,titles,img_description)
{

var img = new Image();
img.src = imagename;
widthf = img_description;
heightf = titles;
	
if(!widthf) widthf=img.width;
if(!heightf) heightf=img.height;
	
	widthf+=10;
	heightf+=20;
		
	if((!titles) && (img.height>heightf)) heightf=img.height+150;
	if((!img_description) && (img.width>widthf)) widthf=img.width+100;

	var noimage = false;
	if(img.height == 30 && img.width==28) noimage = true;

bgcol='#000000';
closefontcol='#FFFFFF';
t=100;
b=10;
desc_color="red";
height_increment="50";


	var tempmit = eval(rand().toString());
	var winstr='';
	if(imagename==''){alert("Please Provide Imagename");return;}
	if (titles!=''){winstr='<title>'+"TCGL"+'</title>';}else{winstr='<title>'+imagename+'</title>'}
	if (bgcol!=''){bgcolin=bgcol;}else{bgcolin='white';}
	winstr= winstr+'<body bgcolor='+bgcolin+'>';
	winstr= winstr+'<center><img id=img1 src='+imagename+'>';
	winstr= winstr+ '<br><font color='+desc_color+' face=verdana size=2>' +""+ '</font><br>' ;
	winstr= winstr+ '<a href=javascript:window.close();><font color='+closefontcol+' face=Arial size=2><b>Close</b></font></a>';
	winstr= winstr+ '</center></body>';
	//if no image is true then do not open window
	if(noimage==false)
	{
		tempmit = window.open('',eval(rand().toString()),'width=400,height=300,scrollbars=0,resizable=0');
		tempmit.document.writeln(winstr);
		tempmit.moveTo((screen.width-400)/2,(screen.height-300)/2);
	}
}




//var contentid=0;
//var tempX = 0;
//var tempY = 0;
//var IE;



//function showRevision(cid) {
////alert(cid)
//contentid = cid;
//IE = document.all?true:false;

//if (!IE) document.captureEvents(Event.MOUSEUP)
////document.onclick = getMouseXY;
//if (contentid != 0 )
//    {
//        document.getElementById(cid).onmouseup = getMouseXY;
//    }
//}

//function getMouseXY(e) 
//{
//    if (contentid != 0)
//    {
//        if (IE) 
//        { // grab the x-y pos.s if browser is IE
//        tempX =  event.clientX; //document.documentElement.scrollLeft;
//        tempY = event.clientY + document.documentElement.scrollTop;
//        }
//        else {  // grab the x-y pos.s if browser is NS
//        tempX = e.pageX;
//        tempY = e.pageY;
//        }
//    if (tempX < 0){tempX = 0;}
//    if (tempY < 0){tempY = 0;}
//    document.getElementById("showR").style.left=tempX + "px";
//    document.getElementById("showR").style.top=tempY + "px";
//    document.getElementById("showR").style.display="block";
//    }
//    else
//    {
//      document.getElementById("showR").style.display="none";    
//    }
//   
////contentid=0;
//return true;
//}

function opengallerywindow(url,wid,hgt)
{
    var WUrl = url;
    var WWid = wid;
    var Wht = hgt;
    var features = "width=" + WWid + ",height=" + Wht + ",status=No,menubar=No,toolbar=no,scrollbar=no,resizable=yes";
    galleryWindow = window.open (WUrl, "gwindow",features);
    galleryWindow.moveTo(0,0);
}

function showDestinationPage(drpid)//drpID)
{
    var url = "showpage.aspx?contentid="
    var contentId = document.getElementById(drpid).value;
    url = url + contentId
    window.location.href = url;
}

function galleryshow(showwhat)
{

    document.getElementById("ctl02_PhotoGalleryCtl1_webpartvideo").style.display="none";
    document.getElementById("ctl02_PhotoGalleryCtl1_wphotogallery").style.display="none";
    /*if (showwhat=="ctl02_PhotoGalleryCtl1_webpartvideo")
    {
        //setTable('pichander',2);
    }
    else
    {
        //setTable('pichander',3);
    }*/
    document.getElementById(showwhat).style.display="block";
}

//function setTable(id,status)
//{
//    try
//    {
//      /*  var td1 = document.getElementById("pichander");
//        if (td1 != "undefined")
//        {
//            if (status==1)
//            {
//                td1.style.display="none";
//            }
//            else if (status==2)
//            {
//                td1.style.backgroundImage="url()";
//            }
//            else
//            {
//                td1.style.backgroundImage="url(images/bg_map.jpg)";
//            }
//        }
//    }
//    catch(err)
//    {
//     /*   txt="There was an error on this page.\n\n";
//        txt+="Error description: " + err.description + "\n\n";
//        txt+="Click OK to continue.\n\n";
//        alert(txt);*/
//    }
//    
//}

function printpage()
{
      var divToPrint=document.getElementById("div_print");
    var WinPrint = window.open('','Preview','','')
			WinPrint.document.writeln('<HTML><HEAD><LINK href="css/style.css" type="text/css" rel="stylesheet"></Head>');
			WinPrint.document.writeln('<body onload="window.print();">');
			WinPrint.document.writeln('<Form id="frm">');
			WinPrint.document.write('<div style="background-color:#ffffff">' + divToPrint.innerHTML + '</div>');
			WinPrint.document.writeln('</form></body></HTML>');
			WinPrint.document.close();
			WinPrint.document.focus();
			//WinPrint.document.print();
			WinPrint.document.close();
}


function changelocation123(ctl)
{
    //alert("function called");
    var ctlvalue = document.getElementById(ctl).value;
    if (ctlvalue != "0")
    {
        window.location.href = "showpage.aspx?contentid=" + ctlvalue;
    }
}

function GetMarqueeContent(pl)
{
    var mq1;
    mq1 ='<marquee height="200px" width="190px" onmouseout="this.start();" onmouseover="this.stop();" scrollcount="0" direction="up" scrollamount="1" id="marq0">';
    mq1 += '<a class="normalText" href="showpage.aspx?contentid=1506"><b>Magdalla (Surat)</b></a><br/><span class="normalText">Magdalla (Surat) | Umergaon | Maroli | Valsad | Billimora | Onjal | Kolak | Umarsadi | Vansi Borsi</span><br /><br />'
    mq1 += '<a class="normalText" ><b>Bharuch</b></a><br/><span class="normalText">Bharuch | Bhagwa | Dahej | Khambhat</span><br /><br />'
    mq1 += '<a class="normalText" href="showpage.aspx?contentid=1512"><b>Bhavnagar</b></a><br/><span class="normalText">Bhavnagar | Ghogha | Talaja</span><br /><br />'
    mq1 += '<a class="normalText" href="showpage.aspx?contentid=1516"><b>Jaffrabad</b></a><br/><span class="normalText">Jaffrabad | Mahuva | Pipavav Victor | Port of Pipavav of | Gujarat Pipavav Port Limited (GPPL) | Rajpara</span><br /><br />'
    mq1 += '<a class="normalText" href="showpage.aspx?contentid=1497"><b>Veraval</b></a><br/><span class="normalText">Veraval | Navabandar | Kotda | Madhvad | Mangrol | Mul-Dwarka</span><br /><br />'
    mq1 += '<a href="showpage.aspx?contentid=1507" class="normalText"><b>Okha</b></a><br/>'
    mq1 += '<span class="normalText">Okha | Rupen (Dwarka) | Beyt</span><br /><br />'
    mq1 += '<a class="normalText"><b>Jamnagar</b></a><br/><span class="normalText">Jamnagar | Bedi (Including Rozi) | Pindhara | Salaya | Sikka | Jodiya</span><br /><br />'
    mq1 += '<a class="normalText" href="showpage.aspx?contentid=1502"><b>Navlakhi</b></a><br/><span class="normalText">Navlakhi</span><br /><br />'
    mq1 += '<a class="normalText" href="showpage.aspx?contentid=1514"><b>Mandvi</b></a><br/><span class="normalText">Mandvi | Mundra | New Mundra Port of Gujarat Adani Port Limited (GAPL) | Jakhau | Koteshwar</span><br /><br />'
    mq1 += '</marquee>'
    
    var mq2;
    mq2 = '<marquee height="200px" width="190px" onmouseout="this.start();" onmouseover="this.stop();" scrollcount="0" direction="up" scrollamount="1" id="marq1">';
    mq2 += '<a class="normalText" href="showpage.aspx?contentid=1584">Sikka</a><br /><br />';
    mq2 += '<a class="normalText" href="showpage.aspx?contentid=1504">Porbandar</a><br /><br />';
    mq2 += '<a class="normalText" href="showpage.aspx?contentid=1526">Bedi (Rozi)</a><br /><br />';
    mq2 += '<a class="normalText" href="showpage.aspx?contentid=1506">Magdalla</a><br /><br />';
    mq2 += '<a class="normalText" href="showpage.aspx?contentid=1520">Bhavnagar</a><br /><br />';
    mq2 += '<a class="normalText" href="showpage.aspx?contentid=1514" >Mandvi</a><br /><br />';
    mq2 += '<a class="normalText" href="showpage.aspx?contentid=1492">Dahej</a><br /><br />';
    mq2 += '<a class="normalText" href="showpage.aspx?contentid=1507">Okha</a><br /><br />';
    mq2 += '<a class="normalText" href="showpage.aspx?contentid=1502">Navlakhi</a><br /><br />';
    mq2 += '<a class="normalText" href="showpage.aspx?contentid=1516">Jafrabad</a><br /><br />';
    mq2 += '<a class="normalText" href="showpage.aspx?contentid=1497">Veraval</a><br /><br />';
    mq2 += '<a class="normalText"  href="showpage.aspx?contentid=1508">Mundra</a><br /><br />';
    mq2 += '</marquee>';
    
    var mq3;
    mq3 = '<marquee height="200px" width="190px" onmouseout="this.start();" onmouseover="this.stop();" scrollcount="0" direction="up" scrollamount="1" id="marq2">';
    mq3 += '<a class="normalText" href="showpage.aspx?contentid=1494">Pipavav</a><br /><br />';
    mq3 += '<a class="normalText" href="showpage.aspx?contentid=1524">Hazira</a><br /><br />';
    mq3 += '<a class="normalText">Mithivirdi</a><br /><br />';
    mq3 += '<a class="normalText">Vansi Borsi</a><br /><br />';
    mq3 += '<a class="normalText" href="showpage.aspx?contentid=1520">Dholera</a><br /><br />';
    mq3 += '<a class="normalText">Maroli</a><br /><br />';
    mq3 += '<a class="normalText">Simar</a><br /><br />';
    mq3 += '</marquee>';

    if (pl==1)
    {
       document.getElementById("divGmbPorts").innerHTML = mq1;
    }
    else if (pl==2)
    {
        document.getElementById("divgmboperated").innerHTML = mq2;
    }
    else if (pl==3)
    {
        document.getElementById("divPvtPorts").innerHTML = mq3;
    }
    
}


function handleEnter(e)
{
	var characterCode;
	if(e && e.which)
	{
		e = e;
		characterCode = e.which;
	} 
	else 
	{
		e = e;
		characterCode = e.keyCode;
	}

	if(characterCode == 13)
	{
		window.location.href='showpage.aspx?contentid=1499&query='+document.getElementById('txtsearch').value;
		return false;
	} 
	else
	{
		return true;
	}
}

function gsearch()
{
    
   if (document.getElementById('txtsearch').value!='')
    {
	    window.location.href='showpage.aspx?contentid=1499&query='+document.getElementById('txtsearch').value;
	}
}



function deldesignation(contentid,designationid)
{
 var chk= confirm("Confirm delete");
 if (chk == true)
 {
   window.location="showpage.aspx?contentid=" + contentid + '&delid=' + designationid;
 }
 
}
function showphotodiv(imgSource,typ)
{
 var divname="ctl00_ContentPlaceHolder1_DivPic";
 var imgname="ctl00_ContentPlaceHolder1_PicImage";
 var hidimagename="ctl00_ContentPlaceHolder1_hidpicimage";
 
     if (typ=='photo')
     {
        parent.document.getElementById(imgname).src=imgSource;
        parent.document.getElementById(imgname).style.width="76px";
        parent.document.getElementById(imgname).style.height="59px";
        parent.document.getElementById(divname).style.display="block";
        parent.document.getElementById(hidimagename).value=imgSource;
        parent.document.getElementById("loader").style.display="none"; 
        parent.document.getElementById("I1").style.display="none";           
        parent.document.getElementById("remove").style.display="block";
     }
}
function removePhoto()
{

var divname="ctl00_ContentPlaceHolder1_DivPic";
var imgname="ctl00_ContentPlaceHolder1_PicImage";  
    
parent.document.getElementById(imgname).src=""; 
parent.document.getElementById(imgname).style.width="0px";
parent.document.getElementById(imgname).style.height="0px";
    
var hidimagename="ctl00_ContentPlaceHolder1_hidpicimage";

parent.document.getElementById(divname).style.display="none";
parent.document.getElementById(hidimagename).value=""; 
parent.document.getElementById("I1").style.display="block";
parent.document.getElementById("remove").style.display="none";
}
