﻿function showHide(xThis) {
    // http://www.javascriptjunkie.com
    // alert("Hello From www.javascriptjunkie.com" + vThis.tagName);
    xParent = xThis.parentNode;
    xSibling = xParent.nextSibling;
    while (xSibling.nodeType == 3) {   // Fix for Mozilla/FireFox Empty Space becomes a TextNode or Something
        xSibling = xSibling.nextSibling;
    };

    if (xSibling.style.display == "none") {
        xThis.src = "/images/collapse.gif";
        xThis.alt = "Hide";
        xSibling.style.display = "block";
    } else {
        xSibling.style.display = "none";
        xThis.src = "/images/small-plus.gif";
        xThis.alt = "Show";
    }
    return;
}


function OpenChatPopUp() {
    var url = "/UserControl/livechat.htm";
    newwindow = window.open(url, 'name', 'height=200,width=350');
    if (window.focus) { newwindow.focus() }
    return false;

}





function CheckStartDateAndEndDate(txtStartDate,txtEndDate)
{
alert('sss');
   var bval = true;
   var hh = document.getElementById(txtStartDate).value;
   var hh1 = document.getElementById(txtEndDate).value


if(hh == '' || hh1 == '' || hh == null || hh1 == null)
{
alert("Please Enter the Start Date and End Date!");
bval = false;
return false;
}

if(document.getElementById(txtStartDate).value != "" && document.getElementById(txtEndDate).value != "")
{
var stdate=new Array();
stdate=document.getElementById(txtStartDate).value.split('/');
var stmm=stdate[0]; //month
var stdd=stdate[1]; //day
var styy=stdate[2];
//alert(stdd);
var enddate=new Array();
enddate=document.getElementById(txtEndDate).value.split('/');
var enmm=enddate[0]; //month
var endd=enddate[1]; //day
var enyy=enddate[2];

//get current date month and year
var d=new Date();
var curdate=parseInt(d.getDate());
var curmonth=parseInt(d.getMonth() +1);
var curyear=parseInt(d.getFullYear());

if(curdate == 1 || curdate == 2 || curdate == 3 || curdate == 4 || curdate == 5 || curdate == 6
|| curdate == 7 || curdate == 8 || curdate == 9)
{

curdate= "0"+curdate;
//alert(curdate);
}
if(curmonth == 1 || curmonth == 2 || curmonth == 3 || curmonth == 4 || curmonth == 5 || curmonth == 6
|| curmonth == 7 || curmonth == 8 || curmonth == 9)
{

curmonth= "0"+curmonth;
// alert(curmonth);
}



styy=styy.substring(4,0);
enyy=enyy.substring(4,0);

//start date must be less than current date......

if(styy < curyear)
{
alert("Start year can not be less than current year .");
return false;
}
if(styy == curyear)
{
if(stmm < curmonth)
{
alert("Start month can not be less than current month .");
return false;
}

}
if(styy == curyear)
{
if(stmm == curmonth)
{

if(stdd < curdate)
{
alert("Start date can not be less than today's date .");
return false;
}
}

}

//end of ....checking................

if(enyy < styy)
{
alert("Start date must be less than enddate");
document.getElementById(txtStartDate).value="";
document.getElementById(txtStartDate).focus();
document.getElementById(txtEndDate).value="";
document.getElementById(txtEndDate).focus();
return false;
}
if(enyy == styy)
{
if(enmm < stmm)
{
alert("Start date must be less than enddate");
document.getElementById(txtStartDate).value="";
document.getElementById(txtStartDate).focus();
document.getElementById(txtEndDate).value="";
document.getElementById(txtEndDate).focus();
return false;
}
}
if(enyy == styy)
{
if(enmm == stmm)
{
if(endd <= stdd)
{
alert("Start date must be less than enddate");
document.getElementById(txtStartDate).value="";
document.getElementById(txtStartDate).focus();
document.getElementById(txtEndDate).value="";
document.getElementById(txtEndDate).focus();
return false;
}

}
}
}

}



function checkChangeORNot(Pagepath) {
    var Res = true;
    Pagepath = Pagepath.toUpperCase();
     var myPageName = ["ContentView.aspx", "Default.aspx", "Home.aspx", "#won", "#sec","#regional","#directors","#fellow","mailto:","http://promotionalsuccess.tv/","galadinner.quickorder.uk.com","CMSPagePicture","ctl00$loginpanel$LinkButton2", "ctl00$loginpanel$LinkButton1", "http://www.clikhost.co.uk", "http://www.bpma.co.uk","ForgottenDetails.aspx", "http://www.bpma-sourcing.co.uk", "http://www.tradeonly.co.uk", "http://twitter.com/bpma","http://www.graphicmail.co.uk","http://www.awardsdinner.quickorder.uk.com/","http://www.tradeonlyshows.com/", "http://wwww.bpmamail.co.uk/", "http://www.sourcingcity.co.uk/","http://www.b2bprospector.co.uk", "http://www.bpmamail.co.uk", "http://www.promotionalsuccess.tv","http://www.intertek.com","http://www.earthbag.co.uk","http://www.legislation.gov.uk","http://www.london2012.com","http://www.royal.gov.uk","#1","#2","#3","#4","#5","#6","#7","#8","#9","#10","#11","#12"];
    for (var i = 0; i < myPageName.length; i++) {
        var PName = myPageName[i].toUpperCase();
        var index = Pagepath.indexOf(PName);
        if (index != -1)
        { Res = false;break; }
    }
    return Res;
}




