//Popup js goes here
var popupStatus = 0;
//loading popup with jQuery
function loadPopup(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupdownload").fadeIn("slow");
		popupStatus = 1;
	}
}

//disabling popup with jQuery
function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundPopup").hide();
		$("#popupdownload").hide();
		popupStatus = 0;
	}
}

//centering popup
function centerPopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupdownload").height();
	var popupWidth = $("#popupdownload").width();
	//centering with the Help of CSS
	$("#popupdownload").css({
            "position": "rel",
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	//IE6 Working Trick

	$("#backgroundPopup").css({
            "width": windowWidth,
		"height": windowHeight*2
	});

}

function downloadPopup(idval){
		loadPopup();
                centerPopup();
}


//CONTROLLING EVENTS IN jQuery
$(document).ready(function(){
	//LOADING POPUP when the Button Triggered
	$("#button").click(function(){
		//centering with css
		centerPopup();
		//load popup
		loadPopup();
    });

	//CLOSING POPUP
	//when click the x symbol
	$("#popupdownloadClose").click(function(){
                disablePopup();

	});
	//when click outside
	$("#backgroundPopup").click(function(){
                disablePopup();
	});
	//When Pressed Esc Symbol
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			disablePopup();
                }
	});
	//LOADING POPUP
	//Click the button event!
	$(".button1").click(function(){
		//centering with css
		centerPopup();
		//load popup
		loadPopup();
	});
	//CLOSING POPUP
	//Click the x event!
	$("#popupdownloadClose").click(function(){
		disablePopup();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			disablePopup();
		}
	});
         function megaHoverOver(){
                    $(this).find(".sub").stop().fadeTo('fast', 1).show();
                    //Calculate width of all ul's
                    (function($) {
                        jQuery.fn.calcSubWidth = function() {
                            rowWidth = 0;
                            //Calculate row
                            $(this).find("ul").each(function() {
                                rowWidth += $(this).width();
                            });
                        };
                    })(jQuery);
                    if ( $(this).find(".row").length > 0 ) { //If row exists...
                        var biggestRow = 0;
                        //Calculate each row
                        $(this).find(".row").each(function() {
                            $(this).calcSubWidth();
                            //Find biggest row
                            if(rowWidth > biggestRow) {
                                biggestRow = rowWidth;
                            }
                        });
                        //Set width
                        $(this).find(".sub").css({'width' :biggestRow});
                        $(this).find(".row:last").css({'margin':'0'});

                    } else { //If row does not exist...

                        $(this).calcSubWidth();
                        //Set Width
                        $(this).find(".sub").css({'width' : rowWidth});
                    }
                }

                //Global top menu Drop Down
                function megaHoverOut(){
                    $(this).find(".sub").stop().fadeTo('fast', 0, function() {
                        $(this).hide();
                    });
                }
                var config = {
                    sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)
                    interval: 0, // number = milliseconds for onMouseOver polling interval
                    over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
                    timeout: 0, // number = milliseconds delay before onMouseOut
                    out: megaHoverOut // function = onMouseOut callback (REQUIRED)
                };
                $("ul#topnav li .sub").css({'opacity':'0'});
                $("ul#topnav li").hoverIntent(config);

