﻿var IntScroll = -345;
var intNabisalertTimeOut;
var StoreDirection = -1;
var CurBox = 'mobile';
var intNabisalertTimeOutWork;
var intLastScrollLeft = 0;
var intScrollHome;
var intTmpScollerHomeInt=0;	
var intLastScollerHomeInt=0;
var intNabisScroller;
var IntTmpScrollerInt = 0;

function fn_Onload()
	{
		if (window.location.pathname.toUpperCase().indexOf('IT')!=-1) {document.getElementById('Tab_IT').className="menu_link_active";}
		if (window.location.pathname.toUpperCase().indexOf('MOBILE')!=-1) {document.getElementById('Tab_Mobile').className="menu_link_active";}
		if (window.location.pathname.toUpperCase().indexOf('WEB')!=-1) {document.getElementById('Tab_Cloud').className="menu_link_active";}
		if (window.location.pathname.toUpperCase().indexOf('CUSTOMERS')!=-1) {document.getElementById('Tab_Customers').className="menu_link_active";}
		if (window.location.pathname.toUpperCase().indexOf('ABOUT')!=-1) {document.getElementById('Tab_About').className="menu_link_active";}					 
	}
	
function fn_Scroll_Home()	
	{
	intScrollHome = window.setTimeout("fn_scroll_Home_In()", 1000);	
	
	if (intLastScollerHomeInt==document.getElementById('home_Scroll').scrollTop)
			{
			document.getElementById('home_Scroll').scrollTop=0;
			intLastScollerHomeInt=0;
			}
		else
			{
			intLastScollerHomeInt= document.getElementById('home_Scroll').scrollTop;
			}				
		intScrollHome = window.setTimeout("fn_Scroll_Home()", 5000);
}

	
function fn_scroll_Home_In()
{
		document.getElementById('home_Scroll').scrollTop = document.getElementById('home_Scroll').scrollTop + 2;
		intTmpScollerHomeInt++;
		if (intTmpScollerHomeInt<=110) {intScrollHome = window.setTimeout("fn_scroll_Home_In()", 5);}
			else {intTmpScollerHomeInt=0;}
}	

function fn_AutoScroll() {

    fn_scroll_projects(1);

    if (intLastScrollLeft == document.getElementById('WebScroll').scrollLeft) {
        document.getElementById('WebScroll').scrollLeft = 0;
        intLastScrollLeft = 0;
    }
    else {
        intLastScrollLeft = document.getElementById('WebScroll').scrollLeft;
    }
    intNabisalertTimeOutWork = window.setTimeout("fn_AutoScroll()", 5000);
}

function fn_scroll_projects(IntDir) {
    document.getElementById('WebScroll').scrollLeft = document.getElementById('WebScroll').scrollLeft + (IntDir * 8);
    IntTmpScrollerInt++;
    if (IntTmpScrollerInt <= 49) { intNabisScroller = window.setTimeout("fn_scroll_projects(" + IntDir + ")", 5); }
    else { IntTmpScrollerInt = 0; }
}


function fn_show_contact() {
    StoreDirection = StoreDirection * -1;
    fn_Nabis_Scroll_In('box_contact', StoreDirection);
}


function fn_Nabis_Scroll_In(StrObjName, IntDirection) {

    var ObjDiv = document.getElementById(StrObjName);

    //if (IntScroll== 0) {IntScroll = parseInt(ObjDiv.style.top); }

    IntScroll = IntScroll + (IntDirection * 10);
    //alert(IntDirection);
    ObjDiv.style.left = IntScroll + 'px';

    window.clearTimeout(intNabisalertTimeOut);
    if (IntDirection == 1 && IntScroll <= -2) {
        intNabisalertTimeOut = window.setTimeout("fn_Nabis_Scroll_In('" + StrObjName + "'," + IntDirection + ")", 25);
    }

    if (IntDirection == -1 && IntScroll >= -595) {
        intNabisalertTimeOut = window.setTimeout("fn_Nabis_Scroll_In('" + StrObjName + "'," + IntDirection + ")", 25);
    }
}

function fn_change(StrBox) {
    document.getElementById('box_' + CurBox).style.display = 'none';
    document.getElementById('box_' + StrBox).style.display = '';
    CurBox = StrBox;

}

function fn_checkform() {
    var emailfilter = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
    if (emailfilter.test(document.getElementById('ctl00_eMail').value) == false) { alert('Please Provide a valid Email Address!'); return false };
    if (document.getElementById('ctl00_eMail').value == '') { alert('Please Provide an Email Address!'); return false; }

    return true;
}

function fn_checkform_register() {
    var emailfilter = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
    if (document.getElementById('ctl00_ContentPlaceHolder1_reg_First_Name').value == '') { alert('Please Provide your First Name!'); document.getElementById('ctl00_ContentPlaceHolder1_reg_First_Name').focus(); return false; }
    if (document.getElementById('ctl00_ContentPlaceHolder1_reg_Last_Name').value == '') { alert('Please Provide your Last Name!'); document.getElementById('ctl00_ContentPlaceHolder1_reg_Last_Name').focus(); return false; }
    if (document.getElementById('ctl00_ContentPlaceHolder1_reg_Company').value == '') { alert('Please Provide your Company Name!'); document.getElementById('ctl00_ContentPlaceHolder1_reg_Company').focus(); return false; }
    if (emailfilter.test(document.getElementById('ctl00_ContentPlaceHolder1_reg_Email').value) == false) { alert('Please Provide a valid Email Address!'); document.getElementById('ctl00_ContentPlaceHolder1_reg_Email').focus(); return false };
    if (document.getElementById('ctl00_ContentPlaceHolder1_reg_Email').value == '') { alert('Please Provide an Email Address!'); document.getElementById('ctl00_ContentPlaceHolder1_reg_Email').focus(); return false; }
    if (document.getElementById('ChkTerms').checked == false) { alert('Please check the Terms and Conditions check box!'); document.getElementById('ChkTerms').focus(); return false; }
    return true;
}

function WindowSize() {
    var myWidth = 0, myHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    return { Width: myWidth, Height: myHeight };
}

