﻿// JScript File
function selectheadermenu(objlink)
{
    
    var objurl=window.location.href;
    objurl=objurl.toLowerCase();
    document.getElementById("lnkhome").className="";
    document.getElementById("lnkprofile").className="";
    document.getElementById("lnkservice").className="";
    document.getElementById("lnkportfolio").className="";
    document.getElementById("linkcontact").className="";
    document.getElementById("lnkcallback").className="";
    document.getElementById("linktestimonil").className="";
    
    if (objurl.indexOf("default.aspx")>=0)
    {
        document.getElementById("lnkhome").className="active";
    }
    else if (objurl.indexOf("profile.aspx")>=0)
    {
        document.getElementById("lnkprofile").className="active";
    }
    else if (objurl.indexOf("service.aspx")>=0)
    {
        document.getElementById("lnkservice").className="active";
    }
    else if (objurl.indexOf("portfolio.aspx")>=0)
    {
        document.getElementById("lnkportfolio").className="active";
    }
    else if (objurl.indexOf("contact_us.aspx")>=0)
    {
        document.getElementById("linkcontact").className="active";
    }
    else if (objurl.indexOf("callback.aspx")>=0)
    {
        document.getElementById("lnkcallback").className="active";
    }
    else if (objurl.indexOf("testimonials.aspx")>=0)
    {
        document.getElementById("linktestimonil").className="active";
    }  
    else if (objurl.indexOf("casestudies.aspx")>=0)
    {
        document.getElementById("lnkcaseStudy").className="active";
    }
      
}
/*----------------------------------------------*/
function textCounter(field,cntfieldid,maxlimit){
       	var cntfield=document.getElementById(cntfieldid);
		cntfield.value = field.value.length;
        var num = eval(Math.ceil(cntfield.value/160));		
		if(cntfield.value>=maxlimit)		{
			alert ("Sorry - there is a Max limit of "+maxlimit+" characters");
			field.value = field.value.substring(0,maxlimit-1)
			return false;
		}
		return true;}/*-------------------------------------------------*/function selelectknowmoremenu(){    var objurl=window.location.href;
    objurl=objurl.toLowerCase();
    document.getElementById("lnkknowprofile").className="";
    document.getElementById("lnkknowteam").className="";
    document.getElementById("lnkknowcostbenefits").className="";
    document.getElementById("lnkknownews").className="";
    document.getElementById("lnknowtestimonials").className="";        if (objurl.indexOf("profile.aspx")>=0)
    {
        document.getElementById("lnkknowprofile").className="active";
    }
    else if (objurl.indexOf("team.aspx")>=0)
    {
        document.getElementById("lnkknowteam").className="active";
    }
    else if (objurl.indexOf("cost_benefits.aspx")>=0)
    {
        document.getElementById("lnkknowcostbenefits").className="active";
    }
    else if (objurl.indexOf("news.aspx")>=0)
    {
        document.getElementById("lnkknownews").className="active";
    }    else if (objurl.indexOf("testimonials.aspx")>=0)
    {
        document.getElementById("lnknowtestimonials").className="active";
    }} function LoadMap()
        {   
          
           try
                {
                   
                     
                        var map = new GMap2(document.getElementById('map_canvas'));
                       
                        map.addControl(new GLargeMapControl());
                        map.addControl(new GMapTypeControl());
                         var center = new GLatLng('50.8318','-0.157371');
                         map.setCenter(center, 15);
                       
                        var marker = new GMarker(center, {draggable: false});
                        var add="<strong>Dotsquares Ltd.</strong><br />Charter House, 121-123 Davigdor Road,<br />Hove, East Sussex, BN3 1RE, UK";
                        GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(add);});
                        
                        map.addOverlay(marker);
                        document.getElementById('map_canvas').style.border = "1px solid #15355C;";
                       
                     
                  }
                  catch(ex)    
                  {
                     //alert(ex.message);
                  }
          
             
             
        }
/*-----------------------------------------------------------*/

function bookmarkPage(type)
{
    var windowString = '';
  	        

        if(type=='google') windowString='http://www.google.com/bookmarks/mark?op=add&amp;title='+encodeURIComponent(document.title)+'&bkmk='+encodeURIComponent(location.href)+'&labels='+addMetaInfo()[0]+'&annotation='+addMetaInfo()[1];
        if(type=='delicious') windowString='http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title);
	       
       if(type=='digg') windowString='http://digg.com/submit?phase=2&url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title)+'&amp;bodytext='+encodeURIComponent(document.description)+'&amp;topic="news"';
           if(type=='reddit') windowString='http://reddit.com/submit?url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title);   
       
    if(type=='facebook') windowString='http://www.facebook.com/sharer.php?u='+encodeURIComponent(location.href)+'&t='+encodeURIComponent(document.title);
     window.open(windowString,type,'toolbar=no,height=550,width=780,resizable=yes,status=yes,scrollbars=yes'); 
}

function HideShowOtherText(id, chkValue)
{
    if(chkValue)
    {
        document.getElementById(id).style.display='';        
    }
    else    
    {
        document.getElementById(id).style.display='none';
    }
}

function chkNumeric(e)
{
	var $retVal
	if(e.which != null) // Look for a Mozilla-compatible browser
	{ 
	   if((e.which>57 || e.which<48) && e.which!=46 && e.which!=8 && e.which!=0  && e.which!=191 )
		{
			$retVal= false;
		}   
        
	   else
			$retVal=true;
	}
	else
	{
		if((e.keyCode>57 || e.keyCode<48) && e.keyCode!=46 )
		{
			$retVal= false;
		}
		else
			$retVal=true;
	}
	return $retVal;
}


/// 6 jan 2010
function CheckDocs(source, args)
        {
            var id = 'ctl00_ContentPlaceHolder1_rptFiles_ctl0'
            var i=0;            
            var strExtensions = ",.pdf,.txt,.doc,.docx,.zip,.rar,";
            var returnValue = true;
            for(i=0;i<5;i++)
            {
                 var strFileName = document.getElementById(id + i + '_flupload').value;                            
                 if(strFileName!="")
                 {
                    var fileExt = strFileName.substr(strFileName.lastIndexOf('.')).toLowerCase();                        
                    if(strExtensions.indexOf(','+fileExt+',')==-1)
                    {
                        document.getElementById(id + i + '_lblError').innerHTML='Invalid extension file.';                        
                        returnValue=false;
                    }
                    else
                    {
                        document.getElementById(id + i + '_lblError').innerHTML='';                                                
                    }    
                 }
            }
            args.IsValid = returnValue;                 
        }
        
        
         function GetColId(obj)
    {
     var a=obj;
     var h=365;
     var colid
     if (a.id=="anc1")
     {
        h=365;
         colid=document.getElementById('ctl00_ContentPlaceHolder1_ddlQuote').options[document.getElementById('ctl00_ContentPlaceHolder1_ddlQuote').selectedIndex].value; //'<%=ddlQuote.Selectedvalue%>';
     }
     else
     {
        h=380;
         colid=document.getElementById('ctl00_ContentPlaceHolder1_ddlDevp').options[document.getElementById('ctl00_ContentPlaceHolder1_ddlQuote').selectedIndex].value; //'<%=ddlQuote.Selectedvalue%>';
     }
      window.open("uspsDetail.aspx?id=" + obj + "&colid=" + colid,"uspsDetail","left=50,height=" + h + ",Width=942,location=no,toolbar=no,resizable=no,scrollbars=no"); 
    }