//           Home Page Alone for Products Navigation Slider
            var currentPosition = 0;
                var slideWidth = 340;
                var slides = $('.slide');
                var numberOfSlides = slides.length;

                // Remove scrollbar in JS
                $('#slidesContainer').css('overflow', 'hidden');

                // Wrap all .slides with #slideInner div
                slides
                .wrapAll('<div id="slideInner"></div>')
                // Float left to display horizontally, readjust .slides width
                .css({
                    'float' : 'left',
                    'width' : slideWidth
                });

                // Set #slideInner width equal to total width of all slides
                $('#slideInner').css('width', slideWidth * numberOfSlides);

                // Insert controls in the DOM
                $('#slideshow')
                .prepend('<span class="control" id="leftControl">Clicking moves left</span>')
                .append('<span class="control" id="rightControl">Clicking moves right</span>');

                // Hide left arrow control on first load
                manageControls(currentPosition);

                // Create event listeners for .controls clicks
                $('.control')
                .bind('click', function(){
                    // Determine new position
                    currentPosition = ($(this).attr('id')=='rightControl') ? currentPosition+1 : currentPosition-1;

                    // Hide / show controls
                    manageControls(currentPosition);
                    // Move slideInner using margin-left
                    $('#slideInner').animate({
                        'marginLeft' : slideWidth*(-currentPosition)
                    });
                });

                // manageControls: Hides and Shows controls depending on currentPosition
                function manageControls(position){
                    // Hide left arrow if position is first slide
                    if(position==0){ $('#leftControl').hide() } else{ $('#leftControl').show() }
                    // Hide right arrow if position is last slide
                    if(position==numberOfSlides-1){ $('#rightControl').hide() } else{ $('#rightControl').show() }
                }
				
	// Plus Minus Code Hide (Collapse) the toggle containers on load
	$(".toggle_container").hide();
        $("h4.trigger:first").addClass("active").next().show();
	//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
	$("h4.trigger").click(function(){
		$(this).toggleClass("active").next().slideToggle(400);

		return false; //Prevent the browser jump to the link anchor
	});
});

// Toggle Function Goes Here 
function addMinusToggle(idval,val){
            var obj = document.getElementById('addMinusCont'+val).style.display;
            if (obj == 'none'){
                document.getElementById('addMinus'+val).style.backgroundImage = "url(<?php echo SITEURL; ?>images/minus.png)";
                return false;
            }
            else if (obj == 'block'){
                document.getElementById('addMinus'+val).style.backgroundImage = "url(<?php echo SITEURL; ?>images/add.png)";
                return false;
            }
            else{
                document.getElementById('addMinus'+val).style.backgroundImage = "url(<?php echo SITEURL; ?>images/add.png)";
            }
        }
		
//Chatslider js goes here
function getActualX(n){var docEl=document.documentElement;var body=document.body;}
function getActualY(n){var docEl=document.documentElement;var body=document.body;}
function getScrollX(){var docEl=document.documentElement;var body=document.body;return(window.scrollX)?window.scrollX:(docEl.scrollLeft)?docEl.scrollLeft:(body.scrollLeft)?document.body.scrollLeft:0;}
function getScrollY(){var docEl=document.documentElement;var body=document.body;return(window.scrollY)?window.scrollY:(docEl.scrollTop)?docEl.scrollTop:(body.scrollTop)?body.scrollTop:0;}
function getViewportWidth(){var docEl=document.documentElement;var body=document.body;return(window.innerWidth)?window.innerWidth:(docEl.clientWidth)?docEl.clientWidth:(body.clientWidth)?body.clientWidth:0;}
function getViewportHeight(){var docEl=document.documentElement;var body=document.body;return(window.innerHeight)?window.innerHeight:(docEl.clientHeight)?docEl.clientHeight:(body.clientHeight)?body.clientHeight:0;}
function getScreenX(){return window.screenX;}
function getScreenY(){return window.screenY;}
function getScreenWidth(){return screen.width;}
function getScreenHeight(){return screen.height;}
function getBrowserWidth(){return window.outerWidth;}
function getBrowserHeight(){return window.outerHeight;}
function getOffsetLeft(n){var result=n.offsetLeft;for(var parent=n;parent=parent.offsetParent;parent!=null){result+=parent.offsetLeft;}
return result;}
function getOffsetTop(n){var result=n.offsetTop;for(var parent=n;parent=parent.offsetParent;parent!=null){result+=parent.offsetTop;}
return result;}
function var_dump(n){document.write("<style type=\"text/css\"> "+"body { font:10px/1.3 \"Lucida Grande\" } "+"</style>");for(var p in n){document.write("<b>"+p+"</b>"+"<span style=\"color:red;\"> = </span>"+n[p]+"<br>");}}
var MAC="Mac";var WIN="Win";var OPERA="Opera";var CAMINO="Camino";var WEB_KIT="AppleWebKit";var GECKO="Gecko";var MSIE="MSIE";var MSIE_50=MSIE+" 5.0";var MSIE_55=MSIE+" 5.5";var MSIE_6=MSIE+" 6";var isMac,isWin,isOpera,isCamino,isSafari,isGecko,isIE5Mac,isIEWin,isIE50Win,isIE55Win,isIE6Win;function UADetect(){var UA=navigator.userAgent;if(UA.indexOf(MAC)!=-1)
isMac=true;else if(UA.indexOf(WIN)!=-1)
isWin=true;if(UA.indexOf(OPERA)!=-1)
isOpera=true;else if(UA.indexOf(CAMINO)!=-1)
isCamino=true;else if(UA.indexOf(WEB_KIT)!=-1)
isSafari=true;else if(UA.indexOf(GECKO)!=-1)
isGecko=true;else if(isMac&&UA.indexOf(MSIE)!=-1)
isIE5Mac=true;else if(isWin&&UA.indexOf(MSIE)!=-1&&!isOpera){isIEWin=true;if(UA.indexOf(MSIE_50)!=-1)
isIE50Win=true;else if(UA.indexOf(MSIE_55)!=-1)
isIE55Win=true;else if(UA.indexOf(MSIE_6)!=-1)
isIE6Win=true;}}
function UAWarning(){if(isIEWin||isGecko){return;}
var c=new Cookie("rackspace.ua.warning","true");if(Cookie.pageHasCookieWithNameAndValue(c)){return;}
Cookie.set(c);}
UADetect();UAWarning();function confirmAction(evt,msg){evt=new Evt(evt,true);if(!confirm(msg)){evt.cancel();}}
function closePopupRefresh(URL){window.close();window.opener.location.href=URL;}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}

