﻿function menuhover(divid)
{
    document.getElementById(divid).style.display="";
}
function menuout(divid)
{
    document.getElementById(divid).style.display="none";
}
function imagechange(image_url) 
{
    document.getElementById('headerimg').src = "flashimgupfiles/" + image_url;
}
function ChangeSwf(res) {
    var NewSwf = "/flashimgupfiles/" + res;
    document.embeds.animationname.LoadMovie(0, NewSwf);
}
function swapImage(filename) {
    var b = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0" width="679" height="313" align="middle" id="animationname"><param name="movie" value="flashimgupfiles/' + filename + '" /><param name="wmode" value="transparent" /><embed src="flashimgupfiles/' + filename + '" quality="high" width="679" height="313" align="middle"  wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
    document.getElementById('ctl00_animation').innerHTML = b;
}

function powercalculate(firstid, secondid, coef)
{
    var firstvalue=document.getElementById(firstid).value;
    if(firstvalue!="")
    {
        var secondvalue=Math.round(firstvalue/coef);
        document.getElementById(secondid).value=secondvalue;
    }
    else
    {
        document.getElementById(secondid).value="";
    }
}


function birthcalculate(firstid, secondid)
{
    var firstvalue=document.getElementById(firstid).value;
    if(firstvalue!="")
    {
        var year= new Date();
        document.getElementById(secondid).value=secondvalue;
    }
}



 function  onchng()
  {	 
	  var prem = parseFloat(document.mform.pamnt.value);
	  
	  prem = prem * parseFloat(document.mform.cartype.value);
	  prem = prem * parseFloat(document.mform.cart.value);
	  prem = prem * parseFloat(document.mform.date.value);
	  prem = prem * parseFloat(document.mform.tarik.value) ;
	  
      if (document.mform.cartype.value == 1.00000) {
		document.mform.sharjich.disabled=false;
	  	prem = prem * parseFloat(document.mform.sharjich.value);
	  }else
	  document.mform.sharjich.disabled=true;
  
	  
      if (document.mform.cartype.value == 1.12000) {		
		document.mform.cart.disabled=true;
	  	prem = prem * parseFloat(document.mform.cart.value);
	  }else
	  document.mform.cart.disabled=false;	  
	  document.mform.premum.value = Math.round(prem/1000) * 1000;
	  
	  
      if (document.mform.date.value == 0.10) {		
          document.mform.premum.value = Math.round(prem/10) * 10;
	  }
      if (document.mform.date.value == 0.20) {		
          document.mform.premum.value = Math.round(prem/10) * 10;
	  }	 
      if (document.mform.date.value == 0.25) {		
          document.mform.premum.value = Math.round(prem/10) * 10;
	  }	 	  
      if (document.mform.date.value == 0.33) {		
          document.mform.premum.value = Math.round(prem/100) * 100;
	  }	 
      if (document.mform.date.value == 0.40) {		
          document.mform.premum.value = Math.round(prem/100) * 100;
	  }	 
      if (document.mform.date.value == 0.50) {		
          document.mform.premum.value = Math.round(prem/100) * 100;
	  }	
      if (document.mform.date.value == 0.60) {		
          document.mform.premum.value = Math.round(prem/100) * 100;
	  }	
      if (document.mform.date.value == 0.65) {		
          document.mform.premum.value = Math.round(prem/100) * 100;
	  }		
      if (document.mform.date.value == 0.70) {		
          document.mform.premum.value = Math.round(prem/100) * 100;
	  }		
      if (document.mform.date.value == 0.77) {		
          document.mform.premum.value = Math.round(prem/100) * 100;
	  }	
	  if (document.mform.date.value == 0.85) {		
          document.mform.premum.value = Math.round(prem/100) * 100;
	  }	
	  if (document.mform.date.value == 0.90) {		
          document.mform.premum.value = Math.round(prem/100) * 100;
	  }	
	  else {
	     document.mform.premum.value = Math.round(prem/1000) * 1000;	  
	  }
  }
  
  
function closebuttonwelcome()
{
	document.getElementById('ctl00_ContentPlaceHolder1_popupid2').style.display="none";
	document.getElementById('ctl00_ContentPlaceHolder1_welcome_popup').style.display="none";
}

function OnKeyDownInt(code)
{
//Backspace,Tab,Shift,End,Home,37-40 moving,Delete, 48-57 standard numbers, 96-105 numlock numbers, dot 190,
    var scode = "8,9,16,35,36,37,38,39,40,46,48,49,50,51,52,53,54,55,56,57,96,97,98,99,100,101,102,103,104,105,";
    var kcode = code + ",";
    if( scode.indexOf(kcode) > -1 )
    return true;
    return false;
}


function checkvis1(check1, check2, div1, div2, div3)
{
    if(document.getElementById(check1).checked) 
    {
        document.getElementById(check2).checked = false;
        document.getElementById(check1).checked = true;
        document.getElementById(div1).style.display = "";
        document.getElementById(div2).style.display = "none";
        document.getElementById(div3).style.display = "";
    } 
}


function checkvis2(check1, check2, div1, div2, div3)
{
    if(document.getElementById(check2).checked) 
    {
        document.getElementById(check2).checked = true;
        document.getElementById(check1).checked =false;
        document.getElementById(div1).style.display = "none";
        document.getElementById(div2).style.display = "";
        document.getElementById(div3).style.display = "none";
    }
}

function branches(controlid, count, divvis)
{
    var x = "ctl00_ContentPlaceHolder1_control_";
    var z = "_tableid_";
    var address_x="_address";
    for(var i = 1 ; i<=count; i++)
    {
        var y = x + i + z + i;
        var address_y = x+i+address_x;
        if(y == controlid)
        {
          document.getElementById(controlid).style.display = "";
          document.getElementById('ctl00_ContentPlaceHolder1_hidaddress').value = document.getElementById(address_y).value;
        }
        else
        {
            document.getElementById(y).style.display = "none";
        }
    }
    document.getElementById(divvis).style.display = "none";
}
