﻿// JavaScript File
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_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_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 newWindow(mypage,myname,w,h,features) {
  if(screen.width){
  var winl = (screen.width-w)/74;
  var wint = (screen.height-h)/52;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}

function CallProducts()
{
  var x=document.getElementById("ddlCat");
  var y=document.getElementById("ddlSize");
  var z=x.options[x.selectedIndex].value;
  var w=y.options[y.selectedIndex].value;
  //select product
  if(z=="select product")
  {
    alert("select product & size","HEllo");
  }
  else
  {
    window.location="WhichPage.aspx?Cat="+z+"&Size="+w;
 }
}
/*
function ex(t)
{
    obj=t;
    obj.style.width=225;
    obj.size=3;//t.options.length;
    t.focus();
}

function xe(t)
{
    obj=t;
    obj.style.width=178;
    obj.size=1;
    var s=document.getElementById("go");
    s.focus();
}

function ex1(t)
{
    if (t.options.length > 1)
    {
        obj=t;
        obj.style.width=225;
        obj.size=3;//t.options.length;
        t.focus();
    }
}

function xe1(t)
{
    obj=t;
    obj.style.width=150;
    obj.size=1;
    var s=document.getElementById("go");
    s.focus();
}

function xe2(t)
{
    obj=t;
    obj.style.width=178;
    obj.size=1;
    var s=document.getElementById("go");
    s.focus();
}
*/

 function changeSize()
    {
        var obj= document.getElementById("lblSize");
        var d=document.getElementById("ddlSize1");
        obj.innerHTML=d.options[d.selectedIndex].text;
    }    
    
    function chkCat(x)
    {
        if(x.options[x.selectedIndex].value=='select product')
        {
             alert('select category');
        }
    }
  
     function valid(t)
    {
        v=false;
        if (!(t.txtEmail.value==""))
        {
            apos=t.txtEmail.value.indexOf("@"); 
            dotpos=t.txtEmail.value.lastIndexOf(".");
            lastpos=t.txtEmail.value.length-1;
            if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
            { alert("not valid email id"); v= false; t.txtEmail.focus(); return false; }
        }
        if(t.txtName.value=="")
        {
        alert('Fill your name');
        t.txtName.focus();
        }
        else if (t.txtEmail.value=="")
        {
        alert("Fill email id ");
        t.txtEmail.focus();
        }
        else if (t.txtState.value=="")
        {
            alert("Fill State ");
            t.txtState.focus();
        }
        else if (t.txtCity.value=="")
        {
            alert("Fill City");
            t.txtCity.focus();
        }
        else if (t.up1.value=="")
        {
            alert("Select file ");
            t.up1.focus();
        }
        else
        {
            v= true;
        }
        
        return v;
    }
    
    function validProd(t)
    {
        v=false;
        if (t.txtProdName.value=="")
        {
            alert('Product Name not filled');
            t.txtProdName.focus();
        }
        else if (t.txtProdCode.value=="")
        {
            alert("Product Code not filled");
            t.txtProdCode.focus();
        }
//        else if (t.upThumb.value=="")
//        {
//            alert("Select thumbnail File ");
//            t.upThumb.focus();
//        }
//        else if (t.upZoom.value=="")
//        {
//            alert("select zoom file");
//            t.upZoom.focus()
//        }
        else
        {        
            v=true;
            var agree=confirm("Are You Sure?");
            if (agree)
            return true ;       
            else
            return false ;                   
         
        }
        return v
    }
    
    function ser(t)
    {
        var obj=document.getElementById("txtSearch");
        if (!(obj.value == "search"))
        {
            window.location="search.aspx?ser="+obj.value;
        }
        else
        {
            alert('Type a search item');
        }
    }
    
    function clearTex(t)
    {
        if (t.value=="search")
        {        t.value = ""; }
    }
    
    function fillTex(t)
    {
        if (t.value=="")
        //{ t.value="search"; }
        { t.value="search"; }
        
    }
    
    function load()
    {
        MM_preloadImages('images/top_icon_roll_01.jpg','images/top_icon_roll_02.jpg','images/top_icon_roll_03.jpg');
        Hi()
    }


    function Hi()
    {
        key=document.getElementById("ImageButton1");
        key.style.display="none";
    }
    
     function She()
    {
        key=document.getElementById("ImageButton1");
        key.style.display="block";
    }
    
    function changeSize()
    {
        var obj= document.getElementById("lblSize");
        var d=document.getElementById("ddlSize1");
        obj.innerHTML=d.options[d.selectedIndex].text;
    }
    
    
    function validNewUser(t)
    {
        v=false;
        if(Form1.txtFName.value=="" || Form1.txtFName.value==null)
        {
            alert("First Name should be filled");
            Form1.txtFName.focus();
        }
        else if (Form1.txtLName.value=="" || Form1.txtLName.value==null)
        {
            alert("Last Name should be filled");
            Form1.txtLName.focus();
        }
        else if(Form1.txtAddress.value=="" || Form1.txtAddress.value==null)
        {
            alert("Address should be filled");
            Form1.txtAddress.focus();
        }
        else if(Form1.txtPinNo.value=="" || Form1.txtPinNo==null)
        {
            alert("Pin No should be filled");
            Form1.txtPinNo.focus();
        }
        else if(Form1.txtCity.value=="" || Form1.txtCity.value==null)
        {
            alert("City should be filled");
            Form1.txtCity.focus();
        }
        else if(Form1.txtState.value=="" || Form1.txtState.value==null)
        {
            alert("State should be filled");
            Form1.txtState.focus();
        }
        else if(Form1.txtCountry.value=="" || Form1.txtCountry.value==null)
        {
            alert("Country should be filled");
            Form1.txtCountry.focus();
        }
        else if(Form1.txtTelNo.value=="" || Form1.txtTelNo.value==null)
        {
            alert("Tel No should be filled");
            Form1.txtTelNo.focus();
        }
        else if(!(Form1.txtTelNo.value=="" || Form1.txtTelNo.value==null))
        {
            if(Form1.txtEmail.value=="" || Form1.txtEmail.value==null)
            {
                alert("Email should be filled");
                Form1.txtEmail.focus();
            }
        else if (!(Form1.txtEmail.value=="" || Form1.txtEmail.value==null))
        {
            apos=Form1.txtEmail.value.indexOf("@"); 
            dotpos=Form1.txtEmail.value.lastIndexOf(".");
            lastpos=Form1.txtEmail.value.length-1;
            if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
            { alert("not valid email id"); }
            else if(Form1.txtUserName.value=="" || Form1.txtUserName.value=="")
            {
            alert("User name should be filled");
            Form1.txtUserName.focus();
            }
            else if(Form1.txtPassword.value=="" || Form1.txtPassword.value=="")
            {
                alert("Password must be filled")
                Form1.txtPassword.focus();
            }
            else if(Form1.txtCPassword.value=="" || Form1.txtCPassword.value=="")
            {
            alert("Confirm Password should be filled")
            Form1.txtCPassword.focus();
            }
            else if(!(Form1.txtCPassword.value=="" || Form1.txtCPassword.value==""))
            {
                if(!(Form1.txtPassword.value==Form1.txtCPassword.value))
                {
                    alert("Password and confirm password are not same")
                }
                else if(!(Form1.txtPassword.value.length>=6 && Form1.txtPassword.value.length<=32))
                {
                    alert("Your Password must be of minimum six and maximum 32 ")
                    Form1.txtPassword.focus();
                }
                else 
                {
                    v=true;
                } 
            }
        } 
    }
    return v;
}


function numeric(t)
{
v=false;
if(t.txtJobCode.value=="")
 {
    alert('Please Enter Job Code !');
    t.txtJobCode.focus();
 }
 else if(t.txtPost.value=="")
 {
   alert('Please Enter Post !');
   t.txtPost.focus();
 }
 else if(t.txtPostedBy.value=="")
 {
   alert('Please Enter Posted By !');
   t.txtPostedBy.focus();
 }
 else if(t.txtConDet.value=="")
 {
   alert('Please Contact Number !');
   t.txtConDet.focus();
 }
 else if(t.txtMinExp.value=="")
 {
   alert('Please Enter Min Exp. !');
   t.txtMinExp.focus();
 }
 else if(t.txtMaxExp.value=="")
 {
   alert('Please Enter Max Exp. !');
   t.txtMaxExp.focus();
 }
 else if(t.txtQuali.value=="")
 {
   alert('Please Enter Qualification !');
   t.txtQuali.focus();
 }
 else if(t.txtLocation.value=="")
 {
   alert('Please Enter Location !');
   t.txtLocation.focus();
 }
 else if(t.txtVac.value=="")
 {
   alert('Please Enter Vacancy!');
   t.txtVac.focus();
 }
else
{
var checkOK = "0123456789";
var checkStr = t.txtConDet.value;
var checkStr1 = t.txtMinExp.value;
var checkStr2 = t.txtMaxExp.value;
var checkStr3 = t.txtVac.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please fill the numeric value.");
t.txtConDet.focus();
//alert('sss123');
return false;
}
//*****************************************
for (i = 0;  i < checkStr1.length;  i++)
{
ch = checkStr1.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please fill the numeric value.");
t.txtMinExp.focus();
//alert('sss123');
return false;
}
//*****************************************
for (i = 0;  i < checkStr2.length;  i++)
{
ch = checkStr2.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please fill the numeric value.");
t.txtMaxExp.focus();
//alert('sss123');
return false;
}
//*****************************************
for (i = 0;  i < checkStr3.length;  i++)
{
ch = checkStr3.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please fill the numeric value.");
t.txtVac.focus();
//alert('sss123');
return false;
}
return true;
}
return false;
}