//Faq Function calling
function ShowFAQ()
{var obj=document.getElementById('FaqDiv');
                if(obj!=null)
                {if(obj.style.display=="none")
                    {obj.style.display="inline";
                    }
                    else
                        obj.style.display="none";
                }}

//Validation js script goes here
function nameChck(idval,val)
{
    var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?0123456789";
    var obj = document.getElementById(idval)
    txt = document.getElementById(idval).value.length
    if (txt > 0)
    {
        for (var i = 0; i < obj.value.length; i++)   {
            if (iChars.indexOf(obj.value.charAt(i)) != -1) {
                document.getElementById('name_err'+val).style.display = "block";
                return false;
            }
            else
            {
                document.getElementById('name_err'+val).style.display="none";
            }
        }
    }else
    {
        document.getElementById('name_err'+val).style.display="none";
    }
}

function nameEmptyChck(idval,val)
{
    //alert ('hai ram am working');
    var obj1 = document.getElementById(idval).value;
    txt = document.getElementById(idval).value.length;
    if (txt < 1 || obj1 == 'Name')
    {
        document.getElementById('name_err'+val).style.display = "block";
         return false;
    }
    else
    {
        nameChck(this.id);
    }

}



function numberChck(idval,val)
{
    var iChars = "!@#$%^&*()=-[]\\\';,./{}|\":<>?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~`";
    var obj = document.getElementById(idval)
    txt = document.getElementById(idval).value.length
    if (txt > 0)
    {
        for (var i = 0; i < obj.value.length; i++)   {
            if (iChars.indexOf(obj.value.charAt(i)) != -1) {
                document.getElementById('ph_err'+val).style.display = "block";
                return false;
            }
            else
            {
                document.getElementById('ph_err'+val).style.display="none";
            }
        }
    }
    else
    {
        document.getElementById('ph_err'+val).style.display="none";
    }
}

function websiteChck(){
	var companyUrl = document.getElementById('txt_web5').value;
    var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/;
    if(RegExp.test(companyUrl))
    {
        document.getElementById('web_err5').style.display = "none";
        return true;
    }
    else
    {
        document.getElementById('web_err5').style.display = "block";
        return false;
    }
}

function msgChck(idval,val)
{
    //alert ('hai ram am working');
    var obj = document.getElementById(idval);
    var obj1 = document.getElementById(idval).value;
    txt = document.getElementById(idval).value.length;
    if (txt < 1 || obj1 == 'Message')
    {
        document.getElementById('msg_err'+val).style.display = "block";
         return false;
    }
    else
    {
        document.getElementById('msg_err'+val).style.display = "none";
        return true;
    }

}


