

/* **** Google Analytics code start ***** */
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-395793-11']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

/* ***** Google Analytics code end ***** */




function Set_Cookie( name, value, expires, path, domain, secure )
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct
expires time, the current script below will set
it for x number of days, to make it for hours,
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
//expires = expires * 1000 * 60 * 60 * 24;
expires = expires * 1000 * 60 * 60 ;
}
var expires_date = new Date( today.getTime() + (expires) );

var cookieval= name + "=" + value  +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );

//alert(cookieval);
document.cookie = cookieval;
}


function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );


		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}
				


function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      //return pair[1];
	return true;
    }
  }
  return false;
}





// this function gets the cookie, if it exists
// don't use this, it's weak and does not handle some cases
// correctly, this is just to maintain legacy information
function Get_Cookie( name ) {

var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
	



// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
	
 

if( getQueryVariable("f")  ){

Set_Cookie( "telepoll_fullsite_entry","Yes", 1 );

}


fullsite_entry_cookie_val = Get_Cookie( "telepoll_fullsite_entry" );

//alert(fullsite_entry_cookie_val);

if( fullsite_entry_cookie_val != "Yes" ){

// Resolution Redirect Code From: http://www.DesignerWiz.com - Development Resource & JavaScript Public Archive Center 

 if ( (screen.width >= '640') && (screen.height >= '480') ) {
//   window.location.href = "https://www.medipac.com/medipac-travel-insurance/home";
 } else if (''!='f')
 {
    window.location.href = "http://mobile.telepoll.net/";
 }	

}


/* ***** function to open and close div contents (eg: service list) start ***** */
function faqToggle(divID)
{

  
  var divDisplay = document.getElementById("faq"+divID+"p").style.display;

  for (var i=0; i<30; i++)
  {
	if (document.getElementById("faq"+i+"p"))
      document.getElementById("faq"+i+"p").style.display = '';   
 
  }

  if (divDisplay == 'block')
    document.getElementById("faq"+divID+"p").style.display = '';
  else	
    document.getElementById("faq"+divID+"p").style.display = 'block';  
  return false;	
}
/* ***** function to open and close div contents (eg: service list) end ***** */


/* ***** function to fill the member count in quick quote page start***** */
function loadMemberCount(){
	selBox=document.getElementById('membernos');
	for( st=5000 ; st <= 50000 ; st=st+1000 ) {
		selBox.options[selBox.options.length] = new Option( st, st );
	}

}
/* ***** function to fill the member count in quick quote page end***** */


/* ***** function to clear result cobtainer start***** */
function clearResultBox(){
if( document.getElementById('result') )
document.getElementById('result').innerHTML='';
}
/* ***** function to clear result cobtainer start***** */



/* ***** JQuery Ajax function to show the Quick Quote start***** */
function showtheQuote(){

resultBox=document.getElementById('result');
resultBox.innerHTML='<img src="images/ajax-loader.gif" border=0 /><font color="black" style="font-size:10px" > Loading....</font>';
url="ajax-req.php";
mnos=document.getElementById('membernos').value;
lang=document.getElementById('lang').value;
havescript=document.getElementById('havescript').value;
myaction="showQuote";

    $.post( url, { membernos: mnos, lang : lang , havescript : havescript , opr : myaction},
      function( data1 ) {
	resultBox.innerHTML=data1;

      }
    );
return false;
}
/* ***** JQuery Ajax function to show the Quick Quote end***** */






/* ***** JQuery Ajax function to send email from Quick Quote page start***** */
function sendEmailQuote(){

resultBox=document.getElementById('result1');
resultBox.innerHTML='<img src="images/ajax-loader.gif" border=0 /><font color="black" style="font-size:10px" > Processing....</font>';
url="ajax-req.php";
emailId=document.getElementById('email').value;
emailTxt=document.getElementById('emailtxt').value;

myaction="sendMail";

    $.post( url, { em: emailId, emtxt : emailTxt , opr : myaction},
      function( data1 ) {
	resultBox.innerHTML=data1;

      }
    );
return false;
}
/* ***** JQuery Ajax function to send email from Quick Quote page end***** */



/* ***** function to clear result container start***** */
function clearResultBox1(){
if( document.getElementById('result1') )
document.getElementById('result1').innerHTML='';
}
/* ***** function to clear result cobtainer start***** */



/* ***** function to get Date elements ***** */
function getCurrDate( date_element ){
date_data="";

var d = new Date();

if(!date_element) date_element='Y';

if( date_element == 'Y')
date_data = d.getFullYear();
else if( date_element == 'M')
date_data = d.getMonth() + 1;
else if( date_element == 'D')
date_data = d.getDate()
else
date_data = d.getFullYear();

document.write(date_data);

}
/* ***** function to clear result cobtainer start***** */