function mailChck(idval,val)
{
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    var obj = document.getElementById(idval)
    var address = document.getElementById(idval).value
    txt = document.getElementById(idval).value.length
    if(reg.test(address) == false) {
        document.getElementById('mail_err'+val).style.display="block";
        return false;
    }
    else{
        document.getElementById('mail_err'+val).style.display="none";
        return true;
    }

}





function validateForm(){
    //alert ('hai ram am working');

    var txtName = document.getElementById('txtname1').value;
    var txtMail = document.getElementById('txtemail1').value;
    var txtNameErr = document.getElementById('name_err1').style.display;
    var txtMailErr = document.getElementById('mail_err1').style.display;

    if ((txtName == '' || txtName == 'Name' || txtNameErr == 'block') && (txtMail == '' || txtMail == 'E-mail' || txtMailErr == 'block')){

        document.getElementById('name_err1').style.display = "block";
        document.getElementById('mail_err1').style.display = "block";
        document.getElementById('txtname1').focus();
        return false;
    }
	
	else if (txtName == '' || txtName == 'Name' || txtNameErr == 'block'){

        document.getElementById('name_err1').style.display= "block";
        document.getElementById('txtname1').focus();
        return false;

    }
    else if (txtMail == '' || txtMail == 'E-mail' || txtMailErr == 'block'){

        document.getElementById('mail_err1').style.display = "block";
        document.getElementById('txtemail1').focus();
        return false;
    }
	else
    {
         callConstantContact();
        //document.forms["signup"].submit();
        return false;
    }

}


// contact us page send validation
function sendUsMsg(){
    //var select = document.getElementById('selectTopic').value;
    //  alert (select);
    var select = document.getElementById('selectTopic').value;
    if (select == '')
    {
        document.getElementById('select_topicerr').style.display = "block";
        document.getElementById('selectTopic').focus();
        return false;
    }
    else
    {
        document.getElementById('select_topicerr').style.display = "none";        
        if(validateContact(this.id,3)) {
            if(captchaNull3(this.id)){
                document.forms["myform"].submit();
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
        
        
    }
}


function captchaNull2(idval){

    var obj = document.getElementById('captcha').value;
    if (obj == '' || obj == 'Verify'){
        document.getElementById('captcha_err2').style.display = "block";


    }
    else {
    document.getElementById('captcha_err2').style.display = "none";

}
}

function captchaNull3(idval)
{

    var obj = document.getElementById('captcha').value;
    if (obj == '' || obj == 'Verify'){
        document.getElementById('captcha_err3').style.display = "block";
        return false;
    }
    else {
        document.getElementById('captcha_err3').style.display = "none";
        return true;
    }
}


function validateContCaptcha(idval,val){
    captchaNull2(this.id);
    if(validateContact(this.id,2)) {
        callQuickContact();
    }
}


// Global for Quick contact and Contact us page
function validateContact(idval,val){

    var txtName = document.getElementById('txtname'+val).value;
    var txtMail = document.getElementById('txt_mail'+val).value;
    var txtMsg = document.getElementById('txt_msg'+val).value;
    var txtNameErr = document.getElementById('name_err'+val).style.display;
    var txtMailErr = document.getElementById('mail_err'+val).style.display;
    var txtMsgErr = document.getElementById('msg_err'+val).style.display;

    if ((txtName == '' || txtName == 'Name' || txtNameErr == 'block') && (txtMail == '' || txtMail == 'E-mail' || txtMailErr == 'block') && (txtMsg == '' || txtMsg == 'Message' || txtMsgErr == 'block')){

        document.getElementById('name_err'+val).style.display = "block";
        document.getElementById('mail_err'+val).style.display = "block";
        document.getElementById('msg_err'+val).style.display = "block";
        document.getElementById('txtname'+val).focus();
        return false;
    }

    else if ((txtName == '' || txtName == 'Name' || txtNameErr == 'block') && (txtMsg == '' || txtMsg == 'Message' || txtMsgErr == 'block')){
        document.getElementById('name_err'+val).style.display = "block";
        document.getElementById('msg_err'+val).style.display = "block";
        document.getElementById('txtname'+val).focus();
        return false;
    }

    else if ((txtMail == '' || txtMail == 'E-mail' || txtMailErr == 'block') && (txtMsg == '' || txtMsg == 'Message' || txtMsgErr == 'block')){
        document.getElementById('mail_err'+val).style.display = "block";
        document.getElementById('msg_err'+val).style.display = "block";
        document.getElementById('txt_mail'+val).focus();
        return false;
    }

    else if (txtName == '' || txtName == 'Name' || txtNameErr == 'block'){

        document.getElementById('Name_err'+val).style.display = "block";
        document.getElementById('txtname'+val).focus();
        return false;

    }
    else if (txtMail == '' || txtMail == 'E-mail' || txtMailErr == 'block'){

        document.getElementById('mail_err'+val).style.display = "block";
        document.getElementById('txt_mail'+val).focus();
        return false;
    }
    else if (txtMsg == '' || txtMsg == 'Message' || txtMsgErr == 'block'){

        document.getElementById('msg_err'+val).style.display = "block";
        document.getElementById('txt_msg'+val).focus();
        return false;

    }
    else
    {        
        return true;
    }

}

/********* Quick contact ajax function - Start **********/
//function callQuickContact() {
//    var fullName = document.getElementById('txtname2').value;
//    var email = document.getElementById('txt_mail2').value;
//    var QcContent = document.getElementById('txt_msg2').value;
//    var verify = document.getElementById('captcha').value;
//    doAjax('<?php echo SITEURL; ?>includes/quickcontact.php','name='+fullName+'&email='+email+'&qccontent='+QcContent+'&verify='+verify,'showQcMessage','post');
//}
//function showQcMessage(item) {
//    var showContent = '';
//    if(item == 'success') {
//        showContent = '<span style="color:#00FF00;font-weight:bold;">Message send successfully.</span>';
//    }
//    if(item == 'faild') {
//        showContent = '<span style="color:#FF0000;font-weight:bold;">Message send failed.</span>';
//    }
//    if(item == 'verify') {
//        showContent = '<span style="color:#FF0000;font-weight:bold;">Verification code not valid.</span>';
//    }
//
//        document.getElementById('bindmsg').innerHTML = showContent;
//}
/**** Quick contact ajax function - End **********/



function validateDownloadStart(idval,val){
    captchaNull5(this.id);
    validateDownload(this.id,5);
}

function captchaNull5(idval){
    var obj = document.getElementById('verify').value;
    if (obj == '' || obj == 'Verify'){
        document.getElementById('captcha_err5').style.display = "block";
        return false;
    }
    else {
    document.getElementById('captcha_err5').style.display = "none";
    return true;
}
}

// Download Popup validation
function validateDownload(idval,val){
    //alert ('hi ram am working');

    var txtName = document.getElementById('txtname'+val).value;
    var txtMail = document.getElementById('txt_mail'+val).value;
    var txtWeb = document.getElementById('txt_web'+val).value;
    var txtNameErr = document.getElementById('name_err'+val).style.display;
    var txtMailErr = document.getElementById('mail_err'+val).style.display;
    var txtWebErr = document.getElementById('web_err'+val).style.display;

    if ((txtName == '' || txtName == 'Name' || txtNameErr == 'block') && (txtMail == '' || txtMail == 'E-mail' || txtMailErr == 'block') && (txtWeb == '' || txtWeb == 'www.domainname.com' || txtWebErr == 'block')){

        document.getElementById('name_err'+val).style.display = "block";
        document.getElementById('mail_err'+val).style.display = "block";
        document.getElementById('web_err'+val).style.display = "block";
        document.getElementById('txtname'+val).focus();
        return false;
    }

    else if ((txtName == '' || txtName == 'Name' || txtNameErr == 'block') && (txtWeb == '' || txtWeb == 'www.domainname.com' || txtMsgErr == 'block')){
        document.getElementById('name_err'+val).style.display = "block";
        document.getElementById('web_err'+val).style.display = "block";
        document.getElementById('txtname'+val).focus();
        return false;
    }

    else if ((txtMail == '' || txtMail == 'E-mail' || txtMailErr == 'block') && (txtWeb == '' || txtWeb == 'www.domainname.com' || txtWebErr == 'block')){
        document.getElementById('mail_err'+val).style.display = "block";
        document.getElementById('web_err'+val).style.display = "block";
        document.getElementById('txt_mail'+val).focus();
        return false;
    }

    else if (txtName == '' || txtName == 'Name' || txtNameErr == 'block'){

        document.getElementById('name_err'+val).style.display = "block";
        document.getElementById('txtname'+val).focus();
        return false;

    }
    else if (txtMail == '' || txtMail == 'E-mail' || txtMailErr == 'block'){

        document.getElementById('mail_err'+val).style.display = "block";
        document.getElementById('txt_mail'+val).focus();
        return false;
    }
    else if (txtWeb == '' || txtWeb == 'www.domainname.com' || txtWebErr == 'block'){

        document.getElementById('web_err'+val).style.display = "block";
        document.getElementById('txt_web'+val).focus();
        return false;

    }
    else
    {
        callDownload();
        return true;
    }
}

// Cart Page Validation
function validateCart(idval,val){
    /*var obj = document.getElementById('radio'+val);
    //var obj1 = document.getElementById('licence'+val);
    var radio = document.getElementById('radio'+val).value;
    var license = document.getElementById('license'+val).value;
    var total = radio*license;
    //alert (val);
    //Below Triggers the value of the Radio assigned
    //alert (radio);
    //Below Triggers the value of the Licence assigned
    //alert (license);
    //Below Triggers the Index value of the Select OPtion
    //alert (obj+val);
     for( i=1;i <= 6;i++){
        if(i == obj){
            document.getElementById('license'+i).disabled = false;
            document.getElementById('cost'+val).innerHTML = '$'+total;
            document.getElementById('subTotal').innerHTML = '$'+total;
            return false;
        }
        else {
            document.getElementById('cost'+val).innerHTML = '$'+total;
            document.getElementById('subTotal').innerHTML = '$'+total;
            //var selObj = document.getElementById('license'+ i);
            //(selObj+i).selectedIndex.options.value=3;
                //selObj.selectedIndex.options.value = 5;
            //document.getElementById('license'+i).disabled = true;
            return false;
        }
    } */
}
function showPrice(loopLength){
    document.getElementById('cartMsg').style.display = 'none';
    var total = 0;
    for (var i = 1; i <= loopLength; i++) {
        var productsId = document.getElementById('productID_' + i);
        var productId = productsId.value;
        var qty = document.getElementById('license_' + productId);
        if (productsId.checked) {            
            var price = document.getElementById('price_' + productId);
            //qty.disabled = false;
            total = parseFloat(total) + (parseInt(qty.value) * parseFloat(price.value));            
        } else {
            //qty.options[qty.selectedIndex].value = '1';
            //qty.options['1'].selected = true;
            //qty.selectedIndex = '1';
            //qty.disabled = true;
        }
    }
    document.getElementById('subTotal').innerHTML = '$' + total.toFixed(2) ;
}
function checkSelect(productId,loopLength){
    var proId = document.getElementById(productId);    
    if (!proId.checked) {
        proId.checked = true;
        showPrice(loopLength);

    }
}
function checkSelectProduct(loopLength) {
    var productSelect = false;
    var carMsg = document.getElementById('cartMsg');
    for (var i = 1; i <= loopLength; i++) {
        var productsId = document.getElementById('productID_' + i);
        if (productsId.checked) {
            productSelect = true;
        }
    }
    if(productSelect == false) {        
        carMsg.style.display = 'block';
        carMsg.innerHTML = 'Please select any one of the product.';
        return false;
    } else {
        carMsg.style.display = 'none';
        return true;
    }
        
}

<!-- Just to show Live Chat Calling pls remove when moving to original live -->
function chats(){
alert ('online Chat calling');
}
